gsa/
lib.rs

1#![deny(missing_docs)]
2
3//! # Game Skunk Advance
4//! Game development library modelled after an imaginary console
5//!
6//! [Changelog](https://git.danitheskunk.com/DaniTheSkunk/gsa/src/branch/master/CHANGLOG.md)
7//!
8//! ## Specs
9//! - Resolution: 304x176 (19x11 tiles)
10//! - Colors: 256 (indexed out of a possible 24-bit)
11//! - Tilesize: 16x16 (or 8x8 for half-tiles)
12//! - Tileset: 65536 tiles, indexed via 0xYYXX
13//!   - rectangle(not id range) of 0x7000 to 0x7F7F semi-reserved
14//! - Sprites: 256 of size 16x16 (pondering allowing larger sprites)
15//! - Backgrounds: 4 of size 1024x1024, scrollable
16//!
17//! ## Getting started
18//! `cargo install gsa`
19//!
20//! `gsa new my_project`
21//!
22//! `cd my_project`
23//!
24//! `cargo run`
25//!
26//! ## Features not yet implemented
27//! - Background effects
28//!   - Rotation? Scaling?
29//!   - Mosaic?
30//!   - Mode7?
31//! - Sprite Effects
32//!   - Rotation? Scaling?
33//!   - Mosaic?
34//! - Sound (no samples)
35//!   - Synth
36//!   - Speech
37//! - Savegames
38//! - Helpers
39//!   - Gamepad text keyboard input
40//!   - Menus
41
42mod background;
43mod buttons;
44mod gsa;
45mod gsa_render_to_screen;
46mod rgb;
47mod run;
48mod sprite;
49mod tileset;
50
51pub use crate::background::*;
52pub use crate::buttons::*;
53pub use crate::gsa::*;
54pub use crate::rgb::*;
55pub use crate::run::run;
56pub use crate::sprite::*;
57
58/// Amount of sprites in [Gsa::sprites]
59pub const MAX_SPRITES: usize = 0xff;
60
61/// Screen Width in pixels
62pub const SCREEN_WIDTH: usize = 304;
63
64/// Screen Height in pixels
65pub const SCREEN_HEIGHT: usize = 176;
66
67/// X and y dimensions of maps in [Gsa::bgs]
68pub const BACKGROUND_MAX_SIZE: usize = 1024;
69
70/// Tile considered empty (never drawn even if has contents)
71pub const EMPTY_TILE: u16 = 0xffff;
72
73/// Tile id of bold default font
74pub const FONT_BOLD: u16 = 0xf000;
75
76/// Tile id of thin default font
77pub const FONT_THIN: u16 = 0xe000;
78
79/// Width and height (in tiles) of tileset
80pub const TILESET_SIZE: usize = 0x100;
81
82/// Width and height of a tile
83pub const TILE_SIZE: usize = 16;
84
85/// Palette index which is treated as transparent
86pub const TRANSPARENT: u8 = 0xff;
87
88/// Width and height of a tile in half-tile mode
89pub const HALF_TILE_SIZE: usize = 8;
90
91/// Amount of tile maps in [Gsa::bgs]
92pub const MAX_BACKGROUNDS: usize = 4;