projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added storing image identifier in internal gadget structure
[rocksndiamonds.git]
/
src
/
libgame
/
gadgets.c
diff --git
a/src/libgame/gadgets.c
b/src/libgame/gadgets.c
index 6b7d2592f435849b3bd8fb0f8798227278a18ca7..cba655f874a89a29d9c31d0001c5a75506ef9088 100644
(file)
--- a/
src/libgame/gadgets.c
+++ b/
src/libgame/gadgets.c
@@
-782,6
+782,10
@@
static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
{
switch(tag)
{
{
switch(tag)
{
+ case GDI_IMAGE_ID:
+ gi->image_id = va_arg(ap, int);
+ break;
+
case GDI_CUSTOM_ID:
gi->custom_id = va_arg(ap, int);
break;
case GDI_CUSTOM_ID:
gi->custom_id = va_arg(ap, int);
break;
@@
-1281,6
+1285,7
@@
struct GadgetInfo *CreateGadget(int first_tag, ...)
/* always start with reliable default values */
new_gadget->id = getNewGadgetID();
/* always start with reliable default values */
new_gadget->id = getNewGadgetID();
+ new_gadget->image_id = -1;
new_gadget->callback_info = default_callback_info;
new_gadget->callback_action = default_callback_action;
new_gadget->active = TRUE;
new_gadget->callback_info = default_callback_info;
new_gadget->callback_action = default_callback_action;
new_gadget->active = TRUE;
@@
-1481,7
+1486,7
@@
static boolean insideSelectboxArea(struct GadgetInfo *gi, int mx, int my)
void ClickOnGadget(struct GadgetInfo *gi, int button)
{
void ClickOnGadget(struct GadgetInfo *gi, int button)
{
- if (!gi->mapped)
+ if (
gi == NULL || gi->deactivated ||
!gi->mapped)
return;
/* simulate releasing mouse button over last gadget, if still pressed */
return;
/* simulate releasing mouse button over last gadget, if still pressed */
@@
-1681,16
+1686,20
@@
boolean HandleGadgets(int mx, int my, int button)
{
int last_x = gi->event.x;
int last_y = gi->event.y;
{
int last_x = gi->event.x;
int last_y = gi->event.y;
+ int last_mx = gi->event.mx;
+ int last_my = gi->event.my;
- gi->event.x = mx - gi->x;
- gi->event.y = my - gi->y;
+ gi->event.x =
gi->event.mx =
mx - gi->x;
+ gi->event.y =
gi->event.my =
my - gi->y;
if (gi->type == GD_TYPE_DRAWING_AREA)
{
gi->event.x /= gi->drawing.item_xsize;
gi->event.y /= gi->drawing.item_ysize;
if (gi->type == GD_TYPE_DRAWING_AREA)
{
gi->event.x /= gi->drawing.item_xsize;
gi->event.y /= gi->drawing.item_ysize;
- if (last_x != gi->event.x || last_y != gi->event.y)
+ if (last_x != gi->event.x || last_y != gi->event.y ||
+ ((last_mx != gi->event.mx || last_my != gi->event.my) &&
+ gi->event_mask & GD_EVENT_PIXEL_PRECISE))
changed_position = TRUE;
}
else if (gi->type & GD_TYPE_TEXT_INPUT && button != 0 && !motion_status)
changed_position = TRUE;
}
else if (gi->type & GD_TYPE_TEXT_INPUT && button != 0 && !motion_status)