Browse Source

Minor changes

main
Devine Lu Linvega 6 years ago
parent
commit
eca14f0ef4
  1. 4
      build.sh
  2. BIN
      nasu-export.chr
  3. BIN
      nasu-render.bmp
  4. 26
      nasu.c

4
build.sh

@ -5,10 +5,10 @@ clang-format -i nasu.c
rm ./nasu
# debug(slow)
# cc -std=c89 -DDEBUG -Wall -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined nasu.c -I/usr/local/include -L/usr/local/lib -lSDL2 -o nasu
cc -std=c89 -DDEBUG -Wall -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined nasu.c -L/usr/local/lib -lSDL2 -o nasu
# build(fast)
cc nasu.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -I/usr/local/include -L/usr/local/lib -lSDL2 -o nasu
# cc nasu.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -L/usr/local/lib -lSDL2 -o nasu
# run
./nasu sprite.chr

BIN
nasu-export.chr

Binary file not shown.

BIN
nasu-render.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

26
nasu.c

@ -4,7 +4,7 @@
#define HOR 32
#define VER 16
#define PAD 8
#define ZOOM 4
#define ZOOM 3
#define color1 0x000000
#define color2 0x72DEC2
#define color3 0xFFFFFF
@ -203,16 +203,17 @@ draw(uint32_t* dst)
void
update(Brush* b)
{
char title[512];
snprintf(title, 512, "nasu %s%dc%d [%d:%dx%d]%c",
modes[b->mode],
b->size,
b->color,
HOR,
VER,
ZOOM,
b->edit ? '*' : ' ');
SDL_SetWindowTitle(gWindow, title);
if(b->edit)
SDL_SetWindowTitle(gWindow, "Nasu*");
else
SDL_SetWindowTitle(gWindow, "Nasu");
printf("%s %d:%d [%d:%dx%d]\n",
modes[b->mode],
b->size,
b->color,
HOR,
VER,
ZOOM);
}
/* options */
@ -305,6 +306,7 @@ domouse(SDL_Event* event, Brush* b)
}
b->px = (event->motion.x - (PAD * ZOOM)) / ZOOM;
b->py = (event->motion.y - (PAD * ZOOM)) / ZOOM;
break;
case SDL_MOUSEMOTION:
if(b->down) {
b->x = (event->motion.x - (PAD * ZOOM)) / ZOOM;
@ -387,7 +389,7 @@ init(void)
int i, j;
if(SDL_Init(SDL_INIT_VIDEO) < 0)
return error("Init", SDL_GetError());
gWindow = SDL_CreateWindow("nasu",
gWindow = SDL_CreateWindow("Nasu",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
WIDTH * ZOOM,

Loading…
Cancel
Save