summaryrefslogtreecommitdiff
path: root/source/ui_atoms.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2008-05-05 21:18:52 +0000
committerAndrey Nazarov <skuller@skuller.net>2008-05-05 21:18:52 +0000
commit0bd55fbf794d11385bcc64b01b81e8e478295bad (patch)
treeab548c3ad37fc13c555a5cca9da4348f3e35d84c /source/ui_atoms.c
parent49e6170b49fbb933eddec6d0e3f946320c68832f (diff)
Brought SDL window resizing policy in compliance to ICCCM.
Renamed `vid_placement' cvar to `vid_geometry'. Load *.pkz files by default. Do not allow backed-up quake paths at all. Apply `--enable-dsound' and `--enable-dinput' options to Unix too. Replaced `s_driver' and `in_driver' cvars with `s_direct' and `in_direct'. Renamed `s_initsound' cva to `s_enable'. Improved SDL input grabs handling in windowed mode. Allow `cl_noskins' to be dynamically changed. Run client at 10 fps if minimuzed, at 60 fps if not active (client is disconnected or in background). Fixed Sys_ExecDefault. Use absolute mouse positioning for UI. Hide custom UI cursor in windowed mode.
Diffstat (limited to 'source/ui_atoms.c')
-rw-r--r--source/ui_atoms.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/source/ui_atoms.c b/source/ui_atoms.c
index 45976ca..128daa6 100644
--- a/source/ui_atoms.c
+++ b/source/ui_atoms.c
@@ -83,18 +83,16 @@ void UI_PushMenu( menuFrameWork_t *menu ) {
Menu_Init( menu );
+ keydest = keys.GetDest();
+ keys.SetDest( ( keydest & ~KEY_CONSOLE ) | KEY_MENU );
+
if( !uis.activeMenu ) {
uis.entersound = qtrue;
+ //CL_WarpMouse( 0, 0 );
}
uis.activeMenu = menu;
- keydest = keys.GetDest();
- if( keydest & KEY_CONSOLE ) {
- keydest &= ~KEY_CONSOLE;
- }
- keys.SetDest( keydest | KEY_MENU );
-
UI_DoHitTest();
}
@@ -125,6 +123,8 @@ void UI_Resize( void ) {
Menu_Init( uis.layers[i] );
}
}
+
+ //CL_WarpMouse( 0, 0 );
}
@@ -395,31 +395,23 @@ qboolean UI_DoHitTest( void ) {
/*
=================
-UI_MouseMove
+UI_MouseEvent
=================
*/
-void UI_MouseMove( int mx, int my ) {
+void UI_MouseEvent( int x, int y ) {
if( !uis.activeMenu ) {
return;
}
- if( !mx && !my ) {
- return;
- }
-
- uis.mouseCoords[0] += mx;
- uis.mouseCoords[1] += my;
+ clamp( x, 0, uis.glconfig.vidWidth );
+ clamp( y, 0, uis.glconfig.vidHeight );
- clamp( uis.mouseCoords[0], 0, uis.width );
- clamp( uis.mouseCoords[1], 0, uis.height );
+ uis.mouseCoords[0] = x * uis.scale;
+ uis.mouseCoords[1] = y * uis.scale;
- if( UI_DoHitTest() ) {
- // TODO: add new mousemove sound
- // cl.StartLocalSound( "misc/menu2.wav" );
- }
+ UI_DoHitTest();
}
-
/*
=================
UI_Draw
@@ -479,8 +471,11 @@ void UI_Draw( int realtime ) {
}
}
- ref.DrawPic( uis.mouseCoords[0] - uis.cursorWidth / 2,
- uis.mouseCoords[1] - uis.cursorHeight / 2, uis.cursorHandle );
+ // draw custom cursor in fullscreen mode
+ if( uis.glconfig.flags & QVF_FULLSCREEN ) {
+ ref.DrawPic( uis.mouseCoords[0] - uis.cursorWidth / 2,
+ uis.mouseCoords[1] - uis.cursorHeight / 2, uis.cursorHandle );
+ }
if( ui_debug->integer ) {
Menu_HitTest( uis.activeMenu );
@@ -854,7 +849,7 @@ static void UI_FillAPI( uiAPI_t *api ) {
api->ModeChanged = UI_ModeChanged;
api->Draw = UI_Draw;
api->DrawLoading = UI_DrawLoading;
- api->MouseMove = UI_MouseMove;
+ api->MouseEvent = UI_MouseEvent;
api->Keydown = UI_Keydown;
api->CharEvent = UI_CharEvent;
api->OpenMenu = UI_OpenMenu;