Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. #include "PHL.h"
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include "qda.h"
  5. #include "game.h"
  6.  
  7. int WHITE, RED, YELLOW;
  8.  
  9. void PHL_Init()
  10. {      
  11.         PHL_GraphicsInit();
  12.         PHL_AudioInit(); // DBG
  13.  
  14.         #ifdef _3DS
  15.                 Result rc = romfsInit();
  16.                 /*if (rc) {
  17.                         printf("romfsInit: %08lX\n", rc);
  18.                         //while(1){}
  19.                 }
  20.                 else
  21.                 {
  22.                         printf("\nromfs Init Successful!\n");
  23.                 }*/
  24.         #endif
  25.  
  26.         WHITE = 0;
  27.         RED = 1;
  28.         YELLOW = 2;
  29. }
  30.  
  31. void PHL_Deinit()
  32. {
  33.         PHL_AudioClose();
  34.         PHL_GraphicsExit();
  35.        
  36.         #ifdef _3DS
  37.                 romfsExit();
  38.         #endif
  39. }
  40.  
  41. //Extracts bmps from the bmp.qda archive file
  42. PHL_Surface PHL_LoadQDA(char* fname)
  43. {      
  44.         PHL_Surface surf;
  45.        
  46.         int numofsheets = 29;
  47.        
  48.         for (int i = 0; i < numofsheets; i++)
  49.         {
  50.                 if (strcmp(fname, (char*)headers[i].fileName) == 0) { //Match found
  51.                         //printf("\nMatch Found: %s", fname);
  52.                         surf = PHL_LoadBMP(i);
  53.                         i = numofsheets; //End search
  54.                 }
  55.         }
  56.        
  57.         return surf;
  58. }
  59.  
  60. void PHL_DrawTextBold(char* txt, int dx, int dy, int col)
  61. {
  62.         int i, cx, cy;
  63.        
  64.         for (i = 0; i < strlen(txt); i++)
  65.         {
  66.                 cx = (txt[i] - 32) * 16;
  67.                 cy = 32 * col;
  68.                
  69.                 while (cx >= 512) {
  70.                         cx -= 512;
  71.                         cy += 16;
  72.                 }
  73.                
  74.                 PHL_DrawSurfacePart(dx + (16 * i), dy, cx, cy, 16, 16, images[imgBoldFont]);
  75.         }
  76. }
  77.  
  78. void PHL_DrawTextBoldCentered(char* txt, int dx, int dy, int col)
  79. {
  80.         if (dy < 640 && dy > -16) {
  81.                 int stringW = strlen(txt) * 16;
  82.                
  83.                 PHL_DrawTextBold(txt, dx - (stringW / 2), dy, col);
  84.         }
  85. }
  86.