update for button rect
This commit is contained in:
parent
b26d19b624
commit
7b689d1bbc
16
src/dbox.cc
16
src/dbox.cc
|
@ -286,6 +286,11 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
|
||||||
_colorTable[18979]);
|
_colorTable[18979]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rect offset;
|
||||||
|
offset.top = -5;
|
||||||
|
offset.bottom = 5;
|
||||||
|
offset.left = -18;
|
||||||
|
offset.right = 82;
|
||||||
int btn = buttonCreate(win,
|
int btn = buttonCreate(win,
|
||||||
v27 + 13,
|
v27 + 13,
|
||||||
_doneY[dialogType] + 4,
|
_doneY[dialogType] + 4,
|
||||||
|
@ -298,7 +303,8 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
|
||||||
buttonNormalFrmImage.getData(),
|
buttonNormalFrmImage.getData(),
|
||||||
buttonPressedFrmImage.getData(),
|
buttonPressedFrmImage.getData(),
|
||||||
NULL,
|
NULL,
|
||||||
BUTTON_FLAG_TRANSPARENT);
|
BUTTON_FLAG_TRANSPARENT,
|
||||||
|
offset);
|
||||||
if (btn != -1) {
|
if (btn != -1) {
|
||||||
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||||
}
|
}
|
||||||
|
@ -327,6 +333,11 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
|
||||||
backgroundFrmImage.getWidth(),
|
backgroundFrmImage.getWidth(),
|
||||||
_colorTable[18979]);
|
_colorTable[18979]);
|
||||||
|
|
||||||
|
Rect offset;
|
||||||
|
offset.top = -5;
|
||||||
|
offset.bottom = 5;
|
||||||
|
offset.left = -17;
|
||||||
|
offset.right = 82;
|
||||||
int btn = buttonCreate(win,
|
int btn = buttonCreate(win,
|
||||||
doneBoxFrmImage.getWidth() + _doneX[dialogType] + 37,
|
doneBoxFrmImage.getWidth() + _doneX[dialogType] + 37,
|
||||||
_doneY[dialogType] + 4,
|
_doneY[dialogType] + 4,
|
||||||
|
@ -339,7 +350,8 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
|
||||||
buttonNormalFrmImage.getData(),
|
buttonNormalFrmImage.getData(),
|
||||||
buttonPressedFrmImage.getData(),
|
buttonPressedFrmImage.getData(),
|
||||||
0,
|
0,
|
||||||
BUTTON_FLAG_TRANSPARENT);
|
BUTTON_FLAG_TRANSPARENT,
|
||||||
|
offset);
|
||||||
if (btn != -1) {
|
if (btn != -1) {
|
||||||
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3183,13 +3183,19 @@ int _gdialog_barter_create_win()
|
||||||
|
|
||||||
backgroundFrmImage.unlock();
|
backgroundFrmImage.unlock();
|
||||||
|
|
||||||
|
|
||||||
|
Rect offset;
|
||||||
|
offset.top = -7;
|
||||||
|
offset.bottom = 7;
|
||||||
|
offset.left = -18;
|
||||||
|
offset.right = 18;
|
||||||
// TRADE
|
// TRADE
|
||||||
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 41, 163, 14, 14, -1, -1, -1, KEY_LOWERCASE_M, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), 0, BUTTON_FLAG_TRANSPARENT);
|
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 41, 163, 14, 14, -1, -1, -1, KEY_LOWERCASE_M, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), 0, BUTTON_FLAG_TRANSPARENT, offset);
|
||||||
if (_gdialog_buttons[0] != -1) {
|
if (_gdialog_buttons[0] != -1) {
|
||||||
buttonSetCallbacks(_gdialog_buttons[0], _gsound_med_butt_press, _gsound_med_butt_release);
|
buttonSetCallbacks(_gdialog_buttons[0], _gsound_med_butt_press, _gsound_med_butt_release);
|
||||||
|
|
||||||
// TALK
|
// TALK
|
||||||
_gdialog_buttons[1] = buttonCreate(gGameDialogWindow, 584, 162, 14, 14, -1, -1, -1, KEY_LOWERCASE_T, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), 0, BUTTON_FLAG_TRANSPARENT);
|
_gdialog_buttons[1] = buttonCreate(gGameDialogWindow, 584, 162, 14, 14, -1, -1, -1, KEY_LOWERCASE_T, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), 0, BUTTON_FLAG_TRANSPARENT, offset);
|
||||||
if (_gdialog_buttons[1] != -1) {
|
if (_gdialog_buttons[1] != -1) {
|
||||||
buttonSetCallbacks(_gdialog_buttons[1], _gsound_med_butt_press, _gsound_med_butt_release);
|
buttonSetCallbacks(_gdialog_buttons[1], _gsound_med_butt_press, _gsound_med_butt_release);
|
||||||
|
|
||||||
|
@ -4306,8 +4312,14 @@ int _gdialog_window_create()
|
||||||
_gdialog_scroll_subwin(gGameDialogWindow, 1, backgroundFrmData, v10, 0, _dialogue_subwin_len, 0);
|
_gdialog_scroll_subwin(gGameDialogWindow, 1, backgroundFrmData, v10, 0, _dialogue_subwin_len, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Rect offset;
|
||||||
|
offset.top = -7;
|
||||||
|
offset.bottom = 7;
|
||||||
|
offset.left = -18;
|
||||||
|
offset.right = 18;
|
||||||
// BARTER/TRADE
|
// BARTER/TRADE
|
||||||
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 593, 41, 14, 14, -1, -1, -1, -1, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
|
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 593, 41, 14, 14, -1, -1, -1, -1, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT, offset);
|
||||||
if (_gdialog_buttons[0] != -1) {
|
if (_gdialog_buttons[0] != -1) {
|
||||||
buttonSetMouseCallbacks(_gdialog_buttons[0], NULL, NULL, NULL, gameDialogBarterButtonUpMouseUp);
|
buttonSetMouseCallbacks(_gdialog_buttons[0], NULL, NULL, NULL, gameDialogBarterButtonUpMouseUp);
|
||||||
buttonSetCallbacks(_gdialog_buttons[0], _gsound_med_butt_press, _gsound_med_butt_release);
|
buttonSetCallbacks(_gdialog_buttons[0], _gsound_med_butt_press, _gsound_med_butt_release);
|
||||||
|
|
|
@ -999,6 +999,12 @@ static bool _setup_inventory(int inventoryWindowType)
|
||||||
fid = buildFid(OBJ_TYPE_INTERFACE, 9, 0, 0, 0);
|
fid = buildFid(OBJ_TYPE_INTERFACE, 9, 0, 0, 0);
|
||||||
_inventoryFrmImages[1].lock(fid);
|
_inventoryFrmImages[1].lock(fid);
|
||||||
|
|
||||||
|
Rect offset;
|
||||||
|
offset.top = -7;
|
||||||
|
offset.bottom= 7;
|
||||||
|
offset.left = -95;
|
||||||
|
offset.right = 20;
|
||||||
|
|
||||||
if (_inventoryFrmImages[0].isLocked() && _inventoryFrmImages[1].isLocked()) {
|
if (_inventoryFrmImages[0].isLocked() && _inventoryFrmImages[1].isLocked()) {
|
||||||
btn = -1;
|
btn = -1;
|
||||||
switch (inventoryWindowType) {
|
switch (inventoryWindowType) {
|
||||||
|
@ -1016,7 +1022,8 @@ static bool _setup_inventory(int inventoryWindowType)
|
||||||
_inventoryFrmImages[0].getData(),
|
_inventoryFrmImages[0].getData(),
|
||||||
_inventoryFrmImages[1].getData(),
|
_inventoryFrmImages[1].getData(),
|
||||||
NULL,
|
NULL,
|
||||||
BUTTON_FLAG_TRANSPARENT);
|
BUTTON_FLAG_TRANSPARENT,
|
||||||
|
offset);
|
||||||
break;
|
break;
|
||||||
case INVENTORY_WINDOW_TYPE_USE_ITEM_ON:
|
case INVENTORY_WINDOW_TYPE_USE_ITEM_ON:
|
||||||
// Cancel button
|
// Cancel button
|
||||||
|
@ -1032,7 +1039,8 @@ static bool _setup_inventory(int inventoryWindowType)
|
||||||
_inventoryFrmImages[0].getData(),
|
_inventoryFrmImages[0].getData(),
|
||||||
_inventoryFrmImages[1].getData(),
|
_inventoryFrmImages[1].getData(),
|
||||||
NULL,
|
NULL,
|
||||||
BUTTON_FLAG_TRANSPARENT);
|
BUTTON_FLAG_TRANSPARENT,
|
||||||
|
offset);
|
||||||
break;
|
break;
|
||||||
case INVENTORY_WINDOW_TYPE_LOOT:
|
case INVENTORY_WINDOW_TYPE_LOOT:
|
||||||
// Done button
|
// Done button
|
||||||
|
@ -1048,7 +1056,8 @@ static bool _setup_inventory(int inventoryWindowType)
|
||||||
_inventoryFrmImages[0].getData(),
|
_inventoryFrmImages[0].getData(),
|
||||||
_inventoryFrmImages[1].getData(),
|
_inventoryFrmImages[1].getData(),
|
||||||
NULL,
|
NULL,
|
||||||
BUTTON_FLAG_TRANSPARENT);
|
BUTTON_FLAG_TRANSPARENT,
|
||||||
|
offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5854,7 +5863,13 @@ static int inventoryQuantityWindowInit(int inventoryWindowType, Object* item)
|
||||||
fid = buildFid(OBJ_TYPE_INTERFACE, 9, 0, 0, 0);
|
fid = buildFid(OBJ_TYPE_INTERFACE, 9, 0, 0, 0);
|
||||||
_moveFrmImages[5].lock(fid);
|
_moveFrmImages[5].lock(fid);
|
||||||
|
|
||||||
|
Rect offset;
|
||||||
|
|
||||||
if (_moveFrmImages[4].isLocked() && _moveFrmImages[5].isLocked()) {
|
if (_moveFrmImages[4].isLocked() && _moveFrmImages[5].isLocked()) {
|
||||||
|
offset.top = -1;
|
||||||
|
offset.bottom = 1;
|
||||||
|
offset.left = -80;
|
||||||
|
offset.right = 10;
|
||||||
// Done
|
// Done
|
||||||
btn = buttonCreate(_mt_wid,
|
btn = buttonCreate(_mt_wid,
|
||||||
98,
|
98,
|
||||||
|
@ -5868,11 +5883,16 @@ static int inventoryQuantityWindowInit(int inventoryWindowType, Object* item)
|
||||||
_moveFrmImages[4].getData(),
|
_moveFrmImages[4].getData(),
|
||||||
_moveFrmImages[5].getData(),
|
_moveFrmImages[5].getData(),
|
||||||
NULL,
|
NULL,
|
||||||
BUTTON_FLAG_TRANSPARENT);
|
BUTTON_FLAG_TRANSPARENT,
|
||||||
|
offset);
|
||||||
if (btn != -1) {
|
if (btn != -1) {
|
||||||
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
offset.top = -1;
|
||||||
|
offset.bottom = 1;
|
||||||
|
offset.left = -10;
|
||||||
|
offset.right = 80;
|
||||||
// Cancel
|
// Cancel
|
||||||
btn = buttonCreate(_mt_wid,
|
btn = buttonCreate(_mt_wid,
|
||||||
148,
|
148,
|
||||||
|
@ -5886,7 +5906,8 @@ static int inventoryQuantityWindowInit(int inventoryWindowType, Object* item)
|
||||||
_moveFrmImages[4].getData(),
|
_moveFrmImages[4].getData(),
|
||||||
_moveFrmImages[5].getData(),
|
_moveFrmImages[5].getData(),
|
||||||
NULL,
|
NULL,
|
||||||
BUTTON_FLAG_TRANSPARENT);
|
BUTTON_FLAG_TRANSPARENT,
|
||||||
|
offset);
|
||||||
if (btn != -1) {
|
if (btn != -1) {
|
||||||
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1404,6 +1404,12 @@ static int lsgWindowInit(int windowType)
|
||||||
|
|
||||||
int btn;
|
int btn;
|
||||||
|
|
||||||
|
Rect offset;
|
||||||
|
offset.top = -5;
|
||||||
|
offset.bottom = 5;
|
||||||
|
offset.left = -12;
|
||||||
|
offset.right = 72;
|
||||||
|
|
||||||
btn = buttonCreate(gLoadSaveWindow,
|
btn = buttonCreate(gLoadSaveWindow,
|
||||||
391,
|
391,
|
||||||
349,
|
349,
|
||||||
|
@ -1416,7 +1422,8 @@ static int lsgWindowInit(int windowType)
|
||||||
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_NORMAL].getData(),
|
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_NORMAL].getData(),
|
||||||
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_PRESSED].getData(),
|
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_PRESSED].getData(),
|
||||||
NULL,
|
NULL,
|
||||||
BUTTON_FLAG_TRANSPARENT);
|
BUTTON_FLAG_TRANSPARENT,
|
||||||
|
offset);
|
||||||
if (btn != -1) {
|
if (btn != -1) {
|
||||||
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||||
}
|
}
|
||||||
|
@ -1433,7 +1440,8 @@ static int lsgWindowInit(int windowType)
|
||||||
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_NORMAL].getData(),
|
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_NORMAL].getData(),
|
||||||
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_PRESSED].getData(),
|
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_PRESSED].getData(),
|
||||||
NULL,
|
NULL,
|
||||||
BUTTON_FLAG_TRANSPARENT);
|
BUTTON_FLAG_TRANSPARENT,
|
||||||
|
offset);
|
||||||
if (btn != -1) {
|
if (btn != -1) {
|
||||||
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||||
}
|
}
|
||||||
|
@ -2123,6 +2131,12 @@ static int _GetComment(int a1)
|
||||||
int btn;
|
int btn;
|
||||||
|
|
||||||
// DONE
|
// DONE
|
||||||
|
Rect offset;
|
||||||
|
offset.top = -5;
|
||||||
|
offset.bottom = 5;
|
||||||
|
offset.left = -15;
|
||||||
|
offset.right = 87;
|
||||||
|
|
||||||
btn = buttonCreate(window,
|
btn = buttonCreate(window,
|
||||||
34,
|
34,
|
||||||
58,
|
58,
|
||||||
|
@ -2135,7 +2149,8 @@ static int _GetComment(int a1)
|
||||||
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_NORMAL].getData(),
|
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_NORMAL].getData(),
|
||||||
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_PRESSED].getData(),
|
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_PRESSED].getData(),
|
||||||
NULL,
|
NULL,
|
||||||
BUTTON_FLAG_TRANSPARENT);
|
BUTTON_FLAG_TRANSPARENT,
|
||||||
|
offset);
|
||||||
if (btn == -1) {
|
if (btn == -1) {
|
||||||
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||||
}
|
}
|
||||||
|
@ -2153,7 +2168,8 @@ static int _GetComment(int a1)
|
||||||
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_NORMAL].getData(),
|
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_NORMAL].getData(),
|
||||||
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_PRESSED].getData(),
|
_loadsaveFrmImages[LOAD_SAVE_FRM_RED_BUTTON_PRESSED].getData(),
|
||||||
NULL,
|
NULL,
|
||||||
BUTTON_FLAG_TRANSPARENT);
|
BUTTON_FLAG_TRANSPARENT,
|
||||||
|
offset);
|
||||||
if (btn == -1) {
|
if (btn == -1) {
|
||||||
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||||
}
|
}
|
||||||
|
|
|
@ -889,6 +889,12 @@ static int mainMenuWindowInit()
|
||||||
offsetX = offsetY = 0;
|
offsetX = offsetY = 0;
|
||||||
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_OFFSET_X_KEY, &offsetX);
|
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_OFFSET_X_KEY, &offsetX);
|
||||||
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_OFFSET_Y_KEY, &offsetY);
|
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_OFFSET_Y_KEY, &offsetY);
|
||||||
|
|
||||||
|
Rect offset;
|
||||||
|
offset.top = -2;
|
||||||
|
offset.bottom = 3;
|
||||||
|
offset.left = -1;
|
||||||
|
offset.right = 150;
|
||||||
|
|
||||||
for (int index = 0; index < MAIN_MENU_BUTTON_COUNT; index++) {
|
for (int index = 0; index < MAIN_MENU_BUTTON_COUNT; index++) {
|
||||||
gMainMenuButtons[index] = buttonCreate(gMainMenuWindow,
|
gMainMenuButtons[index] = buttonCreate(gMainMenuWindow,
|
||||||
|
@ -903,7 +909,8 @@ static int mainMenuWindowInit()
|
||||||
_mainMenuButtonNormalFrmImage.getData(),
|
_mainMenuButtonNormalFrmImage.getData(),
|
||||||
_mainMenuButtonPressedFrmImage.getData(),
|
_mainMenuButtonPressedFrmImage.getData(),
|
||||||
0,
|
0,
|
||||||
BUTTON_FLAG_TRANSPARENT);
|
BUTTON_FLAG_TRANSPARENT,
|
||||||
|
offset);
|
||||||
if (gMainMenuButtons[index] == -1) {
|
if (gMainMenuButtons[index] == -1) {
|
||||||
// NOTE: Uninline.
|
// NOTE: Uninline.
|
||||||
return main_menu_fatal_error();
|
return main_menu_fatal_error();
|
||||||
|
|
|
@ -1355,6 +1355,39 @@ bool showMesageBox(const char* text)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int buttonCreate(int win, int x, int y, int width, int height, int mouseEnterEventCode, int mouseExitEventCode, int mouseDownEventCode, int mouseUpEventCode, unsigned char* up, unsigned char* dn, unsigned char* hover, int flags,Rect offset)
|
||||||
|
{
|
||||||
|
Window* window = windowGetWindow(win);
|
||||||
|
|
||||||
|
if (!gWindowSystemInitialized) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (up == NULL && (dn != NULL || hover != NULL)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Button* button = buttonCreateInternal(win, x, y, width, height, mouseEnterEventCode, mouseExitEventCode, mouseDownEventCode, mouseUpEventCode, flags | BUTTON_FLAG_0x010000, up, dn, hover);
|
||||||
|
if (button == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
button->clickRect.left += offset.left;
|
||||||
|
button->clickRect.right += offset.right;
|
||||||
|
button->clickRect.top += offset.top;
|
||||||
|
button->clickRect.bottom += offset.bottom;
|
||||||
|
|
||||||
|
button->ignoreMask = true;
|
||||||
|
|
||||||
|
_button_draw(button, window, button->mouseUpImage, 0, NULL, 0);
|
||||||
|
|
||||||
|
return button->id;
|
||||||
|
}
|
||||||
|
|
||||||
// 0x4D8260
|
// 0x4D8260
|
||||||
int buttonCreate(int win, int x, int y, int width, int height, int mouseEnterEventCode, int mouseExitEventCode, int mouseDownEventCode, int mouseUpEventCode, unsigned char* up, unsigned char* dn, unsigned char* hover, int flags)
|
int buttonCreate(int win, int x, int y, int width, int height, int mouseEnterEventCode, int mouseExitEventCode, int mouseDownEventCode, int mouseUpEventCode, unsigned char* up, unsigned char* dn, unsigned char* hover, int flags)
|
||||||
{
|
{
|
||||||
|
@ -1377,6 +1410,8 @@ int buttonCreate(int win, int x, int y, int width, int height, int mouseEnterEve
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button->ignoreMask = false;
|
||||||
|
|
||||||
_button_draw(button, window, button->mouseUpImage, 0, NULL, 0);
|
_button_draw(button, window, button->mouseUpImage, 0, NULL, 0);
|
||||||
|
|
||||||
return button->id;
|
return button->id;
|
||||||
|
@ -1657,10 +1692,17 @@ Button* buttonCreateInternal(int win, int x, int y, int width, int height, int m
|
||||||
|
|
||||||
button->id = buttonId;
|
button->id = buttonId;
|
||||||
button->flags = flags;
|
button->flags = flags;
|
||||||
|
|
||||||
button->rect.left = x;
|
button->rect.left = x;
|
||||||
button->rect.top = y;
|
button->rect.top = y;
|
||||||
button->rect.right = x + width - 1;
|
button->rect.right = x + width - 1;
|
||||||
button->rect.bottom = y + height - 1;
|
button->rect.bottom = y + height - 1;
|
||||||
|
|
||||||
|
button->clickRect.left = x;
|
||||||
|
button->clickRect.top = y;
|
||||||
|
button->clickRect.right = x + width - 1;
|
||||||
|
button->clickRect.bottom = y + height - 1;
|
||||||
|
|
||||||
button->mouseEnterEventCode = mouseEnterEventCode;
|
button->mouseEnterEventCode = mouseEnterEventCode;
|
||||||
button->mouseExitEventCode = mouseExitEventCode;
|
button->mouseExitEventCode = mouseExitEventCode;
|
||||||
button->lefMouseDownEventCode = mouseDownEventCode;
|
button->lefMouseDownEventCode = mouseDownEventCode;
|
||||||
|
@ -1731,10 +1773,10 @@ int _GNW_check_buttons(Window* window, int* keyCodePtr)
|
||||||
field_38 = window->field_38;
|
field_38 = window->field_38;
|
||||||
|
|
||||||
if (field_34 != NULL) {
|
if (field_34 != NULL) {
|
||||||
rectCopy(&v58, &(field_34->rect));
|
rectCopy(&v58, &(field_34->clickRect));
|
||||||
rectOffset(&v58, window->rect.left, window->rect.top);
|
rectOffset(&v58, window->rect.left, window->rect.top);
|
||||||
} else if (field_38 != NULL) {
|
} else if (field_38 != NULL) {
|
||||||
rectCopy(&v58, &(field_38->rect));
|
rectCopy(&v58, &(field_38->clickRect));
|
||||||
rectOffset(&v58, window->rect.left, window->rect.top);
|
rectOffset(&v58, window->rect.left, window->rect.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1747,7 +1789,7 @@ int _GNW_check_buttons(Window* window, int* keyCodePtr)
|
||||||
Button* touchButton = window->buttonListHead;
|
Button* touchButton = window->buttonListHead;
|
||||||
while (touchButton != NULL && gTouch) {
|
while (touchButton != NULL && gTouch) {
|
||||||
if (!(touchButton->flags & BUTTON_FLAG_DISABLED)) {
|
if (!(touchButton->flags & BUTTON_FLAG_DISABLED)) {
|
||||||
if (xx > touchButton->rect.left && xx < touchButton->rect.right && yy > touchButton->rect.top && yy < touchButton->rect.bottom) {
|
if (xx > touchButton->clickRect.left && xx < touchButton->clickRect.right && yy > touchButton->clickRect.top && yy < touchButton->clickRect.bottom) {
|
||||||
|
|
||||||
_win_button_press_and_release(touchButton->id);
|
_win_button_press_and_release(touchButton->id);
|
||||||
}
|
}
|
||||||
|
@ -1859,7 +1901,8 @@ int _GNW_check_buttons(Window* window, int* keyCodePtr)
|
||||||
|
|
||||||
while (button != NULL) {
|
while (button != NULL) {
|
||||||
if (!(button->flags & BUTTON_FLAG_DISABLED)) {
|
if (!(button->flags & BUTTON_FLAG_DISABLED)) {
|
||||||
rectCopy(&v58, &(button->rect));
|
button->mask = NULL;
|
||||||
|
rectCopy(&v58, &(button->clickRect));
|
||||||
rectOffset(&v58, window->rect.left, window->rect.top);
|
rectOffset(&v58, window->rect.left, window->rect.top);
|
||||||
if (_button_under_mouse(button, &v58)) {
|
if (_button_under_mouse(button, &v58)) {
|
||||||
if (!(button->flags & BUTTON_FLAG_DISABLED)) {
|
if (!(button->flags & BUTTON_FLAG_DISABLED)) {
|
||||||
|
@ -2087,7 +2130,7 @@ bool _button_under_mouse(Button* button, Rect* rect)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button->mask == NULL) {
|
if (button->mask == NULL || button->ignoreMask) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,8 @@ typedef struct Button {
|
||||||
int id;
|
int id;
|
||||||
int flags;
|
int flags;
|
||||||
Rect rect;
|
Rect rect;
|
||||||
|
Rect clickRect;
|
||||||
|
bool ignoreMask;
|
||||||
int mouseEnterEventCode;
|
int mouseEnterEventCode;
|
||||||
int mouseExitEventCode;
|
int mouseExitEventCode;
|
||||||
int lefMouseDownEventCode;
|
int lefMouseDownEventCode;
|
||||||
|
@ -180,6 +182,7 @@ int _GNW_check_menu_bars(int a1);
|
||||||
void programWindowSetTitle(const char* title);
|
void programWindowSetTitle(const char* title);
|
||||||
bool showMesageBox(const char* str);
|
bool showMesageBox(const char* str);
|
||||||
int buttonCreate(int win, int x, int y, int width, int height, int mouseEnterEventCode, int mouseExitEventCode, int mouseDownEventCode, int mouseUpEventCode, unsigned char* up, unsigned char* dn, unsigned char* hover, int flags);
|
int buttonCreate(int win, int x, int y, int width, int height, int mouseEnterEventCode, int mouseExitEventCode, int mouseDownEventCode, int mouseUpEventCode, unsigned char* up, unsigned char* dn, unsigned char* hover, int flags);
|
||||||
|
int buttonCreate(int win, int x, int y, int width, int height, int mouseEnterEventCode, int mouseExitEventCode, int mouseDownEventCode, int mouseUpEventCode, unsigned char* up, unsigned char* dn, unsigned char* hover, int flags,Rect offset);
|
||||||
int _win_register_text_button(int win, int x, int y, int mouseEnterEventCode, int mouseExitEventCode, int mouseDownEventCode, int mouseUpEventCode, const char* title, int flags);
|
int _win_register_text_button(int win, int x, int y, int mouseEnterEventCode, int mouseExitEventCode, int mouseDownEventCode, int mouseUpEventCode, const char* title, int flags);
|
||||||
int _win_register_button_disable(int btn, unsigned char* up, unsigned char* down, unsigned char* hover);
|
int _win_register_button_disable(int btn, unsigned char* up, unsigned char* down, unsigned char* hover);
|
||||||
int _win_register_button_image(int btn, unsigned char* up, unsigned char* down, unsigned char* hover, int a5);
|
int _win_register_button_image(int btn, unsigned char* up, unsigned char* down, unsigned char* hover, int a5);
|
||||||
|
|
Loading…
Reference in New Issue