Expand description
Coffee is an opinionated 2D game engine focused on simplicity, explicitness,and type-safety.
§Features
- Responsive, customizable GUI
- Declarative, type-safe loading screens with progress tracking
- Built-indebug view with performance metrics
- Fixed, deterministic timestep
- Explicit, easy to use, hardware-accelerated 2D graphics API
- Multiplatform support leveraging OpenGL, Vulkan, Metal, D3D11, and D3D12
- Explicit and efficient batched draws
- Mesh support
- Texture array support
- Off-screen rendering
- TrueType font rendering
- Gamepad support
Check out therepository and theexamples for more details!
§Usage
To get started, implement theGame
trait. Then, callGame::run
withsomeWindowSettings
to run your game.
Here is a minimal example that will open a window:
usecoffee::graphics::{Color, Frame, Window, WindowSettings};usecoffee::load::Task;usecoffee::{Game,Result, Timer};fnmain() ->Result<()> { MyGame::run(WindowSettings { title: String::from("A caffeinated game"), size: (1280,1024), resizable:true, fullscreen:false, maximized:false, })}structMyGame {// Your game state and assets go here...}implGameforMyGame {typeInput = ();// No input datatypeLoadingScreen = ();// No loading screenfnload(_window:&Window) -> Task<MyGame> {// Load your game assets here. Check out the `load` module!Task::succeed(|| MyGame {/* ... */}) }fndraw(&mutself, frame:&mutFrame, _timer:&Timer) {// Clear the current frameframe.clear(Color::BLACK);// Draw your game here. Check out the `graphics` module!}}
Modules§
- graphics
- Draw your game with an explicit 2D graphics API.
- input
- Allow players to interact with your game.
- load
- Load your game assets with type-safety and build loading screens withconsistent progress tracking.
- ui
- Build a responsive graphical user interface for your game.
Structs§
- Debug
- A bunch of performance information about your game. It can be drawn!
- Timer
- The timer of your game state.
Enums§
- Error
- An error in the engine.
Traits§
- Game
- The entrypoint of the engine. It describes your game logic.