int dx = (scroll == ED_SCROLL_LEFT ? -1 : scroll == ED_SCROLL_RIGHT ? 1 : 0);
int dy = (scroll == ED_SCROLL_UP ? -1 : scroll == ED_SCROLL_DOWN ? 1 : 0);
- XCopyArea(display, drawto, drawto, gc,
- SX + (dx == -1 ? MINI_TILEX : 0),
- SY + (dy == -1 ? MINI_TILEY : 0),
- (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0),
- (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0),
- SX + (dx == +1 ? MINI_TILEX : 0),
- SY + (dy == +1 ? MINI_TILEY : 0));
+ BlitBitmap(drawto, drawto,
+ SX + (dx == -1 ? MINI_TILEX : 0),
+ SY + (dy == -1 ? MINI_TILEY : 0),
+ (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0),
+ (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0),
+ SX + (dx == +1 ? MINI_TILEX : 0),
+ SY + (dy == +1 ? MINI_TILEY : 0));
if (dx)
{
x = (dx == 1 ? 0 : ed_fieldx - 1);
static void CreateControlButtons()
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap gd_bitmap = pix[PIX_DOOR];
struct GadgetInfo *gi;
unsigned long event_mask;
int i;
GDI_STATE, GD_BUTTON_UNPRESSED,
GDI_RADIO_NR, radio_button_nr,
GDI_CHECKED, checked,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y1,
- GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y2,
- GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y1,
+ GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y2,
+ GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleControlButtons,
GDI_END);
GDI_HEIGHT, height,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleControlButtons,
GDI_END);
/* create buttons for element list */
for (i=0; i<ED_NUM_ELEMENTLIST_BUTTONS; i++)
{
- Pixmap deco_pixmap;
+ Bitmap deco_bitmap;
int deco_x, deco_y, deco_xpos, deco_ypos;
int gd_xoffset, gd_yoffset;
int gd_x1, gd_x2, gd_y;
gd_y = DOOR_GFX_PAGEY1 + ED_ELEMENTLIST_YPOS;
getMiniGraphicSource(el2gfx(editor_element[i]),
- &deco_pixmap, &deco_x, &deco_y);
+ &deco_bitmap, &deco_x, &deco_y);
deco_xpos = (ED_ELEMENTLIST_XSIZE - MINI_TILEX) / 2;
deco_ypos = (ED_ELEMENTLIST_YSIZE - MINI_TILEY) / 2;
GDI_HEIGHT, ED_ELEMENTLIST_YSIZE,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
- GDI_DECORATION_DESIGN, deco_pixmap, deco_x, deco_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+ GDI_DECORATION_DESIGN, deco_bitmap, deco_x, deco_y,
GDI_DECORATION_POSITION, deco_xpos, deco_ypos,
GDI_DECORATION_SIZE, MINI_TILEX, MINI_TILEY,
GDI_DECORATION_SHIFTING, 1, 1,
for (j=0; j<2; j++)
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap gd_bitmap = pix[PIX_DOOR];
struct GadgetInfo *gi;
int id = (j == 0 ?
counterbutton_info[i].gadget_id_down :
GDI_HEIGHT, y_size,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleCounterButtons,
GDI_END);
GDI_NUMBER_MAX, counterbutton_info[i].max_value,
GDI_TEXT_SIZE, 3,
GDI_TEXT_FONT, font_type,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
GDI_BORDER_SIZE, ED_BORDER_SIZE,
GDI_TEXTINPUT_DESIGN_WIDTH, gd_width,
GDI_EVENT_MASK, event_mask,
for (i=0; i<ED_NUM_TEXTINPUT; i++)
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap gd_bitmap = pix[PIX_DOOR];
int gd_x, gd_y;
struct GadgetInfo *gi;
unsigned long event_mask;
GDI_TEXT_VALUE, textinput_info[i].value,
GDI_TEXT_SIZE, textinput_info[i].size,
GDI_TEXT_FONT, FC_YELLOW,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
GDI_BORDER_SIZE, ED_BORDER_SIZE,
GDI_TEXTINPUT_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
GDI_EVENT_MASK, event_mask,
for (i=0; i<ED_NUM_SCROLLBARS; i++)
{
int id = scrollbar_info[i].gadget_id;
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap gd_bitmap = pix[PIX_DOOR];
int gd_x1, gd_x2, gd_y1, gd_y2;
struct GadgetInfo *gi;
int items_max, items_visible, item_position;
GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible,
GDI_SCROLLBAR_ITEM_POSITION, item_position,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
GDI_BORDER_SIZE, ED_BORDER_SIZE,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleControlButtons,
static void CreateCheckbuttonGadgets()
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap gd_bitmap = pix[PIX_DOOR];
struct GadgetInfo *gi;
unsigned long event_mask;
int gd_x1, gd_x2, gd_x3, gd_x4, gd_y;
GDI_TYPE, GD_TYPE_RADIO_BUTTON,
GDI_RADIO_NR, radiobutton_info[i].radio_button_nr,
GDI_CHECKED, checked,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
- GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x3, gd_y,
- GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x4, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+ GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x3, gd_y,
+ GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x4, gd_y,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleRadiobuttons,
GDI_END);
GDI_HEIGHT, ED_CHECKBUTTON_YSIZE,
GDI_TYPE, GD_TYPE_CHECK_BUTTON,
GDI_CHECKED, *checkbutton_info[i].value,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
- GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x3, gd_y,
- GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x4, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+ GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x3, gd_y,
+ GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x4, gd_y,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleCheckbuttons,
GDI_END);
}
/* copy default editor door content to main double buffer */
- XCopyArea(display, pix[PIX_DOOR], drawto, gc,
- DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
/* draw mouse button brush elements */
DrawMiniGraphicExt(drawto, gc,
DrawSpecialEditorDoor();
/* draw new control window */
- XCopyArea(display, pix[PIX_DOOR], drawto, gc,
- DOOR_GFX_PAGEX8, 236,
- EXSIZE, EYSIZE,
- EX, EY);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ DOOR_GFX_PAGEX8, 236, EXSIZE, EYSIZE, EX, EY);
redraw_mask |= REDRAW_ALL;
MapControlButtons();
/* copy actual editor door content to door double buffer for OpenDoor() */
- XCopyArea(display, drawto, pix[PIX_DB_DOOR], gc,
- DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ BlitBitmap(drawto, pix[PIX_DB_DOOR],
+ DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
DrawEditModeWindow();
for (x=0; x<2; x++)
DrawMiniElement(area_x + x, area_y + y, EL_ERDREICH);
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
area_sx + MINI_TILEX/2 - 1, area_sy + MINI_TILEY/2 - 1,
MINI_TILEX + 2, MINI_TILEY + 2);
/* copy border to the right location */
- XCopyArea(display, drawto, drawto, gc,
- area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
- area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
+ area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
for (x=0; x<2; x++)
DrawMiniElement(area_x + x, area_y + y, EL_ERDREICH);
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
area_sx + MINI_TILEX/2 - 1, area_sy + MINI_TILEY/2 - 1,
MINI_TILEX + 2, MINI_TILEY + 2);
/* copy border to the right location */
- XCopyArea(display, drawto, drawto, gc,
- area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
- area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
+ area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
DrawText(area_sx + TILEX, area_sy + 1, "Content of amoeba",
FS_SMALL, font_color);
MapCounterButtons(counter_id);
/* delete content areas in case of reducing number of them */
- XFillRectangle(display, backbuffer, gc,
+ ClearRectangle(backbuffer,
SX, area_sy - MINI_TILEX,
SXSIZE, 12 * MINI_TILEY);
DrawMiniElement(area_x + 5 * (i % 4) + x, area_y + 6 * (i / 4) + y,
EL_ERDREICH);
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
area_sx + 5 * (i % 4) * MINI_TILEX + MINI_TILEX/2 - 1,
area_sy + 6 * (i / 4) * MINI_TILEY + MINI_TILEY/2 - 1,
3 * MINI_TILEX + 2, 3 * MINI_TILEY + 2);
}
/* copy border to the right location */
- XCopyArea(display, drawto, drawto, gc,
- area_sx, area_sy, (5 * 4 + 1) * MINI_TILEX, 11 * MINI_TILEY,
- area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ area_sx, area_sy, (5 * 4 + 1) * MINI_TILEX, 11 * MINI_TILEY,
+ area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 0 * MINI_TILEY + 1,
"Content", FS_SMALL, font_color);
for (x=0; x<3; x++)
DrawMiniElement(xstart + x , ystart + y, EL_ERDREICH);
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
SX + xstart * MINI_TILEX + MINI_TILEX/2 - 1,
SY + ystart * MINI_TILEY + MINI_TILEY/2 - 1,
TILEX + 2, TILEY + 2);
/* copy border to the right location */
- XCopyArea(display, drawto, drawto, gc,
- SX + xstart * MINI_TILEX,
- SY + ystart * MINI_TILEY,
- 2 * TILEX, 2 * TILEY,
- SX + xstart * MINI_TILEX - MINI_TILEX/2,
- SY + ystart * MINI_TILEY - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ SX + xstart * MINI_TILEX,
+ SY + ystart * MINI_TILEY,
+ 2 * TILEX, 2 * TILEY,
+ SX + xstart * MINI_TILEX - MINI_TILEX/2,
+ SY + ystart * MINI_TILEY - MINI_TILEY/2);
DrawGraphic(xstart/2, ystart/2, el2gfx(properties_element));
/* copy the whole stuff to the definitive location */
- XCopyArea(display, drawto, drawto, gc,
- SX + xstart * MINI_TILEX - MINI_TILEX/2,
- SY + ystart * MINI_TILEY - MINI_TILEY,
- 2 * TILEX, 2 * TILEY,
- SX + xstart * MINI_TILEX - MINI_TILEX/2,
- SY + ystart * MINI_TILEY - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ SX + xstart * MINI_TILEX - MINI_TILEX/2,
+ SY + ystart * MINI_TILEY - MINI_TILEY,
+ 2 * TILEX, 2 * TILEY,
+ SX + xstart * MINI_TILEX - MINI_TILEX/2,
+ SY + ystart * MINI_TILEY - MINI_TILEY/2);
DrawTextF((xstart + 3) * MINI_TILEX, (ystart + 1) * MINI_TILEY,
font_color, element_info[properties_element]);
}
}
-static void swap_numbers(int *i1, int *i2)
-{
- int help = *i1;
-
- *i1 = *i2;
- *i2 = help;
-}
-
-static void swap_number_pairs(int *x1, int *y1, int *x2, int *y2)
-{
- int help_x = *x1;
- int help_y = *y1;
-
- *x1 = *x2;
- *x2 = help_x;
-
- *y1 = *y2;
- *y2 = help_y;
-}
-
static void DrawLineElement(int sx, int sy, int element, boolean change_level)
{
int lx = sx + level_xpos;
to_sx = SX + to_x * MINI_TILEX + MINI_TILEX - 1;
to_sy = SY + to_y * MINI_TILEY + MINI_TILEY - 1;
- XSetForeground(display, gc, WhitePixel(display, screen));
-
- XDrawLine(display, drawto, gc, from_sx, from_sy, to_sx, from_sy);
- XDrawLine(display, drawto, gc, to_sx, from_sy, to_sx, to_sy);
- XDrawLine(display, drawto, gc, to_sx, to_sy, from_sx, to_sy);
- XDrawLine(display, drawto, gc, from_sx, to_sy, from_sx, from_sy);
-
- XSetForeground(display, gc, BlackPixel(display, screen));
+ DrawSimpleWhiteLine(drawto, from_sx, from_sy, to_sx, from_sy);
+ DrawSimpleWhiteLine(drawto, to_sx, from_sy, to_sx, to_sy);
+ DrawSimpleWhiteLine(drawto, to_sx, to_sy, from_sx, to_sy);
+ DrawSimpleWhiteLine(drawto, from_sx, to_sy, from_sx, from_sy);
if (from_x == to_x && from_y == to_y)
MarkTileDirty(from_x/2, from_y/2);
int element = editor_element[element_shift + i];
UnmapGadget(gi);
- getMiniGraphicSource(el2gfx(element), &gd->pixmap, &gd->x, &gd->y);
+ getMiniGraphicSource(el2gfx(element), &gd->bitmap, &gd->x, &gd->y);
ModifyGadget(gi, GDI_INFO_TEXT, element_info[element], GDI_END);
MapGadget(gi);
}
else
{
CloseDoor(DOOR_CLOSE_1);
- XCopyArea(display, pix[PIX_DB_DOOR], pix[PIX_DB_DOOR], gc,
- DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
- DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ BlitBitmap(pix[PIX_DB_DOOR], pix[PIX_DB_DOOR],
+ DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
OpenDoor(DOOR_OPEN_1);
}
break;
void ClearEditorGadgetInfoText()
{
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
INFOTEXT_XPOS, INFOTEXT_YPOS, INFOTEXT_XSIZE, INFOTEXT_YSIZE);
redraw_mask |= REDRAW_FIELD;
}