inc = -Isrc -Isrc/sdl -Isrc/3dgfx -Ilibs/imago/src
CFLAGS = $(arch) -pedantic -Wall -g -MMD $(inc) `sdl-config --cflags`
-LDFLAGS = $(arch) -Llibs/imago -limago `sdl-config --libs` -lm
+LDFLAGS = $(arch) -Llibs/imago -limago $(sdl_ldflags) -lm
ifneq ($(shell uname -m), i386)
arch = -m32
static struct video_mode *vmode;
static int quit;
+static void *vmem;
int main(int argc, char **argv)
{
status = -1;
goto break_evloop;
}
- fb_pixels = (char*)fb_buf + vmode->pitch;
+ fb_pixels = (uint16_t*)((char*)fb_buf + vmode->pitch);
if(init(argc, argv) == -1) {
status = -1;
#include <stdio.h>
+#include <string.h>
#include "screens.h"
#include "imago2.h"
#include "gfx.h"
static const struct menuent {
int x, y, len, height;
} menuent[] = {
- {240, 300, 170, 32},
- {230, 360, 184, 32},
- {260, 424, 130, 32}
+ {240, 300, 170, 40},
+ {230, 360, 184, 40},
+ {260, 424, 130, 40}
};
static int cur;
const struct menuent *ent = menuent + cur;
y = ent->y - ent->height / 2;
- offs = y * ent->len + ent->x;
+ offs = y * fb_width + ent->x;
blit(blurbuf[0], ent->len, bgpix + offs, ent->len, ent->height, bgwidth);
- //blur_grey_horiz(blurbuf[1], blurbuf[0], ent->len, ent->height, 5, 0x100);
- for(i=0; i<ent->height; i++) {
- for(j=0; j<ent->len; j++) {
- blurbuf[1][i * ent->len + j] = 0xff;//~blurbuf[0][i * ent->len + j];
- }
- }
+ blur_grey_horiz(blurbuf[1], blurbuf[0], ent->len, ent->height, 7, 0x100);
wait_vsync();
- blit_frame(bgpix, 0);
+ memcpy(fb_pixels, bgpix, fb_size);
blit(fb_pixels + offs, fb_width, blurbuf[1], ent->len, ent->height, ent->len);
+
+ blit_frame(fb_pixels, 0);
}
void menu_keyb(int key, int pressed)
{
+ if(!pressed) return;
+
switch(key) {
case 27:
game_quit();
break;
+
+ case KB_UP:
+ if(cur > 0) cur--;
+ break;
+
+ case KB_DOWN:
+ if(cur < sizeof menuent / sizeof *menuent - 1) {
+ cur++;
+ }
+ break;
}
}
{
int s;
char *env;
+ void *fb_buf;
if((env = getenv("FBSCALE")) && (s = atoi(env))) {
fbscale = s;
fb_width = xsz;
fb_height = ysz;
- /* allocate 1 extra row as a guard band, until we fucking fix the rasterizer */
- if(!(fb_pixels = malloc(FB_WIDTH * (FB_HEIGHT + 1) * FB_BPP / CHAR_BIT))) {
+ fb_size = FB_WIDTH * FB_HEIGHT * FB_BPP / 8;
+ if(!(fb_buf = malloc(fb_size + FB_WIDTH * 4))) {
fprintf(stderr, "failed to allocate virtual framebuffer\n");
return 1;
}
+ fb_pixels = (char*)fb_buf + FB_WIDTH * 2;
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE);
if(!(fbsurf = SDL_SetVideoMode(xsz, ysz, FB_BPP, sdl_flags))) {