8 void() _Gfx_UpdateFPS =
10 local float lDeltaTime;
12 _Gfx_FrameCount = _Gfx_FrameCount + 1;
14 lDeltaTime = Timer_Time - _Gfx_LastTime;
15 if( GFX_SHOWFPS_DURATION < lDeltaTime ) {
16 _Gfx_FPS = _Gfx_FrameCount / lDeltaTime;
17 _Gfx_LastTime = Timer_Time;
22 // cvar ngmenu_menu_height
23 void() _Gfx_UpdateRes =
25 Gfx_Real_Width = cvar( "vid_conwidth" );
26 Gfx_Real_Height = cvar( "vid_conheight" );
27 Gfx_Menu_Width = cvar( CVAR_SCMENU_MENU_WIDTH );
28 Gfx_Menu_Height = cvar( CVAR_SCMENU_MENU_HEIGHT );
30 if( Gfx_Menu_Width == 0.0 )
31 Gfx_Menu_Width = GFX_MENU_DEFAULT_WIDTH;
32 if( Gfx_Menu_Height == 0.0 )
33 Gfx_Menu_Height = GFX_MENU_DEFAULT_HEIGHT;
38 local string lWidth, lHeight;
40 lWidth = ftos( GFX_MENU_DEFAULT_WIDTH );
41 lHeight = ftos( GFX_MENU_DEFAULT_HEIGHT );
43 registercvar( CVAR_SCMENU_MENU_WIDTH, lWidth, CVAR_SAVE );
44 registercvar( CVAR_SCMENU_MENU_HEIGHT, lHeight, CVAR_SAVE );
46 registercvar( CVAR_SCMENU_SHOWFPS, ftos( GFX_SHOWFPS_DEFAULT ), 0 );
72 if( cvar( CVAR_SCMENU_SHOWFPS ) ) {
75 local vector lPosition;
77 lText = strcat( "FPS: ", ftos( floor( _Gfx_FPS ) ) );
81 lPosition_y = Gfx_Menu_Height - lScale_y - 5;
84 Gfx_DrawString( lPosition, lText, lScale, '1.0 1.0 1.0', 1.0, 0 );
88 bool( string pPic ) Gfx_IsCached =
90 return iscachedpic( pPic );
93 bool( string pPic ) Gfx_Precache =
98 if( iscachedpic( pPic ) )
100 if( precache_pic( pPic ) == pPic )
105 void( string pPic ) Gfx_Free
107 // DO NOTHING UNTIL A REF COUNTER IS IMPLEMENTED
110 vector( string pPic ) Gfx_GetImageSize
112 return drawgetimagesize( pPic );
115 vector( vector pPos ) Gfx_ConToMen =
117 pPos_x = pPos_x * Gfx_Menu_Width / Gfx_Real_Width;
118 pPos_y = pPos_y * Gfx_Menu_Height / Gfx_Real_Height;
124 vector( vector pPos ) Gfx_MenToCon =
126 pPos_x = pPos_x * Gfx_Real_Width / Gfx_Menu_Width;
127 pPos_y = pPos_y * Gfx_Real_Height / Gfx_Menu_Height;
133 void() Gfx_ResetClipArea =
138 vector( vector pPosition ) _Gfx_FitCenter =
140 return (pPosition + '0.375 0.375 0');
143 float( vector pPosition, float pCharacter, vector pScale, vector pRGB, float pAlpha, float pFlag )
146 pPosition = _Gfx_FitCenter( Gfx_MenToCon( pPosition ) );
147 pScale = Gfx_MenToCon( pScale );
149 return drawcharacter( pPosition, pCharacter, pScale, pRGB, pAlpha, pFlag );
152 float( vector pPosition, string pText, vector pScale, vector pRGB, float pAlpha, float pFlag )
155 pPosition = _Gfx_FitCenter( Gfx_MenToCon( pPosition ) );
156 pScale = Gfx_MenToCon( pScale );
158 return drawstring( pPosition, pText, pScale, pRGB, pAlpha, pFlag );
161 float( vector pPosition, string pPicture, vector pSize, vector pRGB, float pAlpha, float pFlag )
164 pPosition = _Gfx_FitCenter( Gfx_MenToCon( pPosition ) );
165 pSize = Gfx_MenToCon( pSize );
167 return drawpic( pPosition, pPicture, pSize, pRGB, pAlpha, pFlag );
170 float( vector pPosition, vector pSize, vector pRGB, float pAlpha, float pFlag )
173 pPosition = _Gfx_FitCenter( Gfx_MenToCon( pPosition ) );
174 pSize = Gfx_MenToCon( pSize );
176 return drawfill( pPosition, pSize, pRGB, pAlpha, pFlag );
179 void( float pX, float pY, float pWidth, float pHeight )
182 local vector lPosition, lSize;
190 lPosition = _Gfx_FitCenter( Gfx_MenToCon( lPosition ) );
191 lSize = Gfx_MenToCon( lSize ) + '1 1 0';
193 drawsetcliparea( lPosition_x, lPosition_y, lSize_x, lSize_y );