-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobals.cpp
More file actions
31 lines (23 loc) · 737 Bytes
/
globals.cpp
File metadata and controls
31 lines (23 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "globals.h"
// initializing all global vars
int width = 800;
int height = 600;
// Allocate framebuffer
uint32_t* frameBuffer = new uint32_t[width * height];
uint32_t* hitboxBuffer = new uint32_t[width * height];
HDC hdc;
BITMAPINFO bmi;
bool keys[256] = {}; // true if key is down
void setupGlobals() {
// Setup BITMAPINFO (used by StretchDIBits)
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = width;
bmi.bmiHeader.biHeight = -height; // top-down
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
}
void cleanupGlobals() { // Just for safety, OS does it anyways
delete[] frameBuffer;
delete[] hitboxBuffer;
}