2023-07-16 22:06
:- Fetch the
vectorlib
to our main project and ready to utilize version[email protected]
- Fetch the
The SDL2
library is natively written in C
that came bare-bone. We will
install the additional modules that is necessary to our basic graphics for
current objectives.
We will create several modules for the physics engine
including
- Animation platform
- Need to define the animation screen basis.
- width, height
- refresh rate (FPS)
- time-delta calculation (using the actual vs computed and compare between them).
- Need to include the grid line
- Major grid lines
- Minor gird lines
- Centerlines object with
- Major ticks
- minor ticks
- font label of the coordinates.
- Need to define the animation screen basis.
- Animation object class
- Including the main object mover
- Vector class - 2D at first
- Basic constructor
- Vector methods
- Logging and debugging class
- Conceptualized module system for drawing session (chapters based )
- Graphics configurations
- Color struct
- Font struct
- Graphics elements - fundamental
- Arrow, with tracer for the object moving
- Circle with edge circle
- Zoom scale
SDL2
has several extensions such as ("ttf","image","gfx","mixer"), in addition there is a module which I will not use callednetwork
under the sdl2 too.sdl2
: is the back-end library that create the premative-graphics.sdl2-image
: which will handle import images to our current graphics.sdl2-tff
: to handle the text and adding textsdl-mixer
:sdl2_gfx
: this will offer us to draw circles, fill-cricles, arches ..etc.
- Use the homebrow formula for
M1 Arm64
arch -arm64 brew install sdl2\
sdl2_image\
sdl2_ttf\
sdl2_mixer\
sdl2_gfx\
- Verify the installed Requirements
╰─ sdl2-config --libs
-L/opt/homebrew/lib -lSDL2
╭─ gmbp GMacBookPro on ~/Desktop/devCode/rust_fundamentals/rust_graphics_engine
├─ INSERT 19531d8h0m|master ?6
╰─ pkg-config --libs SDL2_ttf
-L/opt/homebrew/Cellar/sdl2_ttf/2.20.2/lib -L/opt/homebrew/lib -lSDL2_ttf -lSDL2
╭─ gmbp GMacBookPro on ~/Desktop/devCode/rust_fundamentals/rust_graphics_engine
├─ INSERT 19531d8h3m|master ?6
╰─ pkg-config --libs SDL2_mixer
-L/opt/homebrew/Cellar/sdl2_mixer/2.6.3_1/lib -L/opt/homebrew/lib -lSDL2_mixer -lSDL2
╭─ gmbp GMacBookPro on ~/Desktop/devCode/rust_fundamentals/rust_graphics_engine
├─ INSERT 19531d8h3m|master ?6
╰─ pkg-config --libs SDL2_image
-L/opt/homebrew/Cellar/sdl2_image/2.6.3_1/lib -L/opt/homebrew/lib -lSDL2_image -lSDL2
cargo run
# or
RUST_BACKTRACE=1 cargo run --quiet
- To build the project we use
cargo build --release
or
cargo run --release
- We can use the
modules
cargo install cargo-modules
cargo modules generate tree --with-types