aboutsummaryrefslogtreecommitdiff
path: root/src/PHL.c
diff options
context:
space:
mode:
authorptitSeb2017-11-30 22:49:38 +0100
committerptitSeb2017-11-30 22:49:38 +0100
commitde29b11a88dbdd3af0824e59b51528b91ee73c54 (patch)
treee1aabf8752043998663279fae4359a18c4b4af07 /src/PHL.c
parentd87f450f51372ddf013e6bac09f1ef588e6f8bea (diff)
downloadhydracastlelabyrinth-de29b11a88dbdd3af0824e59b51528b91ee73c54.tar.gz
hydracastlelabyrinth-de29b11a88dbdd3af0824e59b51528b91ee73c54.tar.bz2
hydracastlelabyrinth-de29b11a88dbdd3af0824e59b51528b91ee73c54.zip
First commit. Version works on Linux (keyboard only, not configurable)
Diffstat (limited to 'src/PHL.c')
-rw-r--r--src/PHL.c83
1 files changed, 83 insertions, 0 deletions
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 <stdio.h>
+#include <string.h>
+#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