Using getimagesize to allow more variable btn_main.bmp files.
This commit is contained in:
parent
3188c43bc0
commit
1c27fb93f6
4 changed files with 9 additions and 2 deletions
3
Source/Menu/Defs.h
Executable file → Normal file
3
Source/Menu/Defs.h
Executable file → Normal file
|
@ -38,6 +38,9 @@ var float fMouseClick;
|
|||
var float fButtonAlpha[8];
|
||||
var float fScrollWheel;
|
||||
|
||||
var vector vMenuButtonsSize;
|
||||
var int iMenuButtonHeight;
|
||||
|
||||
enum {
|
||||
SCROLL_NONE,
|
||||
SCROLL_UP,
|
||||
|
|
4
Source/Menu/Init.c
Executable file → Normal file
4
Source/Menu/Init.c
Executable file → Normal file
|
@ -27,6 +27,7 @@ Precaches and loading for the menu system
|
|||
*/
|
||||
void m_init( void ) {
|
||||
precache_pic( "gfx/shell/splash" );
|
||||
precache_pic( "gfx/shell/btns_main" );
|
||||
|
||||
// Index all the maps... TODO: Filter out /valve/ to avoid useless junk from being cached.
|
||||
searchhandle shMaps = search_begin( "maps/*.bsp", TRUE, TRUE );
|
||||
|
@ -39,6 +40,9 @@ void m_init( void ) {
|
|||
|
||||
search_end( shMaps );
|
||||
FONT_MENU = loadfont( "menu", "gfx/menuchars", "32", -1 );
|
||||
|
||||
vMenuButtonsSize = drawgetimagesize( "gfx/shell/btns_main" );
|
||||
iMenuButtonHeight = ( vMenuButtonsSize_y / MENU_BUTTONS ) / 3;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
4
Source/Menu/Objects.c
Executable file → Normal file
4
Source/Menu/Objects.c
Executable file → Normal file
|
@ -124,8 +124,8 @@ void Object_Button( vector vPosition, int iButtonID, void() vFunction, __inout f
|
|||
|
||||
vector vSrcPos, vSrcSize;
|
||||
vSrcPos_x = 0;
|
||||
vSrcPos_y = ( 78 * iButtonID ) / 5538;
|
||||
vSrcSize = [ 1, 26 / 5538 ];
|
||||
vSrcPos_y = ( 78 * iButtonID ) / vMenuButtonsSize_y;
|
||||
vSrcSize = [ 1, iMenuButtonHeight / vMenuButtonsSize_y ];
|
||||
drawsubpic( vPosition, '156 26', "gfx/shell/btns_main", vSrcPos, vSrcSize, '1 1 1', 1.0f, 1 );
|
||||
drawsubpic( vPosition, '156 26', "gfx/shell/btns_main", vSrcPos + [ 0, 52 / 5538 ], vSrcSize, '1 1 1', fAlpha, 1 );
|
||||
}
|
||||
|
|
BIN
freecs/menu.dat
BIN
freecs/menu.dat
Binary file not shown.
Loading…
Reference in a new issue