--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/level.c Thu Jul 17 22:03:19 2025 -0400
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include "common.h"
+#include <SDL2/SDL.h>
+
+typedef struct
+{
+
+}
+Image;
+
+void loadLevelFromFile()
+{
+ Image img;
+ FILE* imageFile;
+
+ imageFile = fopen("img/nhhs.ppm", "rb");
+
+ int whiteSpaces = 0;
+ int lineCount = 0;
+ int pixelCount = 0;
+ if(imageFile)
+ {
+ unsigned char byte;
+ SDL_Color color = {0, 0, 0, 255};
+
+ while(fread(&byte, 1, 1, imageFile))
+ {
+ if(whiteSpaces == 4)
+ {
+ if(lineCount == 0) color.r = byte;
+ if(lineCount == 1) color.g = byte;
+ if(lineCount == 2) color.b = byte;
+ lineCount ++;
+ if(lineCount >= 3)
+ {
+ lineCount = 0;
+ levelTiles[pixelCount] = (color.g == 255) ? (color.r == 0 ? 'G' : ' ') : (color.r == 255) ? ' ' : (color.r == 85) ? 'A' : (color.b == 191) ? 'S' : '#';
+ pixelCount ++;
+ /*printf("Color: %02x, %02x, %02x\n", color.r, color.g, color.b);*/
+ }
+ }
+
+ if(byte == 10) whiteSpaces ++;
+ }
+
+
+ putchar('\n');
+
+ }
+
+ fclose(imageFile);
+}