snake_2024/Game.cpp
2022-05-12 14:17:14 +03:00

45 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()
{
}