@@ 1,7 1,7 @@
#include <SDL2/SDL.h>
#include <stdio.h>
-#define HOR 16
+#define HOR 32
#define VER 16
#define PAD 8
#define ZOOM 4
@@ 45,12 45,16 @@ SDL_Renderer* gRenderer = NULL;
SDL_Texture* gTexture = NULL;
uint32_t* pixels;
+/* helpers */
+
int
distance(int ax, int ay, int bx, int by)
{
return (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
}
+/* chr */
+
int
rowchr(int x, int y)
{
@@ 92,6 96,14 @@ putchr(int x, int y, int color)
}
}
+void
+newchr(void)
+{
+ int i;
+ for(i = 0; i < SZ; ++i)
+ chrbuf[i] = 0x00;
+}
+
int
jagg(int x, int y)
{
@@ 163,6 175,8 @@ line(int ax, int ay, int bx, int by, int color)
}
}
+/* draw */
+
void
draw(uint32_t* dst)
{
@@ 201,6 215,8 @@ update(Brush* b)
SDL_SetWindowTitle(gWindow, title);
}
+/* options */
+
int
error(char* msg, const char* err)
{
@@ 209,14 225,6 @@ error(char* msg, const char* err)
}
void
-create(void)
-{
- int i;
- for(i = 0; i < SZ; ++i)
- chrbuf[i] = 0x00;
-}
-
-void
load(char* path)
{
FILE* f = fopen(path, "rb");
@@ 326,7 334,7 @@ dokey(SDL_Event* event, Brush* b)
draw(pixels);
break;
case SDLK_n:
- create();
+ newchr();
break;
case SDLK_BACKQUOTE:
b->mode = 7;
@@ 414,7 422,7 @@ main(int argc, char** argv)
if(argc > 1)
load(argv[1]);
else
- create();
+ newchr();
draw(pixels);
update(&brush);