Movatterモバイル変換


[0]ホーム

URL:


Docs.rs

Cratecoffee

Source
Expand description

Coffee is an opinionated 2D game engine focused on simplicity, explicitness,and type-safety.

§Features

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.

Type Aliases§

Result
A convenient result with a lockedError type.

[8]ページ先頭

©2009-2025 Movatter.jp