r2856 - in trunk/data/qcsrc/menu-div0test: . item nexuiz
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Oct 27 12:19:24 EDT 2007
Author: div0
Date: 2007-10-27 12:19:24 -0400 (Sat, 27 Oct 2007)
New Revision: 2856
Added:
trunk/data/qcsrc/menu-div0test/baseborder.tga
trunk/data/qcsrc/menu-div0test/basebutton_c.tga
trunk/data/qcsrc/menu-div0test/basebutton_f.tga
trunk/data/qcsrc/menu-div0test/basebutton_n.tga
trunk/data/qcsrc/menu-div0test/baseclosebutton_c.tga
trunk/data/qcsrc/menu-div0test/baseclosebutton_f.tga
trunk/data/qcsrc/menu-div0test/baseclosebutton_n.tga
trunk/data/qcsrc/menu-div0test/item/borderimage.c
Removed:
trunk/data/qcsrc/menu-div0test/basebutton_cl.tga
trunk/data/qcsrc/menu-div0test/basebutton_cm.tga
trunk/data/qcsrc/menu-div0test/basebutton_cr.tga
trunk/data/qcsrc/menu-div0test/basebutton_fl.tga
trunk/data/qcsrc/menu-div0test/basebutton_fm.tga
trunk/data/qcsrc/menu-div0test/basebutton_fr.tga
trunk/data/qcsrc/menu-div0test/basebutton_nl.tga
trunk/data/qcsrc/menu-div0test/basebutton_nm.tga
trunk/data/qcsrc/menu-div0test/basebutton_nr.tga
Modified:
trunk/data/qcsrc/menu-div0test/basecheckbox_c0.tga
trunk/data/qcsrc/menu-div0test/basecheckbox_c1.tga
trunk/data/qcsrc/menu-div0test/basecheckbox_f0.tga
trunk/data/qcsrc/menu-div0test/basecheckbox_f1.tga
trunk/data/qcsrc/menu-div0test/basecheckbox_n0.tga
trunk/data/qcsrc/menu-div0test/basecheckbox_n1.tga
trunk/data/qcsrc/menu-div0test/baseradiobutton_c0.tga
trunk/data/qcsrc/menu-div0test/baseradiobutton_c1.tga
trunk/data/qcsrc/menu-div0test/baseradiobutton_f0.tga
trunk/data/qcsrc/menu-div0test/baseradiobutton_f1.tga
trunk/data/qcsrc/menu-div0test/baseradiobutton_n0.tga
trunk/data/qcsrc/menu-div0test/baseradiobutton_n1.tga
trunk/data/qcsrc/menu-div0test/classes.c
trunk/data/qcsrc/menu-div0test/draw.qc
trunk/data/qcsrc/menu-div0test/draw.qh
trunk/data/qcsrc/menu-div0test/item/button.c
trunk/data/qcsrc/menu-div0test/item/checkbox.c
trunk/data/qcsrc/menu-div0test/item/label.c
trunk/data/qcsrc/menu-div0test/mbuiltin.qh
trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c
Log:
Morphed's graphics; checkbox, radiobutton
Added: trunk/data/qcsrc/menu-div0test/baseborder.tga
===================================================================
(Binary files differ)
Property changes on: trunk/data/qcsrc/menu-div0test/baseborder.tga
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/data/qcsrc/menu-div0test/basebutton_c.tga
===================================================================
(Binary files differ)
Property changes on: trunk/data/qcsrc/menu-div0test/basebutton_c.tga
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/data/qcsrc/menu-div0test/basebutton_cl.tga
===================================================================
(Binary files differ)
Deleted: trunk/data/qcsrc/menu-div0test/basebutton_cm.tga
===================================================================
(Binary files differ)
Deleted: trunk/data/qcsrc/menu-div0test/basebutton_cr.tga
===================================================================
(Binary files differ)
Added: trunk/data/qcsrc/menu-div0test/basebutton_f.tga
===================================================================
(Binary files differ)
Property changes on: trunk/data/qcsrc/menu-div0test/basebutton_f.tga
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/data/qcsrc/menu-div0test/basebutton_fl.tga
===================================================================
(Binary files differ)
Deleted: trunk/data/qcsrc/menu-div0test/basebutton_fm.tga
===================================================================
(Binary files differ)
Deleted: trunk/data/qcsrc/menu-div0test/basebutton_fr.tga
===================================================================
(Binary files differ)
Added: trunk/data/qcsrc/menu-div0test/basebutton_n.tga
===================================================================
(Binary files differ)
Property changes on: trunk/data/qcsrc/menu-div0test/basebutton_n.tga
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/data/qcsrc/menu-div0test/basebutton_nl.tga
===================================================================
(Binary files differ)
Deleted: trunk/data/qcsrc/menu-div0test/basebutton_nm.tga
===================================================================
(Binary files differ)
Deleted: trunk/data/qcsrc/menu-div0test/basebutton_nr.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/menu-div0test/basecheckbox_c0.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/menu-div0test/basecheckbox_c1.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/menu-div0test/basecheckbox_f0.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/menu-div0test/basecheckbox_f1.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/menu-div0test/basecheckbox_n0.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/menu-div0test/basecheckbox_n1.tga
===================================================================
(Binary files differ)
Added: trunk/data/qcsrc/menu-div0test/baseclosebutton_c.tga
===================================================================
(Binary files differ)
Property changes on: trunk/data/qcsrc/menu-div0test/baseclosebutton_c.tga
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/data/qcsrc/menu-div0test/baseclosebutton_f.tga
===================================================================
(Binary files differ)
Property changes on: trunk/data/qcsrc/menu-div0test/baseclosebutton_f.tga
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/data/qcsrc/menu-div0test/baseclosebutton_n.tga
===================================================================
(Binary files differ)
Property changes on: trunk/data/qcsrc/menu-div0test/baseclosebutton_n.tga
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/data/qcsrc/menu-div0test/baseradiobutton_c0.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/menu-div0test/baseradiobutton_c1.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/menu-div0test/baseradiobutton_f0.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/menu-div0test/baseradiobutton_f1.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/menu-div0test/baseradiobutton_n0.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/menu-div0test/baseradiobutton_n1.tga
===================================================================
(Binary files differ)
Modified: trunk/data/qcsrc/menu-div0test/classes.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/classes.c 2007-10-27 09:43:30 UTC (rev 2855)
+++ trunk/data/qcsrc/menu-div0test/classes.c 2007-10-27 16:19:24 UTC (rev 2856)
@@ -8,4 +8,5 @@
#include "item/button.c"
#include "item/checkbox.c"
#include "item/radiobutton.c"
+#include "item/borderimage.c"
#include "nexuiz/mainwindow.c"
Modified: trunk/data/qcsrc/menu-div0test/draw.qc
===================================================================
--- trunk/data/qcsrc/menu-div0test/draw.qc 2007-10-27 09:43:30 UTC (rev 2855)
+++ trunk/data/qcsrc/menu-div0test/draw.qc 2007-10-27 16:19:24 UTC (rev 2856)
@@ -1,3 +1,4 @@
+float drawfont;
string draw_mousepointer;
void draw_setMousePointer(string pic)
@@ -12,6 +13,7 @@
void draw_reset()
{
+ drawfont = 8;
draw_shift = '0 0 0';
draw_scale = '1 0 0' * cvar("vid_conwidth") + '0 1 0' * cvar("vid_conheight");
draw_alpha = 1;
@@ -49,9 +51,111 @@
void draw_Picture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha)
{
- drawpic(boxToGlobal(theOrigin, draw_shift, draw_scale), pic, boxToGlobalSize(theSize, draw_scale), theColor, theAlpha * draw_alpha, 0);
+ //drawpic(boxToGlobal(theOrigin, draw_shift, draw_scale), pic, boxToGlobalSize(theSize, draw_scale), theColor, theAlpha * draw_alpha, 0);
+ drawsubpic(boxToGlobal(theOrigin, draw_shift, draw_scale), boxToGlobalSize(theSize, draw_scale), pic, '0 0 0', '1 1 1', theColor, theAlpha * draw_alpha, 0);
}
+// a button picture is a texture containing three parts:
+// 1/4 width: left part
+// 1/2 width: middle part (stretched)
+// 1/4 width: right part
+// it is assumed to be 4x as wide as high for aspect ratio purposes, which
+// means, the parts are a square, two squares and a square.
+void draw_ButtonPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha)
+{
+ vector square;
+ vector width, height;
+ theOrigin = boxToGlobal(theOrigin, draw_shift, draw_scale);
+ theSize = boxToGlobalSize(theSize, draw_scale);
+ theAlpha *= draw_alpha;
+ width = eX * theSize_x;
+ height = eY * theSize_y;
+ if(theSize_x <= theSize_y * 2)
+ {
+ // button not wide enough
+ // draw just left and right part then
+ square = eX * theSize_x * 0.5;
+ drawsubpic(theOrigin, square + height, pic, '0 0 0', '0.25 1 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + square, square + height, pic, '0.75 0 0', '0.25 1 0', theColor, theAlpha, 0);
+ }
+ else
+ {
+ square = theSize_y * '1 0 0';
+ drawsubpic(theOrigin, height + square, pic, '0 0 0', '0.25 1 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + square, theSize - 2 * square, pic, '0.25 0 0', '0.5 1 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width - square, height + square, pic, '0.75 0 0', '0.25 1 0', theColor, theAlpha, 0);
+ }
+}
+
+// a border picture is a texture containing nine parts:
+// 1/4 width: left part
+// 1/2 width: middle part (stretched)
+// 1/4 width: right part
+// divided into
+// 1/4 height: top part
+// 1/2 height: middle part (stretched)
+// 1/4 height: bottom part
+void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
+{
+ vector dX, dY;
+ vector width, height;
+ theOrigin = boxToGlobal(theOrigin, draw_shift, draw_scale);
+ theSize = boxToGlobalSize(theSize, draw_scale);
+ theBorderSize = boxToGlobalSize(theBorderSize, draw_scale);
+ theAlpha *= draw_alpha;
+ width = eX * theSize_x;
+ height = eY * theSize_y;
+ if(theSize_x <= theBorderSize_x * 2)
+ {
+ // not wide enough... draw just left and right then
+ if(theSize_y <= theBorderSize_y * 2)
+ {
+ // not high enough... draw just corners
+ drawsubpic(theOrigin, width * 0.5 + height * 0.5, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width * 0.5, width * 0.5 + height * 0.5, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height * 0.5, width * 0.5 + height * 0.5, pic, '0 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + theSize * 0.5, width * 0.5 + height * 0.5, pic, '0.75 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ }
+ else
+ {
+ dY = theBorderSize_x * eY;
+ drawsubpic(theOrigin, width * 0.5 + dY, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width * 0.5, width * 0.5 + dY, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width * 0.5 + dY, width * 0.5 + height - 2 * dY, pic, '0.75 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height - dY, width * 0.5 + dY, pic, '0 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width * 0.5 + dY, width * 0.5 + dY, pic, '0.75 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ }
+ }
+ else
+ {
+ if(theSize_y <= theBorderSize_y * 2)
+ {
+ // not high enough... draw just top and bottom then
+ dX = theBorderSize_x * eX;
+ drawsubpic(theOrigin, dX + height * 0.5, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dX, width - 2 * dX + height * 0.5, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width - dX, dX + height * 0.5, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height * 0.5, dX + height * 0.5, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dX + height * 0.5, width - 2 * dX + height * 0.5, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width - dX + height * 0.5, dX + height * 0.5, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ }
+ else
+ {
+ dX = theBorderSize_x * eX;
+ dY = theBorderSize_x * eY;
+ drawsubpic(theOrigin, dX + dY, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dX, width - 2 * dX + dY, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width - dX, dX + dY, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dY, dX + height - 2 * dY, pic, '0 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dY + dX, width - 2 * dX + height - 2 * dY, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dY + width - dX, dX + height - 2 * dY, pic, '0.75 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height - dY, dX + dY, pic, '0 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height - dY + dX, width - 2 * dX + dY, pic, '0.25 0.75 0', '0.5 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height - dY + width - dX, dX + dY, pic, '0.75 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ }
+ }
+}
void draw_Text(vector theOrigin, string theText, vector theSize, vector theColor, float theAlpha)
{
drawstring(boxToGlobal(theOrigin, draw_shift, draw_scale), theText, boxToGlobalSize(theSize, draw_scale), theColor, theAlpha * draw_alpha, 0);
@@ -59,5 +163,7 @@
float draw_TextWidth(string theText)
{
- return strlen(theText);
+ //return strlen(theText);
+ //print("draw_TextWidth \"", theText, "\"\n");
+ return stringwidth(theText, 0);
}
Modified: trunk/data/qcsrc/menu-div0test/draw.qh
===================================================================
--- trunk/data/qcsrc/menu-div0test/draw.qh 2007-10-27 09:43:30 UTC (rev 2855)
+++ trunk/data/qcsrc/menu-div0test/draw.qh 2007-10-27 16:19:24 UTC (rev 2856)
@@ -6,6 +6,8 @@
void draw_setMousePointer(string pic);
void draw_drawMousePointer(vector where);
+void draw_ButtonPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha);
+void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize);
void draw_Picture(vector origin, string pic, vector size, vector color, float alpha);
void draw_Text(vector origin, string text, vector size, vector color, float alpha);
float draw_TextWidth(string text);
Added: trunk/data/qcsrc/menu-div0test/item/borderimage.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/borderimage.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/item/borderimage.c 2007-10-27 16:19:24 UTC (rev 2856)
@@ -0,0 +1,40 @@
+#ifdef INTERFACE
+CLASS(BorderImage) EXTENDS(Label)
+ METHOD(BorderImage, configureBorderImage, void(entity, string, float, vector, string, float))
+ METHOD(BorderImage, resizeNotify, void(entity, vector, vector, vector, vector))
+ METHOD(BorderImage, draw, void(entity))
+ ATTRIB(BorderImage, src, string, "")
+ ATTRIB(BorderImage, borderHeight, float, 0)
+ ATTRIB(BorderImage, borderVec, vector, '0 0 0')
+ ATTRIB(BorderImage, color, vector, '1 1 1')
+ ATTRIB(BorderImage, closeButton, entity, NULL)
+ENDCLASS(BorderImage)
+#endif
+
+#ifdef IMPLEMENTATION
+void resizeNotifyBorderImage(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+ resizeNotifyLabel(me, relOrigin, relSize, absOrigin, absSize);
+ me.borderVec = me.borderHeight * me.realFontSize_y * (eY + eX * (absSize_y / absSize_x));
+ me.realOrigin_y = 0.5 * me.realFontSize_y * (me.borderHeight - 1);
+ if(me.closeButton)
+ {
+ // move the close button to the right place
+ me.closeButton.Container_origin = '1 0 0' * (1 - me.borderVec_x);
+ me.closeButton.Container_size = me.borderVec;
+ me.closeButton.color = me.color;
+ }
+}
+void configureBorderImageBorderImage(entity me, string title, float sz, vector theColor, string path, float theBorderHeight)
+{
+ me.configureLabel(me, title, sz, 0.5);
+ me.src = path;
+ me.color = theColor;
+ me.borderHeight = theBorderHeight;
+}
+void drawBorderImage(entity me)
+{
+ draw_BorderPicture('0 0 0', me.src, '1 1 0', me.color, 1, me.borderVec);
+ drawLabel(me);
+};
+#endif
Modified: trunk/data/qcsrc/menu-div0test/item/button.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/button.c 2007-10-27 09:43:30 UTC (rev 2855)
+++ trunk/data/qcsrc/menu-div0test/item/button.c 2007-10-27 16:19:24 UTC (rev 2856)
@@ -15,6 +15,7 @@
ATTRIB(Button, pressed, float, 0)
ATTRIB(Button, clickTime, float, 0)
ATTRIB(Button, forcePressed, float, 0)
+ ATTRIB(Button, color, vector, '1 1 1')
ATTRIB(Button, origin, vector, '0 0 0')
ATTRIB(Button, size, vector, '0 0 0')
@@ -37,8 +38,7 @@
{
if(key == K_ENTER || key == K_SPACE)
{
- me.onClick(me, me.onClickEntity);
- me.clickTime = 0.1;
+ me.clickTime = 0.1; // delayed for effect
return 1;
}
return 0;
@@ -71,40 +71,29 @@
{
if(me.srcMulti)
{
- float division;
- division = min(0.5, 0.5 * me.size_y / me.size_x);
if(me.forcePressed || me.pressed || me.clickTime > 0)
- {
- draw_Picture('0 0 0', strcat(me.src, "_cl"), eX * division + eY, '1 1 1', 1);
- if(division < 0.5)
- draw_Picture('0 0 0' + eX * division, strcat(me.src, "_cm"), eX * (1 - 2 * division) + eY, '1 1 1', 1);
- draw_Picture(eX * (1 - division), strcat(me.src, "_cr"), eX * division + eY, '1 1 1', 1);
- }
+ draw_ButtonPicture('0 0 0', strcat(me.src, "_c"), '1 1 0', me.color, 1);
else if(me.focused)
- {
- draw_Picture('0 0 0', strcat(me.src, "_fl"), eX * division + eY, '1 1 1', 1);
- if(division < 0.5)
- draw_Picture('0 0 0' + eX * division, strcat(me.src, "_fm"), eX * (1 - 2 * division) + eY, '1 1 1', 1);
- draw_Picture(eX * (1 - division), strcat(me.src, "_fr"), eX * division + eY, '1 1 1', 1);
- }
+ draw_ButtonPicture('0 0 0', strcat(me.src, "_f"), '1 1 0', me.color, 1);
else
- {
- draw_Picture('0 0 0', strcat(me.src, "_nl"), eX * division + eY, '1 1 1', 1);
- if(division < 0.5)
- draw_Picture('0 0 0' + eX * division, strcat(me.src, "_nm"), eX * (1 - 2 * division) + eY, '1 1 1', 1);
- draw_Picture(eX * (1 - division), strcat(me.src, "_nr"), eX * division + eY, '1 1 1', 1);
- }
+ draw_ButtonPicture('0 0 0', strcat(me.src, "_n"), '1 1 0', me.color, 1);
}
else
{
if(me.forcePressed || me.pressed || me.clickTime > 0)
- draw_Picture('0 0 0', strcat(me.src, "_c"), '1 1 0', '1 1 1', 1);
+ draw_Picture('0 0 0', strcat(me.src, "_c"), '1 1 0', me.color, 1);
else if(me.focused)
- draw_Picture('0 0 0', strcat(me.src, "_f"), '1 1 0', '1 1 1', 1);
+ draw_Picture('0 0 0', strcat(me.src, "_f"), '1 1 0', me.color, 1);
else
- draw_Picture('0 0 0', strcat(me.src, "_n"), '1 1 0', '1 1 1', 1);
+ draw_Picture('0 0 0', strcat(me.src, "_n"), '1 1 0', me.color, 1);
}
- me.clickTime -= frametime;
drawLabel(me);
+
+ if(me.clickTime > 0 && me.clickTime < frametime)
+ {
+ // keyboard click timer expired? Fire the event then.
+ me.onClick(me, me.onClickEntity);
+ }
+ me.clickTime -= frametime;
}
#endif
Modified: trunk/data/qcsrc/menu-div0test/item/checkbox.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/checkbox.c 2007-10-27 09:43:30 UTC (rev 2855)
+++ trunk/data/qcsrc/menu-div0test/item/checkbox.c 2007-10-27 16:19:24 UTC (rev 2856)
@@ -50,7 +50,13 @@
else
draw_Picture(cbOrigin, strcat(me.src, "_n0"), cbSize, '1 1 1', 1);
}
+ drawLabel(me); // skip drawButton!
+
+ if(me.clickTime > 0 && me.clickTime < frametime)
+ {
+ // keyboard click timer expired? Fire the event then.
+ me.onClick(me, me.onClickEntity);
+ }
me.clickTime -= frametime;
- drawLabel(me); // skip drawButton!
}
#endif
Modified: trunk/data/qcsrc/menu-div0test/item/label.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/label.c 2007-10-27 09:43:30 UTC (rev 2855)
+++ trunk/data/qcsrc/menu-div0test/item/label.c 2007-10-27 16:19:24 UTC (rev 2856)
@@ -11,6 +11,7 @@
ATTRIB(Label, keepspaceRight, float, 0)
ATTRIB(Label, realFontSize, vector, '0 0 0')
ATTRIB(Label, realOrigin, vector, '0 0 0')
+ ATTRIB(Label, alpha, float, 0.7)
ENDCLASS(Label)
#endif
@@ -36,6 +37,6 @@
}
void drawLabel(entity me)
{
- draw_Text(me.realOrigin, me.text, me.realFontSize, '0 0 0', 1);
+ draw_Text(me.realOrigin, me.text, me.realFontSize, '1 1 1', me.alpha);
}
#endif
Modified: trunk/data/qcsrc/menu-div0test/mbuiltin.qh
===================================================================
--- trunk/data/qcsrc/menu-div0test/mbuiltin.qh 2007-10-27 09:43:30 UTC (rev 2855)
+++ trunk/data/qcsrc/menu-div0test/mbuiltin.qh 2007-10-27 16:19:24 UTC (rev 2856)
@@ -180,8 +180,11 @@
float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
float drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
+float drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag) = #467;
+float stringwidth(string text, float handleColors) = #468;
float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
+float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #469;
float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
Modified: trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c 2007-10-27 09:43:30 UTC (rev 2855)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c 2007-10-27 16:19:24 UTC (rev 2856)
@@ -16,21 +16,23 @@
void configureMainWindowMainWindow(entity me)
{
- entity dlg, n, i, b, c, mc, t1, t2, t3;
+ entity dlg, n, i, b, c, mc, t1, t2, t3, cb;
n = spawnNexposee();
me.addItem(me, n, '0 0 0', '1 1 0', 1);
dlg = spawnInputContainer();
- i = spawnImage();
- i.configureImage(i, "gfx/4.tga");
+ cb = spawnButton();
+ cb.configureButton(cb, "", 12, "qcsrc/menu-div0test/baseclosebutton");
+ cb.onClick = DialogCloseButton_Click; cb.onClickEntity = dlg;
+ cb.srcMulti = 0;
+
+ i = spawnBorderImage();
+ i.configureBorderImage(i, "I told you...", 18, '0.5 0.5 1', "qcsrc/menu-div0test/baseborder", 1.5);
+ i.closeButton = cb;
dlg.addItem(dlg, i, '0 0 0', '1 1 0', 1);
i = spawnLabel();
- i.configureLabel(i, "I told you...", 24, 0.5);
- dlg.addItem(dlg, i, '0 0 0', '1 0.2 0', 1);
-
- i = spawnLabel();
i.configureLabel(i, "Swim swim hungry, swim swim hungry...", 8, 0.5);
dlg.addItem(dlg, i, '0 0.3 0', '1 0.1 0', 1);
@@ -51,6 +53,8 @@
i.configureButton(i, "Close", 12, "qcsrc/menu-div0test/basebutton");
i.onClick = DialogCloseButton_Click; i.onClickEntity = dlg;
dlg.addItem(dlg, i, '0.3 0.7 0', '0.4 0.2 0', 1);
+
+ dlg.addItem(dlg, cb, '0.3 0.7 0', '0.4 0.2 0', 1);
me.addItem(me, dlg, '0.2 0.3 0', '0.6 0.4 0', 1);
i = spawnImage();
More information about the nexuiz-commits
mailing list