SHARE
TWEET

Untitled

a guest Sep 17th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use coffee::graphics::{Color, Frame, Window, WindowSettings};
  2. use coffee::load::Task;
  3. use coffee::{Game, Result, Timer};
  4.  
  5. fn main() -> Result<()> {
  6.     MyGame::run(WindowSettings {
  7.         title: String::from("A caffeinated game"),
  8.         size: (1280, 1024),
  9.         resizable: true,
  10.         fullscreen: false,
  11.     })
  12. }
  13.  
  14. struct MyGame {
  15.     // Your game state and assets go here...
  16. }
  17.  
  18. impl Game for MyGame {
  19.     type Input = (); // No input data
  20.     type LoadingScreen = (); // No loading screen
  21.  
  22.     fn load(_window: &Window) -> Task<MyGame> {
  23.         // Load your game assets here. Check out the `load` module!
  24.         Task::new(|| MyGame { /* ... */ })
  25.     }
  26.  
  27.     fn draw(&mut self, frame: &mut Frame, _timer: &Timer) {
  28.         // Clear the current frame
  29.         frame.clear(Color::BLACK);
  30.  
  31.         // Draw your game here. Check out the `graphics` module!
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top