flickering cursor & slide menu item

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1519 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2007-12-29 21:55:32 +00:00
parent e0ec17f461
commit 1a471ff470
4 changed files with 14 additions and 5 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ void rendercommand(int x, int y)
{
s_sprintfd(s)("> %s", cmdline.buf);
int offset = text_width(s, cmdline.pos>=0 ? cmdline.pos+2 : -1);
blendbox(x+offset, y, x+offset+char_width(cmdline.pos>=0 ? cmdline.buf[cmdline.pos] : '_'), y+FONTH, true);
rendercursor(x+offset, y, char_width(cmdline.pos>=0 ? cmdline.buf[cmdline.pos] : '_'));
draw_text(s, x, y);
}
+6 -4
View File
@@ -243,7 +243,7 @@ struct mitemtextinput : mitemtext
if(selection) blendbox(x+tw, y-FONTH/6, x+w+FONTH, y+FONTH+FONTH/6, false);
draw_text(text, x, y);
int offset = text_width(input.buf, input.pos>=0 ? input.pos : -1);
if(selection) blendbox(x+tw+offset, y, x+tw+offset+char_width(input.pos>=0 ? input.buf[input.pos] : '_'), y+FONTH, true);
if(selection) rendercursor(x+tw+offset, y, char_width(input.pos>=0 ? input.buf[input.pos] : '_'));
draw_text(input.buf, x+tw, y);
}
@@ -310,12 +310,14 @@ struct mitemslider : mitem
virtual void render(int x, int y, int w)
{
static color white1(0.2f, 0.2f, 0.2f), white2(1.0f, 1.0f, 1.0f);
bool sel = isselection();
static color white1(0.2f, 0.2f, 0.2f);
color white2(1.0f, 1.0f, 1.0f, sel ? (sinf(lastmillis/200.0f)+1.0f)/2.0f : 1.0f);
int range = max_-min_;
int cval = value-min_;
int tw = text_width(text);
if(isselection()) blendbox(x+tw, y-FONTH/6, x+w+FONTH, y+FONTH+FONTH/6, false);
if(sel) blendbox(x+tw, y-FONTH/6, x+w+FONTH, y+FONTH+FONTH/6, false);
draw_text(text, x, y);
string v;
@@ -536,7 +538,7 @@ bool menukey(int code, bool isdown, int unicode)
{
if(!curmenu->allowinput) return false;
mitem &m = *curmenu->items[menusel];
m.key(code, isdown, unicode);
m.key(code, isdown, unicode);
return true;
}
}
+1
View File
@@ -145,6 +145,7 @@ extern void quad(GLuint tex, float x, float y, float s, float tx, float ty, floa
extern void circle(GLuint tex, float x, float y, float r, float tx, float ty, float tr, int subdiv = 32);
extern void gl_drawframe(int w, int h, float changelod, float curfps);
extern void clearminimap();
extern void rendercursor(int x, int y, int w);
// texture
struct Texture
+6
View File
@@ -239,6 +239,12 @@ void blendbox(int x1, int y1, int x2, int y2, bool border, int tex, color *c)
glDepthMask(GL_TRUE);
}
void rendercursor(int x, int y, int w)
{
color c(1, 1, 1, (sinf(lastmillis/200.0f)+1.0f)/2.0f);
blendbox(x, y, x+w, y+FONTH, true, -1, &c);
}
VARP(fov, 90, 100, 120);
VAR(fog, 64, 180, 1024);
VAR(fogcolour, 0, 0x8099B3, 0xFFFFFF);