From de29b11a88dbdd3af0824e59b51528b91ee73c54 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 30 Nov 2017 22:49:38 +0100 Subject: First commit. Version works on Linux (keyboard only, not configurable) --- src/PHL.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/PHL.c (limited to 'src/PHL.c') diff --git a/src/PHL.c b/src/PHL.c new file mode 100644 index 0000000..8db7e32 --- /dev/null +++ b/src/PHL.c @@ -0,0 +1,83 @@ +#include "PHL.h" +#include +#include +#include "qda.h" +#include "game.h" + +void PHL_Init() +{ + PHL_GraphicsInit(); + PHL_AudioInit(); + + #ifdef _3DS + Result rc = romfsInit(); + /*if (rc) { + printf("romfsInit: %08lX\n", rc); + //while(1){} + } + else + { + printf("\nromfs Init Successful!\n"); + }*/ + #endif + + WHITE = 0; + RED = 1; + YELLOW = 2; +} + +void PHL_Deinit() +{ + PHL_AudioClose(); + PHL_GraphicsExit(); + + #ifdef _3DS + romfsExit(); + #endif +} + +//Extracts bmps from the bmp.qda archive file +PHL_Surface PHL_LoadQDA(char* fname) +{ + PHL_Surface surf; + + int numofsheets = 29; + + for (int i = 0; i < numofsheets; i++) + { + if (strcmp(fname, (char*)headers[i].fileName) == 0) { //Match found + //printf("\nMatch Found: %s", fname); + surf = PHL_LoadBMP(i); + i = numofsheets; //End search + } + } + + return surf; +} + +void PHL_DrawTextBold(char* txt, int dx, int dy, int col) +{ + int i, cx, cy; + + for (i = 0; i < strlen(txt); i++) + { + cx = (txt[i] - 32) * 16; + cy = 32 * col; + + while (cx >= 512) { + cx -= 512; + cy += 16; + } + + PHL_DrawSurfacePart(dx + (16 * i), dy, cx, cy, 16, 16, images[imgBoldFont]); + } +} + +void PHL_DrawTextBoldCentered(char* txt, int dx, int dy, int col) +{ + if (dy < 640 && dy > -16) { + int stringW = strlen(txt) * 16; + + PHL_DrawTextBold(txt, dx - (stringW / 2), dy, col); + } +} \ No newline at end of file -- cgit v1.2.3