-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
56 lines (43 loc) · 1.36 KB
/
main.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <pspkernel.h>
#include <psppower.h>
#include <pge/pge.h>
#include <src/callbacks.h>
#include <src/defs.h>
PSP_MODULE_INFO("Terraria", PSP_MODULE_USER, 1, 0);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER|THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_KB(-1024);
int main() {
SetupCallbacks();
scePowerSetClockFrequency(333, 333, 166);
pgeGfxInit(PGE_PIXEL_FORMAT_8888);
pgeControlsInit();
pgeFontInit();
pgeTexture* bg = pgeTextureLoad("assets/bg.png", PGE_VRAM, 1);
if (!bg) pgeExit();
pgeFont* font = pgeFontLoad("assets/font/sans.ttf", 10, PGE_FONT_SIZE_PIXELS, PGE_VRAM);
if (!font) pgeExit();
while (pgeRunning()) {
pgeControlsUpdate();
pgeGfxStartDrawing();
pgeGfxClearScreen(0);
pgeTextureActivate(bg);
pgeGfxDrawTextureEasy(bg, 0, 0, .0f, 255);
fillRect(10,10, 30,60, 0xFF0000FF, 0);
if (pgeControlsHeld(PGE_CTRL_CROSS))
fillRect(40,70, 30,60, 0xFFFF00FF, 0);
float freeRam = pgeSystemGetFreeRam()/1024/1024;
char ram[50];
sprintf(ram, "free RAM: %.2f MB", freeRam);
pgeFontActivate(font);
pgeFontPrintf(font, 100, 100, 0xFF00FF00, ram);
pgeGfxEndDrawing();
pgeGfxSwapBuffers(PGE_WAIT_VSYNC);
}
pgeTextureDestroy(bg);
pgeFontDestroy(font);
pgeControlsShutdown();
pgeFontShutdown();
pgeGfxShutdown();
pgeExit();
return 0;
}