mirror of
https://github.com/ProgramSnail/snake_2024.git
synced 2025-12-06 14:38:43 +00:00
46 lines
913 B
C++
46 lines
913 B
C++
|
|
#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()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|