mirror of
https://github.com/ProgramSnail/snake_2024.git
synced 2025-12-08 07:28:43 +00:00
initial commit
This commit is contained in:
parent
110f4a440c
commit
f86c1a22ac
5 changed files with 279 additions and 1 deletions
45
Game.cpp
Normal file
45
Game.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#include "Engine.h"
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
//
|
||||
// You are free to modify this file
|
||||
//
|
||||
|
||||
// is_key_pressed(int button_vk_code) - check if a key is pressed,
|
||||
// use keycodes (VK_SPACE, VK_RIGHT, VK_LEFT, VK_UP, VK_DOWN, VK_RETURN)
|
||||
//
|
||||
// schedule_quit_game() - quit game after act()
|
||||
|
||||
|
||||
|
||||
// initialize game data in this function
|
||||
void initialize()
|
||||
{
|
||||
}
|
||||
|
||||
// this function is called to update game data,
|
||||
// dt - time elapsed since the previous update (in seconds)
|
||||
void act(float dt)
|
||||
{
|
||||
if (is_key_pressed(VK_ESCAPE))
|
||||
schedule_quit_game();
|
||||
|
||||
}
|
||||
|
||||
// fill buffer in this function
|
||||
// uint32_t buffer[SCREEN_HEIGHT][SCREEN_WIDTH] - is an array of 32-bit colors (8 bits per R, G, B)
|
||||
void draw()
|
||||
{
|
||||
// clear backbuffer
|
||||
memset(buffer, 0, SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(uint32_t));
|
||||
|
||||
}
|
||||
|
||||
// free game data in this function
|
||||
void finalize()
|
||||
{
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue