X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fmenu%2Fitem%2Finputbox.c;h=83bb916dad2363dc389fd8db05bb54a6565bdfa2;hp=67ac8e995770b9b7f8b38a312bfc82bed85f030f;hb=2bfd748e228cc992041a15827d3f126916efed22;hpb=ef06098372dc7668713a8a72da22ccf0dc42b023 diff --git a/qcsrc/menu/item/inputbox.c b/qcsrc/menu/item/inputbox.c index 67ac8e9957..83bb916dad 100644 --- a/qcsrc/menu/item/inputbox.c +++ b/qcsrc/menu/item/inputbox.c @@ -31,11 +31,9 @@ CLASS(InputBox) EXTENDS(Label) ATTRIB(InputBox, enableClearButton, float, 1) ATTRIB(InputBox, clearButton, entity, NULL) - ATTRIB(InputBox, cb_size, vector, '0 0 0') - ATTRIB(InputBox, cb_offset, float, SKINOFFSET_CLEARBUTTON) // bound to range -1, 0 + ATTRIB(InputBox, cb_width, float, 0) ATTRIB(InputBox, cb_pressed, float, 0) ATTRIB(InputBox, cb_focused, float, 0) - ATTRIB(InputBox, cb_src, string, SKINGFX_CLEARBUTTON) ENDCLASS(InputBox) void InputBox_Clear_Click(entity btn, entity me); #endif @@ -52,9 +50,9 @@ void InputBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector a SUPER(InputBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); if (me.enableClearButton) { - me.cb_size = eX * (absSize_y / absSize_x) + eY; - me.cb_offset = bound(-1, me.cb_offset, 0) * me.cb_size_x; // bound to range -1, 0 - me.keepspaceRight = me.keepspaceRight - me.cb_offset + me.cb_size_x; + me.cb_width = absSize_y / absSize_x; + me.cb_offset = bound(-1, me.cb_offset, 0) * me.cb_width; // bound to range -1, 0 + me.keepspaceRight = me.keepspaceRight - me.cb_offset + me.cb_width; } } @@ -72,10 +70,10 @@ void InputBox_Clear_Click(entity btn, entity me) float over_ClearButton(entity me, vector pos) { - if (pos_x >= 1 + me.cb_offset - me.cb_size_x) + if (pos_x >= 1 + me.cb_offset - me.cb_width) if (pos_x < 1 + me.cb_offset) if (pos_y >= 0) - if (pos_y < me.cb_size_y) + if (pos_y < 1) return 1; return 0; } @@ -360,7 +358,7 @@ void InputBox_draw(entity me) } else draw_Text(me.realOrigin - eX * me.scrollPos, me.text, me.realFontSize, '1 1 1', 1, 0); - // skipping SUPER(InputBox).draw(me); + if(!me.focused || (time - me.lastChangeTime) < floor(time - me.lastChangeTime) + 0.5) draw_Text(me.realOrigin + eX * (cursorPosInWidths - me.scrollPos), CURSOR, me.realFontSize, '1 1 1', 1, 0); @@ -370,12 +368,15 @@ void InputBox_draw(entity me) if (me.text != "") { if(me.focused && me.cb_pressed) - draw_Picture('1 1 0' + eX * me.cb_offset - me.cb_size, strcat(me.cb_src, "_c"), me.cb_size, '1 1 1', 1); + draw_Picture(eX * (1 + me.cb_offset - me.cb_width), strcat(me.cb_src, "_c"), eX * me.cb_width + eY, '1 1 1', 1); else if(me.focused && me.cb_focused) - draw_Picture('1 1 0' + eX * me.cb_offset - me.cb_size, strcat(me.cb_src, "_f"), me.cb_size, '1 1 1', 1); + draw_Picture(eX * (1 + me.cb_offset - me.cb_width), strcat(me.cb_src, "_f"), eX * me.cb_width + eY, '1 1 1', 1); else - draw_Picture('1 1 0' + eX * me.cb_offset - me.cb_size, strcat(me.cb_src, "_n"), me.cb_size, '1 1 1', 1); + draw_Picture(eX * (1 + me.cb_offset - me.cb_width), strcat(me.cb_src, "_n"), eX * me.cb_width + eY, '1 1 1', 1); } + + // skipping SUPER(InputBox).draw(me); + Item_draw(me); } void InputBox_showNotify(entity me)