From b0ac9da6ea828e6a74523d1a48f963e1663b2895 Mon Sep 17 00:00:00 2001 From: EvanR Date: Sat, 15 May 2010 10:46:08 -0500 Subject: [PATCH] Fixed widescreen editor video. --- Makefile | 2 +- edit.c | 12 +++++++++--- video.c | 6 +++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b6a81de..6624f88 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ LIBS=-lSDL -lGL -lm -lz $(PROJECT): $(OBJ) data.zip $(CC) -o $(PROJECT) $(LIBS) $(OBJ) -editor: $(OBJ) +editor: $(OBJ) edit.c $(CC) -o editor -I. $(LIBS) console.o loader.o list.o \ video.o graphics.o util.o rng.o zip.o camera.o edit.c diff --git a/edit.c b/edit.c index 6fa030c..623688b 100644 --- a/edit.c +++ b/edit.c @@ -175,6 +175,12 @@ void raw_write(int x, int y, int layer, int value){ } } +void draw_background(){ + int W = gfx_width(bgimage); + int H = gfx_height(bgimage); + draw_gfx_raw(bgimage, 0, 0, 0, 0, W, H); +} + void draw_raw(){ int x0 = camera_x + origin_x; int y0 = camera_y + origin_y; @@ -187,11 +193,11 @@ void draw_raw(){ int gy; if(toggle_background) - draw_bitmap(bgimage, 0, 0); + draw_background(); - for(j=0; j<15; j++){ + for(j=0; j<(15+5); j++){ y = y0 + j; - for(i=0; i<20; i++){ + for(i=0; i<(20+8); i++){ x = x0 + i; t = raw_read(x, y); gy = 16*(t.bg / 16); diff --git a/video.c b/video.c index f37ee5d..cb7755a 100644 --- a/video.c +++ b/video.c @@ -482,7 +482,7 @@ void setup_video(){ if(gl_flag){ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); //SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); - SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); + //SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); flags |= SDL_OPENGL; }; @@ -552,8 +552,8 @@ void setup_video(){ } void map_pixel(int mx, int my, int *x, int *y){ - *x = mx*SCREEN_W/W; - *y = my*SCREEN_H/H; + *x = mx*screen_w/W; + *y = my*screen_h/H; } -- 2.11.4.GIT