]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use an offset to draw the Clear button so that it can be better placed based on the...
authorterencehill <piuntn@gmail.com>
Wed, 16 Feb 2011 22:57:32 +0000 (23:57 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 16 Feb 2011 22:57:32 +0000 (23:57 +0100)
For luminos skin use a copy of the Close button and set the proper offset (previously the image itself had the offset)
Add Clear buttons to the other 2 skins (a copy of the Close button for Xaw and the middle part of a checkbox for Default skin, this one not very nice tbh)

14 files changed:
gfx/menu/default/clearbutton_c.tga [new file with mode: 0644]
gfx/menu/default/clearbutton_f.tga [new file with mode: 0644]
gfx/menu/default/clearbutton_n.tga [new file with mode: 0644]
gfx/menu/default/skinvalues.txt
gfx/menu/luminos/clearbutton_c.tga
gfx/menu/luminos/clearbutton_f.tga
gfx/menu/luminos/clearbutton_n.tga
gfx/menu/luminos/skinvalues.txt
gfx/menu/xaw/clearbutton_c.tga [new file with mode: 0644]
gfx/menu/xaw/clearbutton_f.tga [new file with mode: 0644]
gfx/menu/xaw/clearbutton_n.tga [new file with mode: 0644]
gfx/menu/xaw/skinvalues.txt
qcsrc/menu/item/inputbox.c
qcsrc/menu/skin-customizables.inc

diff --git a/gfx/menu/default/clearbutton_c.tga b/gfx/menu/default/clearbutton_c.tga
new file mode 100644 (file)
index 0000000..26bc0ef
Binary files /dev/null and b/gfx/menu/default/clearbutton_c.tga differ
diff --git a/gfx/menu/default/clearbutton_f.tga b/gfx/menu/default/clearbutton_f.tga
new file mode 100644 (file)
index 0000000..e857381
Binary files /dev/null and b/gfx/menu/default/clearbutton_f.tga differ
diff --git a/gfx/menu/default/clearbutton_n.tga b/gfx/menu/default/clearbutton_n.tga
new file mode 100644 (file)
index 0000000..26bc0ef
Binary files /dev/null and b/gfx/menu/default/clearbutton_n.tga differ
index b2b0a97008db10893fac7592b3a5132c4d0bae09..4a1a934b935eaf300b3b43524749564370e5144f 100755 (executable)
@@ -183,6 +183,7 @@ COLOR_DIALOG_CVARS              '1 0 0'
 COLOR_INPUTBOX_N                '1 1 1'
 COLOR_INPUTBOX_F                '1 1 1'
 MARGIN_INPUTBOX_CHARS           1
+OFFSET_CLEARBUTTON              -0.5
 
 // item: key grabber
 COLOR_KEYGRABBER_TITLES         '1 1 1'
index df5b64cb6c4d7b5baef40c74b4ec4b1dcde1a10f..3de1ccb804b6ac9d3d0bd182068da34481190389 100644 (file)
Binary files a/gfx/menu/luminos/clearbutton_c.tga and b/gfx/menu/luminos/clearbutton_c.tga differ
index 1ef420399e8d447c7cc02565b2cb8300d1d9112c..be0939c0675b8dddb74ff51e14a504a61d5f1ca3 100644 (file)
Binary files a/gfx/menu/luminos/clearbutton_f.tga and b/gfx/menu/luminos/clearbutton_f.tga differ
index 201645b976c829dffb17b66b1cb7c83c7ca9bd02..57d76c47e11c03fcdd1a18dcfadac93735f83b79 100644 (file)
Binary files a/gfx/menu/luminos/clearbutton_n.tga and b/gfx/menu/luminos/clearbutton_n.tga differ
index 21944b67a8c17bb7c818a1c00f38b67e8d250532..82d188cb627c828d403ea9111baf8a0b6c4d6f79 100755 (executable)
@@ -183,6 +183,7 @@ COLOR_DIALOG_CVARS              '1 0 0'
 COLOR_INPUTBOX_N                '1 1 1'
 COLOR_INPUTBOX_F                '1 1 1'
 MARGIN_INPUTBOX_CHARS           1
+OFFSET_CLEARBUTTON              -0.3
 
 // item: key grabber
 COLOR_KEYGRABBER_TITLES         '1 1 1'
diff --git a/gfx/menu/xaw/clearbutton_c.tga b/gfx/menu/xaw/clearbutton_c.tga
new file mode 100644 (file)
index 0000000..d8bfea5
Binary files /dev/null and b/gfx/menu/xaw/clearbutton_c.tga differ
diff --git a/gfx/menu/xaw/clearbutton_f.tga b/gfx/menu/xaw/clearbutton_f.tga
new file mode 100644 (file)
index 0000000..338ac1f
Binary files /dev/null and b/gfx/menu/xaw/clearbutton_f.tga differ
diff --git a/gfx/menu/xaw/clearbutton_n.tga b/gfx/menu/xaw/clearbutton_n.tga
new file mode 100644 (file)
index 0000000..60ee8c8
Binary files /dev/null and b/gfx/menu/xaw/clearbutton_n.tga differ
index eae123ce79fa059b02987416f594302d08d96c63..217e8c9561a8a773b56708613e4400b1a8e60af5 100644 (file)
@@ -123,6 +123,7 @@ HEIGHT_DIALOGBORDER             1
 COLOR_INPUTBOX_N                '1 1 1'
 COLOR_INPUTBOX_F                '1 1 1'
 MARGIN_INPUTBOX_CHARS           1
+OFFSET_CLEARBUTTON              0
 
 // item: key grabber
 COLOR_KEYGRABBER_TITLES         '1 1 1'
index b44db7c42a23342207aeccb8bebf0fdc949c124a..67ac8e995770b9b7f8b38a312bfc82bed85f030f 100644 (file)
@@ -32,6 +32,7 @@ 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_pressed, float, 0)
        ATTRIB(InputBox, cb_focused, float, 0)
        ATTRIB(InputBox, cb_src, string, SKINGFX_CLEARBUTTON)
@@ -52,7 +53,8 @@ void InputBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector a
        if (me.enableClearButton)
        {
                me.cb_size = eX * (absSize_y / absSize_x) + eY;
-               me.keepspaceRight = me.keepspaceRight + me.cb_size_x;
+               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;
        }
 }
 
@@ -70,8 +72,8 @@ void InputBox_Clear_Click(entity btn, entity me)
 
 float over_ClearButton(entity me, vector pos)
 {
-       if (pos_x >= 1 - me.cb_size_x)
-       if (pos_x < 1)
+       if (pos_x >= 1 + me.cb_offset - me.cb_size_x)
+       if (pos_x < 1 + me.cb_offset)
        if (pos_y >= 0)
        if (pos_y < me.cb_size_y)
                return 1;
@@ -368,11 +370,11 @@ void InputBox_draw(entity me)
        if (me.text != "")
        {
                if(me.focused && me.cb_pressed)
-                       draw_Picture('1 1 0' - me.cb_size, strcat(me.cb_src, "_c"), me.cb_size, '1 1 1', 1);
+                       draw_Picture('1 1 0' + eX * me.cb_offset - me.cb_size, strcat(me.cb_src, "_c"), me.cb_size, '1 1 1', 1);
                else if(me.focused && me.cb_focused)
-                       draw_Picture('1 1 0' - me.cb_size, strcat(me.cb_src, "_f"), me.cb_size, '1 1 1', 1);
+                       draw_Picture('1 1 0' + eX * me.cb_offset - me.cb_size, strcat(me.cb_src, "_f"), me.cb_size, '1 1 1', 1);
                else
-                       draw_Picture('1 1 0' - me.cb_size, strcat(me.cb_src, "_n"), me.cb_size, '1 1 1', 1);
+                       draw_Picture('1 1 0' + eX * me.cb_offset - me.cb_size, strcat(me.cb_src, "_n"), me.cb_size, '1 1 1', 1);
        }
 }
 
index a4a4f9e80e9069dda1ae5031a5004102a01c60e5..2cb85a7a0fd4627b56d54fd235d183746bc3f350 100644 (file)
@@ -160,6 +160,7 @@ SKINBEGIN
        SKINVECTOR(COLOR_INPUTBOX_N, '1 1 1');
        SKINVECTOR(COLOR_INPUTBOX_F, '1 1 1');
        SKINSTRING(GFX_CLEARBUTTON, "clearbutton");
+       SKINFLOAT(OFFSET_CLEARBUTTON, 0);
        SKINFLOAT(MARGIN_INPUTBOX_CHARS, 1);
 
        // item: key grabber