From: Holger Schemel Date: Thu, 3 Apr 2003 23:23:19 +0000 (+0200) Subject: rnd-20030404-2-src X-Git-Tag: 3.0.0^2~114 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b8114966908299df586165e00446f21c2ce343bb;p=rocksndiamonds.git rnd-20030404-2-src --- diff --git a/Makefile b/Makefile index ea7b1525..a5b3d976 100644 --- a/Makefile +++ b/Makefile @@ -49,8 +49,8 @@ CROSS_PATH_WIN32=/usr/local/cross-tools/i386-mingw32msvc SRC_DIR = src MAKE_CMD = $(MAKE) -C $(SRC_DIR) -# DEFAULT_TARGET = x11 -DEFAULT_TARGET = sdl +DEFAULT_TARGET = x11 +# DEFAULT_TARGET = sdl all: @$(MAKE_CMD) TARGET=$(DEFAULT_TARGET) diff --git a/src/conftime.h b/src/conftime.h index ec91edc0..a94a173e 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-04-04 00:11]" +#define COMPILE_DATE_STRING "[2003-04-04 01:21]" diff --git a/src/editor.c b/src/editor.c index 2b9a9088..893617ea 100644 --- a/src/editor.c +++ b/src/editor.c @@ -2408,6 +2408,11 @@ static void CreateCheckbuttonGadgets() void CreateLevelEditorGadgets() { + int old_game_status = game_status; + + /* setting 'game_status' is needed to get the right fonts for the editor */ + game_status = LEVELED; + ReinitializeElementList(); CreateControlButtons(); @@ -2417,6 +2422,8 @@ void CreateLevelEditorGadgets() CreateSelectboxGadgets(); CreateScrollbarGadgets(); CreateCheckbuttonGadgets(); + + game_status = old_game_status; } void FreeLevelEditorGadgets() diff --git a/src/libgame/sdl.h b/src/libgame/sdl.h index d574cd6b..81eb7c6a 100644 --- a/src/libgame/sdl.h +++ b/src/libgame/sdl.h @@ -76,8 +76,8 @@ struct XY #define None 0L -#define BlackPixel(d, s) 0x000000 -#define WhitePixel(d, s) 0xffffff +#define BLACK_PIXEL 0x000000 +#define WHITE_PIXEL 0xffffff #define EVENT_BUTTONPRESS SDL_MOUSEBUTTONDOWN #define EVENT_BUTTONRELEASE SDL_MOUSEBUTTONUP diff --git a/src/libgame/system.c b/src/libgame/system.c index 8e432101..0e0bb333 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -463,7 +463,7 @@ inline void FillRectangle(Bitmap *bitmap, int x, int y, int width, int height, inline void ClearRectangle(Bitmap *bitmap, int x, int y, int width, int height) { - FillRectangle(bitmap, x, y, width, height, BlackPixel(display, screen)); + FillRectangle(bitmap, x, y, width, height, BLACK_PIXEL); } inline void ClearRectangleOnBackground(Bitmap *bitmap, int x, int y, @@ -547,10 +547,9 @@ inline void DrawSimpleWhiteLine(Bitmap *bitmap, int from_x, int from_y, int to_x, int to_y) { #ifdef TARGET_SDL - SDLDrawSimpleLine(bitmap, from_x, from_y, to_x, to_y, 0xffffff); + SDLDrawSimpleLine(bitmap, from_x, from_y, to_x, to_y, WHITE_PIXEL); #else - XSetForeground(display, bitmap->gc, WhitePixel(display, screen)); - XDrawLine(display, bitmap->drawable, bitmap->gc, from_x, from_y, to_x, to_y); + X11DrawSimpleLine(bitmap, from_x, from_y, to_x, to_y, WHITE_PIXEL); #endif } diff --git a/src/libgame/x11.c b/src/libgame/x11.c index 907b9f71..fcf31601 100644 --- a/src/libgame/x11.c +++ b/src/libgame/x11.c @@ -382,10 +382,17 @@ inline void X11FillRectangle(Bitmap *bitmap, int x, int y, XFillRectangle(display, bitmap->drawable, bitmap->gc, x, y, width, height); } +inline void X11DrawSimpleLine(Bitmap *bitmap, int from_x, int from_y, + int to_x, int to_y, Pixel color) +{ + XSetForeground(display, bitmap->gc, color); + XDrawLine(display, bitmap->drawable, bitmap->gc, from_x, from_y, to_x, to_y); +} + inline Pixel X11GetPixel(Bitmap *bitmap, int x, int y) { - unsigned long pixel_value; XImage *pixel_image; + Pixel pixel_value; pixel_image = XGetImage(display, bitmap->drawable, x, y, 1, 1, AllPlanes, ZPixmap); diff --git a/src/libgame/x11.h b/src/libgame/x11.h index bce8ea69..80226b6f 100644 --- a/src/libgame/x11.h +++ b/src/libgame/x11.h @@ -87,6 +87,9 @@ struct XY /* X11 symbol definitions */ +#define BLACK_PIXEL BlackPixel(display, screen) +#define WHITE_PIXEL WhitePixel(display, screen) + #define EVENT_BUTTONPRESS ButtonPress #define EVENT_BUTTONRELEASE ButtonRelease #define EVENT_MOTIONNOTIFY MotionNotify @@ -312,6 +315,7 @@ inline void X11CreateBitmapContent(Bitmap *, int, int, int); inline void X11FreeBitmapPointers(Bitmap *); inline void X11CopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int); inline void X11FillRectangle(Bitmap *, int, int, int, int, Pixel); +inline void X11DrawSimpleLine(Bitmap *, int, int, int, int, Pixel); inline Pixel X11GetPixel(Bitmap *, int, int); inline Pixel X11GetPixelFromRGB(unsigned int, unsigned int, unsigned int); diff --git a/src/tools.c b/src/tools.c index f0db2696..8bd0a153 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2189,21 +2189,6 @@ void UndrawSpecialEditorDoor() redraw_mask |= REDRAW_ALL; } -#ifndef TARGET_SDL -int ReadPixel(DrawBuffer *bitmap, int x, int y) -{ - XImage *pixel_image; - unsigned long pixel_value; - - pixel_image = XGetImage(display, bitmap->drawable, - x, y, 1, 1, AllPlanes, ZPixmap); - pixel_value = XGetPixel(pixel_image, 0, 0); - - XDestroyImage(pixel_image); - - return pixel_value; -} -#endif /* ---------- new tool button stuff ---------------------------------------- */ diff --git a/src/tools.h b/src/tools.h index 51c11d53..2dae59b5 100644 --- a/src/tools.h +++ b/src/tools.h @@ -128,8 +128,6 @@ unsigned int MoveDoor(unsigned int); void DrawSpecialEditorDoor(); void UndrawSpecialEditorDoor(); -int ReadPixel(DrawBuffer *, int, int); - void CreateToolButtons(); void FreeToolButtons();