Rename crate because I'm bad at this
This commit is contained in:
parent
47c4f20049
commit
b7b8b38543
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "catbox"
|
||||
name = "cat-box"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# catbox
|
||||
# cat-box
|
||||
|
||||
Work in progress game engine, inspired by [arcade](arcade.academy/).
|
||||
|
||||
```rs
|
||||
use catbox::{Event, Game, Keycode, Sprite};
|
||||
use cat_box::{Event, Game, Keycode, Sprite};
|
||||
|
||||
fn main() {
|
||||
let game = Game::new("catbox demo", 1000, 800);
|
||||
let game = Game::new("cat-box demo", 1000, 800);
|
||||
|
||||
let mut i = 0.0;
|
||||
let mut s = Sprite::new("duck.png", 500, 400).unwrap();
|
||||
|
|
24
src/lib.rs
24
src/lib.rs
|
@ -1,10 +1,10 @@
|
|||
//! Work in progress game engine, inspired by [arcade](arcade.academy/).
|
||||
//!
|
||||
//! ```
|
||||
//! use catbox::{Event, Game, Keycode, Sprite};
|
||||
//! ```no_run
|
||||
//! use cat_box::{Event, Game, Keycode, Sprite};
|
||||
//!
|
||||
//! fn main() {
|
||||
//! let game = Game::new("catbox demo", 1000, 800);
|
||||
//! let game = Game::new("cat_box demo", 1000, 800);
|
||||
//!
|
||||
//! let mut i = 0.0;
|
||||
//! let mut s = Sprite::new("duck.png", 500, 400).unwrap();
|
||||
|
@ -148,7 +148,7 @@ impl Sprite {
|
|||
///
|
||||
/// Don't forget to call [`Sprite::draw()`] after this.
|
||||
/// ```
|
||||
/// # use catbox::*;
|
||||
/// # use cat_box::*;
|
||||
/// let s = Sprite::new("duck.png", 500, 400).unwrap();
|
||||
/// ```
|
||||
pub fn new<P: AsRef<Path>>(path: P, x: i32, y: i32) -> Result<Self> {
|
||||
|
@ -168,7 +168,7 @@ impl Sprite {
|
|||
/// Draws the sprite to the window. This should only be called inside your main event loop.
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use catbox::*;
|
||||
/// # use cat_box::*;
|
||||
/// # let mut s = Sprite::new("duck.png", 500, 400).unwrap();
|
||||
/// # let game = Game::new("sprite demo", 1000, 1000);
|
||||
/// # game.run(|canvas, _| {
|
||||
|
@ -189,7 +189,7 @@ impl Sprite {
|
|||
/// Translate the sprite, in the form of (delta x, delta y)
|
||||
///
|
||||
/// ```
|
||||
/// # use catbox::*;
|
||||
/// # use cat_box::*;
|
||||
/// # let mut s = Sprite::new("duck.png", 500, 400).unwrap();
|
||||
/// s.translate((5, 10));
|
||||
/// ```
|
||||
|
@ -204,7 +204,7 @@ impl Sprite {
|
|||
/// Set the angle of the sprite, in degrees of clockwise rotation.
|
||||
///
|
||||
/// ```
|
||||
/// # use catbox::*;
|
||||
/// # use cat_box::*;
|
||||
/// # let mut s = Sprite::new("duck.png", 500, 400).unwrap();
|
||||
/// s.set_angle(45.0);
|
||||
/// ```
|
||||
|
@ -215,7 +215,7 @@ impl Sprite {
|
|||
/// Get the angle of the sprite, in degrees of clockwise rotation.
|
||||
///
|
||||
/// ```
|
||||
/// # use catbox::*;
|
||||
/// # use cat_box::*;
|
||||
/// # let s = Sprite::new("duck.png", 500, 400).unwrap();
|
||||
/// let angle = s.angle();
|
||||
/// ```
|
||||
|
@ -226,7 +226,7 @@ impl Sprite {
|
|||
/// Get the x and y coordinates of the center of the sprite, in the form of (x, y).
|
||||
///
|
||||
/// ```
|
||||
/// # use catbox::*;
|
||||
/// # use cat_box::*;
|
||||
/// # let s = Sprite::new("duck.png", 500, 400).unwrap();
|
||||
/// let (x, y) = s.position();
|
||||
/// ```
|
||||
|
@ -252,7 +252,7 @@ impl Game {
|
|||
/// Make sure to use [`Self::run()`] to actually begin the game logic.
|
||||
///
|
||||
/// ```
|
||||
/// # use catbox::Game;
|
||||
/// # use cat_box::Game;
|
||||
/// Game::new("cool game", 1000, 1000);
|
||||
/// ```
|
||||
///
|
||||
|
@ -268,7 +268,7 @@ impl Game {
|
|||
/// Runs the game. Note: this method blocks, as it uses an infinite loop.
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use catbox::Game;
|
||||
/// # use cat_box::Game;
|
||||
/// # let game = Game::new("Cool game", 1000, 1000);
|
||||
/// game.run(|canvas, events| {
|
||||
/// // Game logic goes here
|
||||
|
@ -304,7 +304,7 @@ impl Game {
|
|||
|
||||
/// Stops the game loop. This method should be called inside the closure that you passed to [`Self::run()`].
|
||||
/// ```
|
||||
/// # use catbox::Game;
|
||||
/// # use cat_box::Game;
|
||||
/// # let game = Game::new("asjdhfkajlsdh", 0, 0);
|
||||
/// // ... in the game loop:
|
||||
/// game.terminate();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use catbox::{Event, Game, Keycode, Sprite};
|
||||
use cat_box::{Event, Game, Keycode, Sprite};
|
||||
|
||||
fn main() {
|
||||
let game = Game::new("catbox demo", 1000, 800);
|
||||
|
|
Loading…
Reference in a new issue