summaryrefslogtreecommitdiffstats
path: root/fractal.c
diff options
context:
space:
mode:
Diffstat (limited to 'fractal.c')
-rw-r--r--fractal.c90
1 files changed, 88 insertions, 2 deletions
diff --git a/fractal.c b/fractal.c
index dcab68b..98410d9 100644
--- a/fractal.c
+++ b/fractal.c
@@ -6,11 +6,97 @@
#include <stdint.h>
#include <time.h>
-#include <SDL/SDL.h>
-#include <SDL/SDL_ttf.h>
+#include <SDL2/SDL.h>
+
+#include "koh.h"
+//#include "queue.h"
+
+#define SCREEN_WIDTH 160
+#define SCREEN_HEIGHT 160
+
+static int quit=0;
+static SDL_Window *window = NULL;
+static SDL_Renderer *renderer = NULL;
+
+#define MAX_LEVEL 7
+#define QUEUE_SIZE (1+MAX_LEVEL*MAX_LEVEL*MAX_LEVEL*MAX_LEVEL)
+
+int queue_index=0;
+koh_node koh_queue[QUEUE_SIZE];
+
+void queue_init()
+{
+ int i;
+ queue_index = 0;
+ for (i=0;i<QUEUE_SIZE;i++)
+ {
+ koh_queue[i].generaton = 0;
+ koh_queue[i].size = 0;
+ koh_queue[i].x = 0;
+ koh_queue[i].y = 0;
+ }
+}
+
+
+void queue_add(koh_node kn)
+{
+ koh_queue[queue_index] = kn;
+ queue_index += 1;
+}
+
+
+koh_node queue_get(int idx)
+{
+ koh_node kn = {-1,-1,-1,-1};
+
+ if ((idx<0) || (idx>QUEUE_SIZE))
+ {
+ return kn;
+ }
+
+ kn = koh_queue[idx];
+
+ return kn;
+}
int main()
{
+ SDL_Event event;
+
+ printf("Max queue size %d\n", QUEUE_SIZE);
+ SDL_Init(SDL_INIT_VIDEO);
+ window = SDL_CreateWindow("KOH", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN|SDL_WINDOW_OPENGL);
+ renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
+ SDL_SetRenderDrawColor(renderer, 0xff, 0x99, 0x99, 0x99);
+
+ while (quit == 0)
+ {
+ while (SDL_PollEvent(&event))
+ {
+
+ switch (event.type)
+ {
+ case SDL_QUIT:
+ {
+ quit = 1;
+ break;
+ }
+ //case SDL_KE
+ }
+
+ //sleep(1);
+ }
+
+ SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
+ SDL_RenderClear(renderer);
+ SDL_RenderPresent(renderer);
+ }
+
+ SDL_DestroyRenderer(renderer);
+ SDL_DestroyWindow(window);
+ SDL_Quit();
+
+
return 0;
}