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)
-#define COMPILE_DATE_STRING "[2003-04-04 00:11]"
+#define COMPILE_DATE_STRING "[2003-04-04 01:21]"
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();
CreateSelectboxGadgets();
CreateScrollbarGadgets();
CreateCheckbuttonGadgets();
+
+ game_status = old_game_status;
}
void FreeLevelEditorGadgets()
#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
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,
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
}
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);
/* 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
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);
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 ---------------------------------------- */
void DrawSpecialEditorDoor();
void UndrawSpecialEditorDoor();
-int ReadPixel(DrawBuffer *, int, int);
-
void CreateToolButtons();
void FreeToolButtons();