Documentation improvements for platform, vgui etc. headers and files.
This commit is contained in:
parent
88131dbb9a
commit
27b0c26a12
36 changed files with 820 additions and 598 deletions
|
@ -13,33 +13,55 @@
|
|||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/** Data for an achievement definition. */
|
||||
typedef struct
|
||||
{
|
||||
int m_iID;
|
||||
string m_strName;
|
||||
string m_strDescription;
|
||||
int m_iAchieved;
|
||||
string m_strMaterial;
|
||||
int m_iID; /**< Unique numeric ID of an achievement. */
|
||||
string m_strName; /**< Name of the achivement. */
|
||||
string m_strDescription; /**< Description of the achivement. */
|
||||
int m_iAchieved; /**< Indicator if it's been achieved or not. */
|
||||
string m_strMaterial; /**< An image or icon depicting the achivement. */
|
||||
} achievement_t;
|
||||
|
||||
/* unlock an achievement */
|
||||
/** Unlock an achievement.
|
||||
|
||||
@param strName The name identifier of the achivement. */
|
||||
void Achievement_Set(string strName);
|
||||
|
||||
/* clea an achievement (development purposes mainly) */
|
||||
/** Clear an achievement (development purposes mainly).
|
||||
|
||||
@param strName The name identifier of the achivement. */
|
||||
void Achievement_Clear(string strName);
|
||||
|
||||
/* returns whether or not an achievement has been achieved */
|
||||
int Achievement_Get(string strName);
|
||||
/** Returns whether or not an achievement has been achieved.
|
||||
|
||||
/* get the icon of an achievement */
|
||||
@param strName The name identifier of the achivement.
|
||||
@return true when achieved, false if not. */
|
||||
bool Achievement_Get(string strName);
|
||||
|
||||
/** Get the icon of an achievement.
|
||||
|
||||
@param strName The name identifier of the achivement.
|
||||
@return The URL or local file pointing to an image or icon. */
|
||||
string Achievement_GetIcon(string strName);
|
||||
|
||||
/* STUB, returns how many other users achieved this */
|
||||
/** STUB, returns how many other users achieved this
|
||||
|
||||
@param strName The name identifier of the achivement.
|
||||
@return Normalized value between 0.0 - 1.0 indicating progress. */
|
||||
float Achievement_GetPercentage(string strName);
|
||||
|
||||
/* called when you want to show a pop-up indicating progress */
|
||||
/** Requests an overlay to be drawn.
|
||||
It indicates the progression towards a particular achivement.
|
||||
|
||||
@param strName The name identifier of the achievement.
|
||||
@param iCurrent The current value of progress.
|
||||
@param iMax The maximum value of progress. */
|
||||
void Achievement_IndicateProgress(string strName, int iCurrent, int iMax);
|
||||
|
||||
/* updates the achievement_t pointer with what's been achieved and what's not been achieved */
|
||||
void Achievement_RequestStats(achievement_t *ptr, int count);
|
||||
/** Updates the achievement_t pointer with what's been achieved and what's not been achieved from a remote location.
|
||||
|
||||
@param ptr Pointer to an achievement_t array.
|
||||
@return Will return false upon failure. */
|
||||
bool Achievement_RequestStats(achievement_t *ptr, int count);
|
||||
|
|
|
@ -27,7 +27,7 @@ Achievement_Clear(string strName)
|
|||
}
|
||||
|
||||
/* returns whether or not an achievement has been achieved */
|
||||
int
|
||||
bool
|
||||
Achievement_Get(string strName)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
@ -14,7 +14,16 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*! @file master.h
|
||||
@brief Master Server related functions.
|
||||
|
||||
Various functions to help communicate with the master
|
||||
server(s).
|
||||
*/
|
||||
|
||||
/** The default master server address. */
|
||||
#define MASTER_DNS "master.frag-net.com"
|
||||
/** The default port used to talk to the master server. */
|
||||
#define MASTER_PORT 27950
|
||||
|
||||
float srv_fldAdress;
|
||||
|
@ -25,28 +34,29 @@ float srv_fldMaxplayers;
|
|||
float srv_fldMap;
|
||||
float srv_fldGame;
|
||||
|
||||
/* returns IP of master server */
|
||||
/** Returns IP of master server. */
|
||||
string Master_Resolve(void);
|
||||
|
||||
/* returns the total amount of games */
|
||||
/** Returns the total amount of games from both LAN and Internet. */
|
||||
int Master_GetTotalServers(void);
|
||||
|
||||
/* returns the amount of internet games */
|
||||
/** Returns the amount of internet games from the last refresh. */
|
||||
int Master_GetInternetServers(void);
|
||||
|
||||
/** Returns the amount of LAN servers from the last refresh. */
|
||||
int Master_GetLANServers(void);
|
||||
|
||||
/* get completely new list of servers, hard-reset the cache */
|
||||
/** Get completely new list of servers, hard-reset the cache. Forgets about all else. */
|
||||
void Master_UpdateCache(void);
|
||||
|
||||
/* refresh the current server cache */
|
||||
/** Refresh the current server cache. Will only talk to known servers. */
|
||||
void Master_RefreshCache(void);
|
||||
|
||||
/* sort the server cache without refreshing */
|
||||
/** Re-Sort the server cache without refreshing. */
|
||||
void Master_ResortCache(void);
|
||||
|
||||
/* grab a new internet game list */
|
||||
/** Grab a NEW internet game list. Will flush any other lists. */
|
||||
void Master_GetInternetList(void);
|
||||
|
||||
/* grab a new LAN list */
|
||||
/** Grab a NEW LAN list. Will flush any other lists. */
|
||||
void Master_GetLANList(void);
|
||||
|
|
|
@ -14,9 +14,14 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* Emscripten builds and mods? Forgetaboutit! */
|
||||
#ifndef WEBMENU
|
||||
|
||||
/** uri_get callback id for mod-list retrieval */
|
||||
#define MODSERVER_REQ_LIST 100
|
||||
/** uri_get callback id for mod-item retrieval */
|
||||
#define MODSERVER_REQ_ITEM 101
|
||||
/** uri_get callback id for mod package name retrieval */
|
||||
#define MODSERVER_REQ_PKGNAMES 102
|
||||
|
||||
#define ModServer_URI_Callback URI_Get_Callback
|
||||
|
@ -26,12 +31,25 @@ var int g_iModServerReqCount;
|
|||
|
||||
int game_getpackageid(string pkgname);
|
||||
|
||||
/** Call this to initiate a lengthy process of updating the list of mods
|
||||
we can install in the custom game menu. */
|
||||
void ModServer_Refresh(void);
|
||||
|
||||
/** Function that interprets a mod-list.
|
||||
ModServer_URI_Callback calls this when retrieving a MODSERVER_REQ_ITEM description.
|
||||
Will in return call uri_get with code MODSERVER_REQ_ITEM on every game dir we don't
|
||||
have installed locally. Thus filling the mod list with entries we can install.
|
||||
|
||||
@param data White-space separated list of unique mod game directory names. */
|
||||
void ModServer_ParseList(string data);
|
||||
|
||||
/** Function that interprets a mod-item entry.
|
||||
ModServer_URI_Callback calls this when retrieving a MODSERVER_REQ_ITEM description.
|
||||
We then allocate a new mod entry in our mod-list and fill it with the data supplied.
|
||||
|
||||
@param data The data string that will fill up a newly allocated entry. */
|
||||
void ModServer_ParseItem(string data);
|
||||
|
||||
/* Called as an eventual result of the uri_get builtin. */
|
||||
/** Called as an eventual result of the uri_get builtin. */
|
||||
void ModServer_URI_Callback(float id, float code, string data, int resourcebytes);
|
||||
#endif
|
||||
|
|
|
@ -14,13 +14,24 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*! @file music.h
|
||||
@brief Music handler.
|
||||
|
||||
This is the internal music handler.
|
||||
Games primarily will use in-game entities such as trigger_cdaudio
|
||||
and target_cdaudio to play/change music tracks.
|
||||
|
||||
This is the code that handles how music track id's are translated
|
||||
into different path/naming conventions and file formats.
|
||||
*/
|
||||
|
||||
/* we're forced to support a few different paths */
|
||||
enum
|
||||
typedef enum
|
||||
{
|
||||
MUSIC_AUTO,
|
||||
MUSIC_FLAC, /* requires fteplug_ffmpeg */
|
||||
MUSIC_STEAMHL
|
||||
};
|
||||
MUSIC_AUTO, /**< Auto selection (default). */
|
||||
MUSIC_FLAC, /**< Free-Lossless-Audio-Codec requires fteplug_ffmpeg. */
|
||||
MUSIC_STEAMHL /**< MP3 tracks in the naming conventions of Steam Half-Life (2003) */
|
||||
} musicstyle_t;
|
||||
|
||||
string g_steamhltracks[27] = {
|
||||
"media/Half-Life01.mp3",
|
||||
|
@ -52,15 +63,27 @@ string g_steamhltracks[27] = {
|
|||
"media/Suspense07.mp3"
|
||||
};
|
||||
|
||||
var int autocvar_cl_musicstyle = MUSIC_AUTO;
|
||||
var musicstyle_t autocvar_cl_musicstyle = MUSIC_AUTO;
|
||||
|
||||
/* some installs may have the music in media/, others may be in music/ */
|
||||
/** Get the path to a single music track.
|
||||
Some installs may have the music in media/, others may be in music/.
|
||||
|
||||
@param id The music track in question.
|
||||
@return Path to the music track. */
|
||||
string Music_GetPath(int id);
|
||||
|
||||
/* EV_MUSICTRACK */
|
||||
/** This function is called by EV_MUSICTRACK events.
|
||||
Will play a single music track once.
|
||||
|
||||
@param parm The music track in question. Mostly a track number. */
|
||||
void Music_ParseTrack(string parm);
|
||||
|
||||
/* EV_MUSICLOOP */
|
||||
/** This function is called by EV_MUSICLOOP events.
|
||||
Will play a music track that loops.
|
||||
|
||||
@param parm The music track in question. Mostly a track number. */
|
||||
void Music_ParseLoop(string parm);
|
||||
|
||||
/** Called once when the menu is initialized.
|
||||
Will start playing whatever track is defined in the manifest or liblist file. */
|
||||
void Music_MenuStart(void);
|
||||
|
|
|
@ -14,8 +14,40 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*! @file richpresence.h
|
||||
@brief Rich Presence handler.
|
||||
|
||||
This is the internal rich presence handler.
|
||||
Rich presence is when the platform outside of the game communicates
|
||||
to other users what game it is we are playing and how to connect to it.
|
||||
|
||||
An example would be a friends-list where you see that a player
|
||||
is in game "Example Game" playing a multiplayer game on "Example map".
|
||||
|
||||
In addition it will expose a way for the game to supply a connect
|
||||
command to the command-line, so that those players can join via the
|
||||
platform interface.
|
||||
|
||||
The console command `richpresence_dump` will output the current set
|
||||
of key/value pairs that will be shared with the platform.
|
||||
*/
|
||||
|
||||
/** Sets a rich-presence key to the desired value.
|
||||
You keys currently available are: "status", "connect"
|
||||
|
||||
Setting the "status" key is meant to be visible to other
|
||||
players on the platform/network you're playing on.
|
||||
This may show up to other people on your friends-list, or some equivalent.
|
||||
|
||||
Meanwhile the "connect" key should have the address of
|
||||
a game servers others players can reach you under. */
|
||||
void RichPresence_Set(string strKey, string strValue);
|
||||
void RichPresence_DumpInfo(void);
|
||||
|
||||
/** Clears the current rich-presence status. */
|
||||
void RichPresence_Clear(void);
|
||||
|
||||
/** Returns if we've got an active rich-presence status. */
|
||||
bool RichPresence_WasSet(void);
|
||||
|
||||
/** Debug function that prints the currently active rich-presence keys to console. */
|
||||
void RichPresence_DumpInfo(void);
|
|
@ -16,30 +16,51 @@
|
|||
|
||||
#define TCP_BUFFER_LENGTH 32
|
||||
|
||||
/** State of a TCP connection. */
|
||||
typedef enum
|
||||
{
|
||||
STATE_DISCONNECTED, /**< We're disconnected/unconnected. */
|
||||
STATE_CONNECTING, /**< We're in the process of connecting. */
|
||||
STATE_CONNECTED /**< We're fully connected. */
|
||||
} tcpstate_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
filestream m_fSocket;
|
||||
string m_strBuffer[TCP_BUFFER_LENGTH];
|
||||
int m_iBufferLines;
|
||||
int m_iState;
|
||||
tcpstate_t m_iState;
|
||||
} tcpinfo_t;
|
||||
|
||||
enum
|
||||
{
|
||||
STATE_DISCONNECTED,
|
||||
STATE_CONNECTING,
|
||||
STATE_CONNECTED
|
||||
};
|
||||
/** Open a TCP socket connection.
|
||||
|
||||
@param in Pointer to a tcpinfo_t struct to save state into.
|
||||
@param path The address:port to which we should connect to.
|
||||
@return The descriptor for the newly opened socket. Will be below 0 if invalid. */
|
||||
int TCP_Connect(tcpinfo_t *in, string path);
|
||||
|
||||
/** Closes a TCP socket connection.
|
||||
|
||||
@parm in Pointer to a tcpinfo_t that is to be closed. */
|
||||
void TCP_Disconnect(tcpinfo_t *in);
|
||||
|
||||
/** Send a string buffer to a specified TCP connection.
|
||||
|
||||
@param in Pointer to an active TCP connection.
|
||||
@param msg The message to send to the TCP connection. */
|
||||
int TCP_Send(tcpinfo_t *in, string msg);
|
||||
|
||||
/** Receive the latest message from a TCP connection.
|
||||
|
||||
@param in Pointer to an active TCP connection.*/
|
||||
string TCP_Receive(tcpinfo_t *in);
|
||||
|
||||
/* you want to run this every frame */
|
||||
/** You want to run this every frame.
|
||||
|
||||
@param in Pointer to an active TCP connection. */
|
||||
void TCP_Frame(tcpinfo_t *in);
|
||||
|
||||
int TCP_GetState(tcpinfo_t *in);
|
||||
/** Returns the tcpstate_t of a connection.
|
||||
|
||||
@param in Pointer to an active TCP connection.*/
|
||||
tcpstate_t TCP_GetState(tcpinfo_t *in);
|
||||
|
|
|
@ -109,8 +109,11 @@ TCP_Frame(tcpinfo_t *in)
|
|||
memfree((__variant *)out);
|
||||
}
|
||||
|
||||
int
|
||||
tcpstate_t
|
||||
TCP_GetState(tcpinfo_t *in)
|
||||
{
|
||||
if (!in)
|
||||
return STATE_DISCONNECTED;
|
||||
|
||||
return in.m_iState;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*! @file NSGameRules.h
|
||||
@brief Gamerule top level class.
|
||||
|
||||
There's a lot of methods you're allowed to override.
|
||||
*/
|
||||
|
||||
/** This class represents active gamerules. */
|
||||
class NSGameRules:NSIO
|
||||
{
|
||||
|
|
|
@ -311,6 +311,7 @@ NSClientPlayer::ClientInputFrame(void)
|
|||
if (Util_IsPaused())
|
||||
return;
|
||||
|
||||
/* fake spectators want the same input as real ones. */
|
||||
if (IsFakeSpectator()) {
|
||||
NSClientSpectator::ClientInputFrame();
|
||||
return;
|
||||
|
@ -372,7 +373,7 @@ NSClientPlayer::ClientInputFrame(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* compat*/
|
||||
/* compat */
|
||||
if (input_impulse == 201) {
|
||||
sendevent("Spraylogo", "");
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ public:
|
|||
virtual void SpawnKey(string,string);
|
||||
|
||||
#ifdef SERVER
|
||||
|
||||
/** Handles saving a copy of this entity to a given filehandle.
|
||||
Within you want to use the ::SaveFloat() etc. methods to write
|
||||
the internal member attributes to the specified file handle. */
|
||||
|
|
|
@ -375,8 +375,9 @@ public:
|
|||
nonvirtual int GetTriggerCondition(void);
|
||||
/** Call to trigger their targets manually. */
|
||||
virtual void TriggerTargets(void);
|
||||
#endif
|
||||
|
||||
#else
|
||||
#ifdef CLIENT
|
||||
virtual void customphysics(void);
|
||||
virtual float predraw(void);
|
||||
virtual void ReceiveEntity(float,float);
|
||||
|
@ -387,7 +388,9 @@ public:
|
|||
string Sentences_GetSamples(string);
|
||||
string Sentences_ProcessSample(string);
|
||||
void NSMonster_ReadEntity(bool);
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef SERVER
|
||||
void NSMonster_AlertEnemyAlliance(vector pos, float radius, int alliance);
|
||||
entity NSMonster_FindClosestPlayer(entity);
|
||||
#endif
|
||||
|
|
|
@ -83,7 +83,8 @@ public:
|
|||
virtual float SendEntity(entity,float);
|
||||
virtual void Save(float);
|
||||
virtual void Restore(string,string);
|
||||
#else
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
virtual void ReceiveEntity(float,float);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -129,7 +129,9 @@ public:
|
|||
virtual void Restore(string,string);
|
||||
virtual void EvaluateEntity(void);
|
||||
virtual float SendEntity(entity,float);
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
virtual void RenderDebugSkeleton(void);
|
||||
virtual void ReceiveEntity(float,float);
|
||||
virtual float predraw(void);
|
||||
|
|
|
@ -60,8 +60,9 @@ const string g_spray_mat_0 = \
|
|||
"}\n" \
|
||||
"}";
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef SERVER
|
||||
void Spray_RemoveAll(entity entOwner);
|
||||
float Spray_SendEntity(entity ePEnt, float fChanged);
|
||||
void CSEv_Spraylogo(void);
|
||||
|
|
|
@ -85,7 +85,9 @@ public:
|
|||
virtual void ParentUpdate(void);
|
||||
virtual void EvaluateEntity(void);
|
||||
virtual float SendEntity(entity,float);
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
virtual float predraw(void);
|
||||
virtual void ReceiveEntity(float,float);
|
||||
#endif
|
||||
|
@ -131,7 +133,9 @@ public:
|
|||
nonvirtual void SetSurfaceData(string);
|
||||
/** Assigns the prop data of a given description onto this entity. */
|
||||
nonvirtual void SetPropData(string);
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
/** Called every frame to render a fire effect, but will only do so if the entity is burning. */
|
||||
virtual void RenderFire(void);
|
||||
#endif
|
||||
|
|
|
@ -75,7 +75,9 @@ private:
|
|||
string m_talkUnfollow; /* when the player asks us to stop following */
|
||||
string m_talkFollow; /* whenever player asks the NPC to follow */
|
||||
string m_talkStopFollow; /* we have to stop following */
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
/* sentence system */
|
||||
float m_flSentenceTime;
|
||||
sound_t *m_pSentenceQue;
|
||||
|
@ -147,7 +149,9 @@ public:
|
|||
virtual void TalkFollow(void);
|
||||
/** Called when they tell the player that they'll stop following. */
|
||||
virtual void TalkStopFollow(void);
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
virtual float predraw(void);
|
||||
virtual void ReceiveEntity(float,float);
|
||||
|
||||
|
|
|
@ -134,7 +134,9 @@ private:
|
|||
|
||||
/* legacy trigger architecture */
|
||||
float m_flDelay;
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
float team;
|
||||
#endif
|
||||
};
|
|
@ -49,7 +49,9 @@ public:
|
|||
virtual bool HideViewWeapon(void);
|
||||
virtual bool HideCrosshair(void);
|
||||
virtual bool HidePlayermodel(void);
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef SERVER
|
||||
nonvirtual vector GetExitPos(void);
|
||||
virtual void EvaluateEntity(void);
|
||||
virtual float SendEntity(entity,float);
|
||||
|
|
|
@ -52,7 +52,7 @@ Colors_RGB8_to_HEX(vector color)
|
|||
return out;
|
||||
}
|
||||
|
||||
/* Takes a 0-255 based color vector and returns the hexadecimal equivalent
|
||||
/** Takes a 0-255 based color vector and returns the hexadecimal equivalent
|
||||
for "funstrings". E.g. '255 0 0' becomes "^xF00". */
|
||||
string
|
||||
Colors_RGB255_to_HEX(vector color)
|
||||
|
|
|
@ -15,29 +15,29 @@
|
|||
*/
|
||||
|
||||
/* engine reserved */
|
||||
#define FL_FLY (1<<0)
|
||||
#define FL_SWIM (1<<1)
|
||||
#define FL_GLIMPSE (1<<2)
|
||||
#define FL_CLIENT (1<<3)
|
||||
#define FL_INWATER (1<<4)
|
||||
#define FL_MONSTER (1<<5)
|
||||
#define FL_GODMODE (1<<6)
|
||||
#define FL_NOTARGET (1<<7)
|
||||
#define FL_ITEM (1<<8)
|
||||
#define FL_ONGROUND (1<<9)
|
||||
#define FL_PARTIALGROUND (1<<10)
|
||||
#define FL_WATERJUMP (1<<11)
|
||||
#define FL_JUMPRELEASED (1<<12)
|
||||
#define FL_FINDABLE_NONSOLID (1<<14)
|
||||
#define FLQW_LAGGEDMOVE (1<<16)
|
||||
#define FL_FLY (1<<0) /**< Entity is flying. */
|
||||
#define FL_SWIM (1<<1) /**< Entity is swimming. */
|
||||
#define FL_GLIMPSE (1<<2) /**< Unused? */
|
||||
#define FL_CLIENT (1<<3) /**< Entity is a client. */
|
||||
#define FL_INWATER (1<<4) /**< Entity is in water. */
|
||||
#define FL_MONSTER (1<<5) /**< Entity is a monster. */
|
||||
#define FL_GODMODE (1<<6) /**< Entity has 'god-mode' enabled. */
|
||||
#define FL_NOTARGET (1<<7) /**< Entity has `notarget` enabled. */
|
||||
#define FL_ITEM (1<<8) /**< Entity is an item. */
|
||||
#define FL_ONGROUND (1<<9) /**< Entity is standing on ground. */
|
||||
#define FL_PARTIALGROUND (1<<10) /**< Entity is (partially) on ground. */
|
||||
#define FL_WATERJUMP (1<<11) /**< Entity is within a water-jump moment. */
|
||||
#define FL_JUMPRELEASED (1<<12) /**< Entity has let go off the jump button. */
|
||||
#define FL_FINDABLE_NONSOLID (1<<14) /**< Entity is findable by find() calls, even when not-solid. */
|
||||
#define FLQW_LAGGEDMOVE (1<<16) /**< Entity will move with lag compenstation. */
|
||||
|
||||
/* nuclide */
|
||||
#define FL_ONLADDER (1<<13)
|
||||
#define FL_CROUCHING (1<<17)
|
||||
#define FL_INVEHICLE (1<<18)
|
||||
#define FL_FROZEN (1<<19)
|
||||
#define FL_USE_RELEASED (1<<20)
|
||||
#define FL_FAKESPEC (1<<21)
|
||||
#define FL_ONUSABLE (1<<22)
|
||||
#define FL_ONFIRE (1<<23)
|
||||
#define FL_GOALITEM (1<<15)
|
||||
#define FL_ONLADDER (1<<13) /**< Entity is attached to a ladder. */
|
||||
#define FL_CROUCHING (1<<17) /**< Entity is crouching. */
|
||||
#define FL_INVEHICLE (1<<18) /**< Entity is inside a vehicle. */
|
||||
#define FL_FROZEN (1<<19) /**< Entity is not allowed to move. */
|
||||
#define FL_USE_RELEASED (1<<20) /**< Entity has release the +use button. */
|
||||
#define FL_FAKESPEC (1<<21) /**< Entity is a fake spectator. */
|
||||
#define FL_ONUSABLE (1<<22) /**< Entity is able to +use a thing. */
|
||||
#define FL_ONFIRE (1<<23) /**< Entity is on fire. */
|
||||
#define FL_GOALITEM (1<<15) /**< Entity is a goal-item. */
|
||||
|
|
251
src/vgui/ui.qc
251
src/vgui/ui.qc
|
@ -14,6 +14,23 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* compatibility wrappers */
|
||||
#define CUI3DView VGUI3DView
|
||||
#define CUIButton VGUIButton
|
||||
#define CUICheckbox VGUICheckbox
|
||||
#define CUILabel VGUILabel
|
||||
#define CUIList VGUIList
|
||||
#define CUIListBox VGUIListBox
|
||||
#define CUIMenuButton VGUIMenuButton
|
||||
#define CUIPic VGUIPic
|
||||
#define CUIRadio VGUIRadio
|
||||
#define CUIScrollbar VGUIScrollbar
|
||||
#define CUISlider VGUISlider
|
||||
#define CUITabView VGUITabView
|
||||
#define CUITextBox VGUITextBox
|
||||
#define CUIWidget VGUIWidget
|
||||
#define CUIWindow VGUIWindow
|
||||
|
||||
font_s g_fntDefault;
|
||||
var int g_vguiWidgetCount;
|
||||
|
||||
|
@ -29,12 +46,14 @@ var int g_vguiWidgetCount;
|
|||
var float UI_MAINALPHA;
|
||||
#endif
|
||||
|
||||
/** Return whether a VGUI panel is active on the 2D overlay level. */
|
||||
int
|
||||
VGUI_Active(void)
|
||||
{
|
||||
return (g_vguiWidgetCount > 0) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/** Returns whether our mouse cursor is in a specific region of the screen. */
|
||||
int
|
||||
Util_MouseAbove(vector vecMousePos, vector vecPos, vector vecSize)
|
||||
{
|
||||
|
@ -46,75 +65,229 @@ Util_MouseAbove(vector vecMousePos, vector vecPos, vector vecSize)
|
|||
return (0);
|
||||
}
|
||||
|
||||
class CUIWidget
|
||||
/** @brief The base VGUI widget class.
|
||||
|
||||
Every VGUI widget is based off of this. */
|
||||
class VGUIWidget
|
||||
{
|
||||
public:
|
||||
void VGUIWidget(void);
|
||||
|
||||
/** Adds a widget into this one. */
|
||||
nonvirtual void Add(VGUIWidget);
|
||||
/** Add a flag to the widget. */
|
||||
nonvirtual void FlagAdd(int);
|
||||
/** Remove a flag from the widget. */
|
||||
nonvirtual void FlagRemove(int);
|
||||
/** Set the position within its context. */
|
||||
nonvirtual void SetPos(vector);
|
||||
/** Return the position of the widget within its context. */
|
||||
nonvirtual vector GetPos(void);
|
||||
/** Returns the X coordinate of the widget position within its context. */
|
||||
nonvirtual int GetPosWidth(void);
|
||||
/** Returns the Y coordinate of the widget position within its context. */
|
||||
nonvirtual int GetPosHeight(void);
|
||||
|
||||
/** Set the size of the widget to a new one. */
|
||||
nonvirtual void SetSize(vector);
|
||||
/** Returns the size of the widget, in pixels. */
|
||||
nonvirtual vector GetSize(void);
|
||||
|
||||
/** Returns the width of the widget, in pixels. */
|
||||
nonvirtual int GetSizeWidth(void);
|
||||
/** Returns the height of the widget, in pixels. */
|
||||
nonvirtual int GetSizeHeight(void);
|
||||
|
||||
/** Sets the minimum size of the widget. */
|
||||
nonvirtual void SetMinSize(vector);
|
||||
/** Returns the minimum size of the widget. */
|
||||
nonvirtual vector GetMinSize(void);
|
||||
|
||||
/** Sets the maximum size of the widget. */
|
||||
nonvirtual void SetMaxSize(vector);
|
||||
/** Returns the maximum size of the widget. */
|
||||
nonvirtual vector GetMaxSize(void);
|
||||
|
||||
/** Returns true/false depending on if the widget is visible. */
|
||||
nonvirtual bool Visible(void);
|
||||
/** Show the widget. */
|
||||
nonvirtual void Show(void);
|
||||
/** Hide the widget. */
|
||||
nonvirtual void Hide(void);
|
||||
|
||||
/** Called when the position of the widget was changed in any capacity. */
|
||||
virtual void PositionChanged(vector, vector);
|
||||
/** Called when the size of the widget has changed in any capacity. */
|
||||
virtual void SizeChanged(vector, vector);
|
||||
|
||||
/** Called in order to draw the widget. */
|
||||
virtual void Draw(void);
|
||||
/** Called whenever the physical properties of the display change. */
|
||||
virtual void Reposition(void);
|
||||
/** Called whenever an input event gets directed to the widget. */
|
||||
virtual bool Input(float, float, float, float);
|
||||
/** Called when the widget has fully initialized.
|
||||
When you override this, you may call `super::Spawned();` to ensure
|
||||
the parent classes get to finish initializing also. */
|
||||
virtual void Spawned(void);
|
||||
|
||||
private:
|
||||
vector m_vecOrigin;
|
||||
CUIWidget m_next;
|
||||
CUIWidget m_parent;
|
||||
vector m_vecSize;
|
||||
vector m_vecMinSize;
|
||||
vector m_vecMaxSize;
|
||||
VGUIWidget m_next;
|
||||
VGUIWidget m_parent;
|
||||
int m_iFlags;
|
||||
|
||||
void(void) CUIWidget;
|
||||
|
||||
virtual void(CUIWidget) Add;
|
||||
virtual void(int) FlagAdd;
|
||||
virtual void(int) FlagRemove;
|
||||
virtual void(vector) SetPos;
|
||||
virtual vector() GetPos;
|
||||
virtual int(void) GetPosWidth;
|
||||
virtual int(void) GetPosHeight;
|
||||
virtual void(void) Draw;
|
||||
virtual void(void) Reposition;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
virtual void(void) Spawned;
|
||||
bool m_bVisible;
|
||||
};
|
||||
|
||||
void
|
||||
CUIWidget::SetPos(vector vecPos)
|
||||
VGUIWidget::VGUIWidget(void)
|
||||
{
|
||||
m_vecOrigin = vecPos;
|
||||
m_vecOrigin = [0.0f, 0.0f];
|
||||
m_vecSize = [0.0f, 0.0f];
|
||||
m_vecMinSize = [0.0f, 0.0f];
|
||||
m_vecMaxSize = [9999.0f, 9999.0f];
|
||||
m_next = __NULL__;
|
||||
m_parent = __NULL__;
|
||||
m_iFlags = 0i;
|
||||
m_bVisible = true;
|
||||
|
||||
Spawned();
|
||||
}
|
||||
|
||||
bool
|
||||
VGUIWidget::Visible(void)
|
||||
{
|
||||
return m_bVisible;
|
||||
}
|
||||
|
||||
void
|
||||
VGUIWidget::Hide(void)
|
||||
{
|
||||
m_bVisible = false;
|
||||
}
|
||||
|
||||
void
|
||||
VGUIWidget::Show(void)
|
||||
{
|
||||
m_bVisible = true;
|
||||
}
|
||||
|
||||
void
|
||||
VGUIWidget::PositionChanged(vector vecOld, vector vecNew)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
VGUIWidget::SizeChanged(vector vecOld, vector vecNew)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
VGUIWidget::SetPos(vector vecNewPos)
|
||||
{
|
||||
m_vecOrigin[0] = bound(0, vecNewPos[0], video_res[0] - 32);
|
||||
m_vecOrigin[1] = bound(0, vecNewPos[1], video_res[1] - 32);
|
||||
}
|
||||
|
||||
vector
|
||||
CUIWidget::GetPos(void)
|
||||
VGUIWidget::GetPos(void)
|
||||
{
|
||||
return m_vecOrigin;
|
||||
}
|
||||
|
||||
int
|
||||
CUIWidget::GetPosWidth(void)
|
||||
VGUIWidget::GetPosWidth(void)
|
||||
{
|
||||
return m_vecOrigin[0];
|
||||
}
|
||||
|
||||
int
|
||||
CUIWidget::GetPosHeight(void)
|
||||
VGUIWidget::GetPosHeight(void)
|
||||
{
|
||||
return m_vecOrigin[1];
|
||||
}
|
||||
|
||||
void
|
||||
CUIWidget::FlagAdd(int iFlag)
|
||||
VGUIWidget::SetSize(vector vecNewSize)
|
||||
{
|
||||
vector vecOld = m_vecSize;
|
||||
m_vecSize = vecNewSize;
|
||||
m_vecSize[0] = bound(m_vecMinSize[0], vecNewSize[0], m_vecMaxSize[0]);
|
||||
m_vecSize[1] = bound(m_vecMinSize[1], vecNewSize[1], m_vecMaxSize[1]);
|
||||
|
||||
SizeChanged(vecOld, m_vecSize);
|
||||
}
|
||||
|
||||
vector
|
||||
VGUIWidget::GetSize(void)
|
||||
{
|
||||
return m_vecSize;
|
||||
}
|
||||
|
||||
int
|
||||
VGUIWidget::GetSizeWidth(void)
|
||||
{
|
||||
return m_vecSize[0];
|
||||
}
|
||||
|
||||
int
|
||||
VGUIWidget::GetSizeHeight(void)
|
||||
{
|
||||
return m_vecSize[1];
|
||||
}
|
||||
|
||||
void
|
||||
VGUIWidget::SetMinSize (vector vecNewSize)
|
||||
{
|
||||
m_vecMinSize = vecNewSize;
|
||||
}
|
||||
|
||||
vector
|
||||
VGUIWidget::GetMinSize(void)
|
||||
{
|
||||
return m_vecMinSize;
|
||||
}
|
||||
|
||||
void
|
||||
VGUIWidget::SetMaxSize (vector vecNewSize)
|
||||
{
|
||||
m_vecMaxSize = vecNewSize;
|
||||
}
|
||||
|
||||
vector
|
||||
VGUIWidget::GetMaxSize(void)
|
||||
{
|
||||
return m_vecMaxSize;
|
||||
}
|
||||
|
||||
void
|
||||
VGUIWidget::FlagAdd(int iFlag)
|
||||
{
|
||||
m_iFlags |= iFlag;
|
||||
}
|
||||
|
||||
void
|
||||
CUIWidget::FlagRemove(int iFlag)
|
||||
VGUIWidget::FlagRemove(int iFlag)
|
||||
{
|
||||
m_iFlags -= (m_iFlags & iFlag);
|
||||
}
|
||||
|
||||
void
|
||||
CUIWidget::Reposition(void)
|
||||
VGUIWidget::Reposition(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
CUIWidget::Add(CUIWidget wNew)
|
||||
VGUIWidget::Add(VGUIWidget wNew)
|
||||
{
|
||||
CUIWidget wNext = this;
|
||||
CUIWidget wParent;
|
||||
VGUIWidget wNext = this;
|
||||
VGUIWidget wParent;
|
||||
do {
|
||||
wParent = wNext;
|
||||
wNext = wNext.m_next;
|
||||
|
@ -124,9 +297,9 @@ CUIWidget::Add(CUIWidget wNew)
|
|||
}
|
||||
|
||||
void
|
||||
CUIWidget::Draw(void)
|
||||
VGUIWidget::Draw(void)
|
||||
{
|
||||
CUIWidget wNext = this;
|
||||
VGUIWidget wNext = this;
|
||||
g_vguiWidgetCount = 0;
|
||||
do {
|
||||
wNext = wNext.m_next;
|
||||
|
@ -139,13 +312,13 @@ CUIWidget::Draw(void)
|
|||
|
||||
typedef struct
|
||||
{
|
||||
CUIWidget member;
|
||||
VGUIWidget member;
|
||||
} vgui_input_scene_t;
|
||||
|
||||
bool
|
||||
CUIWidget::Input(float flEVType, float flKey, float flChar, float flDevID)
|
||||
VGUIWidget::Input(float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
CUIWidget wNext = this;
|
||||
VGUIWidget wNext = this;
|
||||
|
||||
/* this is garbage, but it'll work */
|
||||
int c = 0;
|
||||
|
@ -181,16 +354,10 @@ CUIWidget::Input(float flEVType, float flKey, float flChar, float flDevID)
|
|||
}
|
||||
|
||||
void
|
||||
CUIWidget::Spawned(void)
|
||||
VGUIWidget::Spawned(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CUIWidget::CUIWidget(void)
|
||||
{
|
||||
Spawned();
|
||||
}
|
||||
|
||||
void
|
||||
UISystem_Init(void)
|
||||
{
|
||||
|
@ -233,7 +400,7 @@ UISystem_Init(void)
|
|||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
CUIWidget
|
||||
VGUIWidget
|
||||
UIClass_Spawn(string cname)
|
||||
{
|
||||
string func = strcat("spawnfunc_", cname);
|
||||
|
@ -242,7 +409,7 @@ UIClass_Spawn(string cname)
|
|||
entity oldself = self;
|
||||
void(void) vFunc;
|
||||
vFunc = externvalue(-2, func);
|
||||
CUIWidget new_uiclass = spawn(CUIWidget);
|
||||
VGUIWidget new_uiclass = spawn(VGUIWidget);
|
||||
self = new_uiclass;
|
||||
vFunc();
|
||||
self = oldself;
|
||||
|
|
|
@ -26,30 +26,38 @@ enumflags
|
|||
VIEW_VISIBLE
|
||||
};
|
||||
|
||||
class CUI3DView:CUIWidget
|
||||
class VGUI3DView:VGUIWidget
|
||||
{
|
||||
vector m_vecSize;
|
||||
public:
|
||||
void VGUI3DView(void);
|
||||
|
||||
/** Return the 3D-space position our camera within the 3D view is located at. */
|
||||
nonvirtual vector Get3DPos(void);
|
||||
/** Return the angle that the camera within the 3D view is aiming at. */
|
||||
nonvirtual vector Get3DAngles(void);
|
||||
/** Sets the position of the camera within the 3D-space. */
|
||||
nonvirtual void Set3DPos(vector);
|
||||
/** Sets the angle of the camera within the 3D-space. */
|
||||
nonvirtual void Set3DAngles(vector);
|
||||
/** Sets the function to call in order to draw the scene. */
|
||||
nonvirtual void SetDrawFunc(void(void));
|
||||
/** Sets the function to call for when input events happen within the 3D view. */
|
||||
nonvirtual void SetInputFunc(float(float, float, float, float));
|
||||
|
||||
/* overrides */
|
||||
virtual void Draw(void);
|
||||
virtual bool Input(float, float, float, float);
|
||||
|
||||
private:
|
||||
vector m_vec3DPos;
|
||||
vector m_vec3DAngles;
|
||||
float m_flFOV;
|
||||
|
||||
void(void) CUI3DView;
|
||||
virtual void(void) m_vDrawFunc = 0;
|
||||
virtual float(float, float, float, float) m_vInputFunc = 0;
|
||||
virtual void(void) Draw;
|
||||
virtual vector() GetSize;
|
||||
virtual vector() Get3DPos;
|
||||
virtual vector() Get3DAngles;
|
||||
virtual void(vector) SetSize;
|
||||
virtual void(vector) Set3DPos;
|
||||
virtual void(vector) Set3DAngles;
|
||||
virtual void(void(void)) SetDrawFunc;
|
||||
virtual void(float(float, float, float, float)) SetInputFunc;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
};
|
||||
|
||||
void
|
||||
CUI3DView::CUI3DView(void)
|
||||
VGUI3DView::VGUI3DView(void)
|
||||
{
|
||||
m_flFOV = 90;
|
||||
m_vecSize = [64,64];
|
||||
|
@ -58,55 +66,43 @@ CUI3DView::CUI3DView(void)
|
|||
}
|
||||
|
||||
void
|
||||
CUI3DView::SetSize(vector vecSize)
|
||||
{
|
||||
m_vecSize = vecSize;
|
||||
}
|
||||
|
||||
vector
|
||||
CUI3DView::GetSize(void)
|
||||
{
|
||||
return m_vecSize;
|
||||
}
|
||||
|
||||
void
|
||||
CUI3DView::Set3DAngles(vector vecAngles)
|
||||
VGUI3DView::Set3DAngles(vector vecAngles)
|
||||
{
|
||||
m_vec3DAngles = vecAngles;
|
||||
}
|
||||
|
||||
vector
|
||||
CUI3DView::Get3DAngles(void)
|
||||
VGUI3DView::Get3DAngles(void)
|
||||
{
|
||||
return m_vec3DAngles;
|
||||
}
|
||||
|
||||
void
|
||||
CUI3DView::Set3DPos(vector vecPos)
|
||||
VGUI3DView::Set3DPos(vector vecPos)
|
||||
{
|
||||
m_vec3DPos = vecPos;
|
||||
}
|
||||
|
||||
vector
|
||||
CUI3DView::Get3DPos(void)
|
||||
VGUI3DView::Get3DPos(void)
|
||||
{
|
||||
return m_vec3DPos;
|
||||
}
|
||||
|
||||
void
|
||||
CUI3DView::SetDrawFunc(void(void) vFunc)
|
||||
VGUI3DView::SetDrawFunc(void(void) vFunc)
|
||||
{
|
||||
m_vDrawFunc = vFunc;
|
||||
}
|
||||
|
||||
void
|
||||
CUI3DView::SetInputFunc(float(float, float, float, float) vFunc)
|
||||
VGUI3DView::SetInputFunc(float(float, float, float, float) vFunc)
|
||||
{
|
||||
m_vInputFunc = vFunc;
|
||||
}
|
||||
|
||||
void
|
||||
CUI3DView::Draw(void)
|
||||
VGUI3DView::Draw(void)
|
||||
{
|
||||
if (!m_vDrawFunc) {
|
||||
return;
|
||||
|
@ -122,7 +118,7 @@ CUI3DView::Draw(void)
|
|||
}
|
||||
|
||||
bool
|
||||
CUI3DView::Input(float flEVType, float flKey, float flChar, float flDevID)
|
||||
VGUI3DView::Input(float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
if (!m_vInputFunc) {
|
||||
return false;
|
||||
|
|
|
@ -22,42 +22,42 @@ enumflags
|
|||
BUTTON_LASTACTIVE
|
||||
};
|
||||
|
||||
class CUIButton:CUIWidget
|
||||
class VGUIButton:VGUIWidget
|
||||
{
|
||||
public:
|
||||
void VGUIButton(void);
|
||||
|
||||
/** Sets the title of the button. */
|
||||
nonvirtual void SetTitle(string);
|
||||
/** Sets the icon of the button. */
|
||||
nonvirtual void SetIcon(string);
|
||||
/** Sets the color of the button text. */
|
||||
nonvirtual void SetColor(vector);
|
||||
/** Sets the color of the icon on the button. */
|
||||
nonvirtual void SetIconColor(vector);
|
||||
/** Sets the function to call when the button is pressed. */
|
||||
nonvirtual void SetFunc(void(void));
|
||||
/** Sets the command to execute when the button is pressed. */
|
||||
nonvirtual void SetExec(string);
|
||||
|
||||
/* overrides */
|
||||
virtual void Draw(void);
|
||||
virtual bool Input(float,float,float,float);
|
||||
|
||||
private:
|
||||
vector m_vecIMGSize;
|
||||
vector m_vecColor;
|
||||
vector m_vecIconColor;
|
||||
float m_flAlpha;
|
||||
vector m_vecSize;
|
||||
string m_strTitle;
|
||||
string m_strTitleActive;
|
||||
string m_strIcon;
|
||||
string m_strExec;
|
||||
virtual void m_vFunc(void) = 0;
|
||||
|
||||
public:
|
||||
void CUIButton(void);
|
||||
|
||||
virtual void Draw(void);
|
||||
virtual vector GetSize(void);
|
||||
virtual int GetSizeWidth(void);
|
||||
virtual int GetSizeHeight(void);
|
||||
virtual void SetSize(vector);
|
||||
virtual void SetTitle(string);
|
||||
virtual void SetIcon(string);
|
||||
virtual void SetColor(vector);
|
||||
virtual void SetIconColor(vector);
|
||||
virtual void SetFunc(void(void));
|
||||
virtual void SetExec(string);
|
||||
virtual bool Input(float,float,float,float);
|
||||
virtual void Show(void);
|
||||
virtual void Hide(void);
|
||||
|
||||
};
|
||||
|
||||
void
|
||||
CUIButton::CUIButton(void)
|
||||
VGUIButton::VGUIButton(void)
|
||||
{
|
||||
m_vecColor = UI_MAINCOLOR;
|
||||
m_flAlpha = 1.0f;
|
||||
|
@ -67,43 +67,25 @@ CUIButton::CUIButton(void)
|
|||
}
|
||||
|
||||
void
|
||||
CUIButton::SetColor(vector vecColor)
|
||||
VGUIButton::SetColor(vector vecColor)
|
||||
{
|
||||
m_vecColor = vecColor;
|
||||
}
|
||||
|
||||
void
|
||||
CUIButton::SetIconColor(vector vecColor)
|
||||
VGUIButton::SetIconColor(vector vecColor)
|
||||
{
|
||||
m_vecIconColor = vecColor;
|
||||
};
|
||||
|
||||
void
|
||||
CUIButton::SetSize(vector vecSize)
|
||||
VGUIButton::SetSize(vector vecSize)
|
||||
{
|
||||
m_vecSize = vecSize;
|
||||
}
|
||||
|
||||
vector
|
||||
CUIButton::GetSize(void)
|
||||
{
|
||||
return m_vecSize;
|
||||
}
|
||||
|
||||
int
|
||||
CUIButton::GetSizeWidth(void)
|
||||
{
|
||||
return m_vecSize[0];
|
||||
}
|
||||
|
||||
int
|
||||
CUIButton::GetSizeHeight(void)
|
||||
{
|
||||
return m_vecSize[1];
|
||||
}
|
||||
|
||||
void
|
||||
CUIButton::SetTitle(string strName)
|
||||
VGUIButton::SetTitle(string strName)
|
||||
{
|
||||
vector newsize = [0.0f, 0.0f, 0.0f];
|
||||
|
||||
|
@ -116,7 +98,7 @@ CUIButton::SetTitle(string strName)
|
|||
SetSize(newsize);
|
||||
}
|
||||
void
|
||||
CUIButton::SetIcon(string strName)
|
||||
VGUIButton::SetIcon(string strName)
|
||||
{
|
||||
m_strIcon = strName;
|
||||
m_vecIMGSize = drawgetimagesize(strName);
|
||||
|
@ -126,31 +108,20 @@ CUIButton::SetIcon(string strName)
|
|||
}
|
||||
}
|
||||
void
|
||||
CUIButton::SetFunc(void(void) vFunc)
|
||||
VGUIButton::SetFunc(void(void) vFunc)
|
||||
{
|
||||
m_vFunc = vFunc;
|
||||
}
|
||||
void
|
||||
CUIButton::SetExec(string exe)
|
||||
VGUIButton::SetExec(string exe)
|
||||
{
|
||||
m_strExec = exe;
|
||||
}
|
||||
|
||||
void
|
||||
CUIButton::Show(void)
|
||||
VGUIButton::Draw(void)
|
||||
{
|
||||
m_iFlags |= BUTTON_VISIBLE;
|
||||
}
|
||||
void
|
||||
CUIButton::Hide(void)
|
||||
{
|
||||
m_iFlags -= (m_iFlags & BUTTON_VISIBLE);
|
||||
}
|
||||
|
||||
void
|
||||
CUIButton::Draw(void)
|
||||
{
|
||||
if (!(m_iFlags & BUTTON_VISIBLE))
|
||||
if (!Visible())
|
||||
return;
|
||||
|
||||
#ifndef CLASSIC_VGUI
|
||||
|
@ -193,11 +164,11 @@ CUIButton::Draw(void)
|
|||
}
|
||||
|
||||
bool
|
||||
CUIButton::Input(float flEVType, float flKey, float flChar, float flDevID)
|
||||
VGUIButton::Input(float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if (!(m_iFlags & BUTTON_VISIBLE))
|
||||
if (!Visible())
|
||||
return false;
|
||||
|
||||
if (flEVType == IE_KEYDOWN) {
|
||||
|
|
|
@ -22,23 +22,25 @@ enumflags
|
|||
CHECKBOX_CHECKED
|
||||
};
|
||||
|
||||
class CUICheckbox:CUIWidget
|
||||
class VGUICheckbox:VGUIWidget
|
||||
{
|
||||
public:
|
||||
void VGUICheckbox(void);
|
||||
|
||||
nonvirtual void SetTitle(string);
|
||||
nonvirtual int GetValue(void);
|
||||
nonvirtual void SetValue(int);
|
||||
|
||||
virtual void Draw(void);
|
||||
virtual bool Input(float, float, float, float);
|
||||
|
||||
private:
|
||||
vector m_vecColor;
|
||||
float m_flAlpha;
|
||||
vector m_vecSize;
|
||||
string m_strTitle;
|
||||
|
||||
void(void) CUICheckbox;
|
||||
virtual void(void) Draw;
|
||||
virtual void(vector) SetSize;
|
||||
virtual void(string) SetTitle;
|
||||
virtual int(void) GetValue;
|
||||
virtual void(int) SetValue;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
};
|
||||
|
||||
void CUICheckbox::CUICheckbox(void)
|
||||
void VGUICheckbox::VGUICheckbox(void)
|
||||
{
|
||||
m_vecColor = UI_MAINCOLOR;
|
||||
m_flAlpha = 1.0f;
|
||||
|
@ -46,15 +48,11 @@ void CUICheckbox::CUICheckbox(void)
|
|||
m_iFlags = CHECKBOX_VISIBLE;
|
||||
}
|
||||
|
||||
void CUICheckbox::SetSize (vector vecSize)
|
||||
{
|
||||
m_vecSize = vecSize;
|
||||
}
|
||||
void CUICheckbox::SetTitle (string strName)
|
||||
void VGUICheckbox::SetTitle (string strName)
|
||||
{
|
||||
m_strTitle = strName;
|
||||
}
|
||||
int CUICheckbox::GetValue(void)
|
||||
int VGUICheckbox::GetValue(void)
|
||||
{
|
||||
if (m_iFlags & CHECKBOX_CHECKED) {
|
||||
return (1);
|
||||
|
@ -62,7 +60,7 @@ int CUICheckbox::GetValue(void)
|
|||
return (0);
|
||||
}
|
||||
}
|
||||
void CUICheckbox::SetValue (int iValue)
|
||||
void VGUICheckbox::SetValue (int iValue)
|
||||
{
|
||||
if (iValue == TRUE) {
|
||||
m_iFlags |= CHECKBOX_CHECKED;
|
||||
|
@ -71,7 +69,7 @@ void CUICheckbox::SetValue (int iValue)
|
|||
}
|
||||
}
|
||||
|
||||
void CUICheckbox::Draw(void)
|
||||
void VGUICheckbox::Draw(void)
|
||||
{
|
||||
#ifndef CLASSIC_VGUI
|
||||
drawfill(m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, m_vecColor, m_flAlpha);
|
||||
|
@ -107,7 +105,7 @@ void CUICheckbox::Draw(void)
|
|||
}
|
||||
}
|
||||
|
||||
bool CUICheckbox::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
bool VGUICheckbox::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
|
|
|
@ -14,29 +14,29 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
class CUILabel:CUIWidget
|
||||
class VGUILabel:VGUIWidget
|
||||
{
|
||||
vector m_vecSize;
|
||||
public:
|
||||
void VGUILabel(void);
|
||||
|
||||
nonvirtual void SetTitle(string);
|
||||
|
||||
virtual void Draw(void);
|
||||
virtual bool Input(float, float, float, float);
|
||||
|
||||
private:
|
||||
string m_strTitle;
|
||||
|
||||
void(void) CUILabel;
|
||||
virtual void(void) Draw;
|
||||
virtual void(vector) SetSize;
|
||||
virtual void(string) SetTitle;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
};
|
||||
|
||||
void CUILabel::CUILabel(void)
|
||||
void
|
||||
VGUILabel::VGUILabel(void)
|
||||
{
|
||||
m_vecSize = [96,16];
|
||||
m_iFlags = BUTTON_VISIBLE;
|
||||
}
|
||||
|
||||
void CUILabel::SetSize (vector vecSize)
|
||||
{
|
||||
m_vecSize = vecSize;
|
||||
}
|
||||
void CUILabel::SetTitle (string strName)
|
||||
void
|
||||
VGUILabel::SetTitle (string strName)
|
||||
{
|
||||
#ifndef CLASSIC_VGUI
|
||||
m_strTitle = strName;
|
||||
|
@ -49,14 +49,17 @@ void CUILabel::SetTitle (string strName)
|
|||
* in engines' textfield thing in combo with ttf. */
|
||||
SetSize([2 + stringwidth(m_strTitle, TRUE, [g_fntDefault.iScaleX, g_fntDefault.iScaleY]), 16]);
|
||||
}
|
||||
void CUILabel::Draw(void)
|
||||
|
||||
void
|
||||
VGUILabel::Draw(void)
|
||||
{
|
||||
if (m_strTitle) {
|
||||
Font_DrawField(m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, m_strTitle, g_fntDefault, 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool CUILabel::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
bool
|
||||
VGUILabel::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -14,51 +14,48 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
class CUIList:CUIWidget
|
||||
class VGUIList:VGUIWidget
|
||||
{
|
||||
vector m_vecSize;
|
||||
public:
|
||||
void VGUIList(void);
|
||||
|
||||
nonvirtual void SetOffset(int,int);
|
||||
|
||||
nonvirtual void SetSelected(int);
|
||||
nonvirtual int GetSelected(void);
|
||||
|
||||
nonvirtual int GetMaxVisibleItems(void);
|
||||
|
||||
nonvirtual void AddItem(string);
|
||||
nonvirtual string GetItem(int);
|
||||
|
||||
nonvirtual void SetItemCount(int);
|
||||
nonvirtual int GetItemCount(void);
|
||||
|
||||
nonvirtual int GetOffset(void);
|
||||
|
||||
nonvirtual void CallOnScroll(void(void));
|
||||
|
||||
virtual void Draw(void);
|
||||
virtual bool Input(float, float, float, float);
|
||||
|
||||
private:
|
||||
string m_strTitle;
|
||||
string *m_strItems;
|
||||
int m_iItemCount;
|
||||
int m_iSelected;
|
||||
int m_iDrawOffset;
|
||||
|
||||
void(void) CUIList;
|
||||
|
||||
virtual void(void) m_vScrollCB = 0;
|
||||
|
||||
virtual void(vector) SetSize;
|
||||
virtual void(int, int) SetOffset;
|
||||
|
||||
virtual void(int) SetSelected;
|
||||
virtual int(void) GetSelected;
|
||||
|
||||
virtual int(void) GetMaxVisibleItems;
|
||||
|
||||
virtual void(string) AddItem;
|
||||
virtual string(int) GetItem;
|
||||
|
||||
virtual void(int) SetItemCount;
|
||||
virtual int(void) GetItemCount;
|
||||
|
||||
|
||||
virtual int(void) GetOffset;
|
||||
virtual vector(void) GetSize;
|
||||
|
||||
virtual void(void(void)) CallOnScroll;
|
||||
|
||||
virtual void(void) Draw;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
};
|
||||
|
||||
void CUIList::CUIList(void)
|
||||
void VGUIList::VGUIList(void)
|
||||
{
|
||||
m_vecSize = [96,16];
|
||||
m_iFlags = 1;
|
||||
m_iSelected = -1;
|
||||
}
|
||||
|
||||
void CUIList::Draw(void)
|
||||
void VGUIList::Draw(void)
|
||||
{
|
||||
int iMaxDisplay;
|
||||
if (!m_iItemCount) {
|
||||
|
@ -100,7 +97,7 @@ void CUIList::Draw(void)
|
|||
drawresetcliparea();
|
||||
}
|
||||
|
||||
bool CUIList::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
bool VGUIList::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
bool ret = false;
|
||||
int iMaxDisplay;
|
||||
|
@ -128,22 +125,13 @@ bool CUIList::Input (float flEVType, float flKey, float flChar, float flDevID)
|
|||
return (ret);
|
||||
}
|
||||
|
||||
void CUIList::SetSize (vector vecSize)
|
||||
{
|
||||
m_vecSize = vecSize;
|
||||
}
|
||||
vector CUIList::GetSize(void)
|
||||
{
|
||||
return m_vecSize;
|
||||
}
|
||||
|
||||
int CUIList::GetMaxVisibleItems(void)
|
||||
int VGUIList::GetMaxVisibleItems(void)
|
||||
{
|
||||
int iMaxDisplay = bound(0, m_iItemCount, floor(m_vecSize[1] / 20));
|
||||
return m_iItemCount - iMaxDisplay;
|
||||
}
|
||||
|
||||
void CUIList::SetOffset (int iOffset, int iCallBack)
|
||||
void VGUIList::SetOffset (int iOffset, int iCallBack)
|
||||
{
|
||||
int iMaxDisplay = bound(0, m_iItemCount, floor(m_vecSize[1] / 20));
|
||||
m_iDrawOffset = bound(0, iOffset, m_iItemCount - iMaxDisplay);
|
||||
|
@ -152,59 +140,59 @@ void CUIList::SetOffset (int iOffset, int iCallBack)
|
|||
m_vScrollCB();
|
||||
}
|
||||
}
|
||||
int CUIList::GetOffset(void)
|
||||
int VGUIList::GetOffset(void)
|
||||
{
|
||||
return m_iDrawOffset;
|
||||
}
|
||||
|
||||
void CUIList::SetItemCount (int iCount)
|
||||
void VGUIList::SetItemCount (int iCount)
|
||||
{
|
||||
if (!m_iItemCount) {
|
||||
NSLog("CUIList: Initialized with a maximum of %i entries", iCount);
|
||||
NSLog("VGUIList: Initialized with a maximum of %i entries", iCount);
|
||||
m_iItemCount = iCount;
|
||||
m_strItems = memalloc(iCount * sizeof(string));
|
||||
}
|
||||
}
|
||||
int CUIList::GetItemCount(void)
|
||||
int VGUIList::GetItemCount(void)
|
||||
{
|
||||
return m_iItemCount;
|
||||
}
|
||||
|
||||
string CUIList::GetItem (int iIndex)
|
||||
string VGUIList::GetItem (int iIndex)
|
||||
{
|
||||
if (m_iSelected < 0 || m_iItemCount <= 0) {
|
||||
dprint("CUIList: GetItem on empty/unselected list!\n");
|
||||
dprint("VGUIList: GetItem on empty/unselected list!\n");
|
||||
return "ERROR";
|
||||
}
|
||||
return m_strItems[iIndex];
|
||||
}
|
||||
|
||||
void CUIList::SetSelected (int iVal)
|
||||
void VGUIList::SetSelected (int iVal)
|
||||
{
|
||||
m_iSelected = iVal;
|
||||
}
|
||||
int CUIList::GetSelected(void)
|
||||
int VGUIList::GetSelected(void)
|
||||
{
|
||||
return m_iSelected;
|
||||
}
|
||||
|
||||
void CUIList::AddItem (string strItem)
|
||||
void VGUIList::AddItem (string strItem)
|
||||
{
|
||||
if (!m_iItemCount) {
|
||||
dprint("CUIList: Can't add item to empty list!\n");
|
||||
dprint("VGUIList: Can't add item to empty list!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_iItemCount; i++) {
|
||||
if (!m_strItems[i]) {
|
||||
m_strItems[i] = strItem;
|
||||
dprint("CUIList: Item added\n");
|
||||
dprint("VGUIList: Item added\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CUIList::CallOnScroll (void(void) vFunc)
|
||||
void VGUIList::CallOnScroll (void(void) vFunc)
|
||||
{
|
||||
m_vScrollCB = vFunc;
|
||||
}
|
||||
|
|
|
@ -14,78 +14,77 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
class CUIListBox:CUIWidget
|
||||
class VGUIListBox:VGUIWidget
|
||||
{
|
||||
public:
|
||||
void VGUIListBox(void);
|
||||
|
||||
nonvirtual void SetOffset(int);
|
||||
nonvirtual void AddItem(string);
|
||||
nonvirtual void SetItemCount(int);
|
||||
nonvirtual string GetItem(int);
|
||||
nonvirtual int GetSelected(void);
|
||||
|
||||
virtual void Draw(void);
|
||||
virtual bool Input(float, float, float, float);
|
||||
|
||||
private:
|
||||
vector m_vecSize;
|
||||
string m_strTitle;
|
||||
string *m_strItems;
|
||||
int m_iItemCount;
|
||||
int m_iSelected;
|
||||
int m_iDrawOffset;
|
||||
|
||||
void(void) CUIListBox;
|
||||
virtual void(vector) SetSize;
|
||||
virtual void(int) SetOffset;
|
||||
virtual void(string) AddItem;
|
||||
virtual void(int) SetItemCount;
|
||||
virtual string(int) GetItem;
|
||||
virtual int(void) GetSelected;
|
||||
virtual void(void) Draw;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
};
|
||||
|
||||
void CUIListBox::CUIListBox(void)
|
||||
void VGUIListBox::VGUIListBox(void)
|
||||
{
|
||||
m_vecSize = [96,16];
|
||||
m_iFlags = 1;
|
||||
m_iSelected = -1;
|
||||
}
|
||||
|
||||
void CUIListBox::SetSize (vector vecSize)
|
||||
{
|
||||
m_vecSize = vecSize;
|
||||
}
|
||||
void CUIListBox::SetItemCount (int iCount)
|
||||
void VGUIListBox::SetItemCount (int iCount)
|
||||
{
|
||||
if (!m_iItemCount) {
|
||||
NSLog("CUIListBox: Initialized with a maximum of %i entries", iCount);
|
||||
NSLog("VGUIListBox: Initialized with a maximum of %i entries", iCount);
|
||||
m_iItemCount = iCount;
|
||||
m_strItems = memalloc(iCount * sizeof(string));
|
||||
}
|
||||
}
|
||||
void CUIListBox::SetOffset (int iOffset)
|
||||
void VGUIListBox::SetOffset (int iOffset)
|
||||
{
|
||||
int iMaxDisplay = bound(0, m_iItemCount, floor(m_vecSize[1] / 20));
|
||||
m_iDrawOffset = bound(0, iOffset, m_iItemCount - iMaxDisplay);
|
||||
}
|
||||
|
||||
string CUIListBox::GetItem (int iIndex)
|
||||
string VGUIListBox::GetItem (int iIndex)
|
||||
{
|
||||
return m_strItems[iIndex];
|
||||
}
|
||||
|
||||
int CUIListBox::GetSelected(void)
|
||||
int VGUIListBox::GetSelected(void)
|
||||
{
|
||||
return m_iSelected;
|
||||
}
|
||||
|
||||
void CUIListBox::AddItem (string strItem)
|
||||
void VGUIListBox::AddItem (string strItem)
|
||||
{
|
||||
if (!m_iItemCount) {
|
||||
dprint("CUIListBox: Can't add item to empty list!\n");
|
||||
dprint("VGUIListBox: Can't add item to empty list!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_iItemCount; i++) {
|
||||
if (!m_strItems[i]) {
|
||||
m_strItems[i] = strItem;
|
||||
dprint("CUIListBox: Item added\n");
|
||||
dprint("VGUIListBox: Item added\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CUIListBox::Draw(void)
|
||||
void VGUIListBox::Draw(void)
|
||||
{
|
||||
int iMaxDisplay;
|
||||
if (!m_iItemCount) {
|
||||
|
@ -115,7 +114,7 @@ void CUIListBox::Draw(void)
|
|||
}
|
||||
}
|
||||
|
||||
bool CUIListBox::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
bool VGUIListBox::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
bool ret = false;
|
||||
int iMaxDisplay;
|
||||
|
|
|
@ -25,25 +25,30 @@ enumflags
|
|||
MBUTTON_SHOWMP
|
||||
};
|
||||
|
||||
class CUIMenuButton:CUIWidget
|
||||
class
|
||||
VGUIMenuButton:VGUIWidget
|
||||
{
|
||||
public:
|
||||
void VGUIMenuButton(void);
|
||||
|
||||
nonvirtual void SetTitle(string);
|
||||
nonvirtual void SetIcon(string);
|
||||
nonvirtual void SetFunc(void(void));
|
||||
|
||||
virtual void Draw(void);
|
||||
virtual bool Input(float, float, float, float);
|
||||
|
||||
private:
|
||||
vector m_vecColor;
|
||||
float m_flAlpha;
|
||||
vector m_vecSize;
|
||||
string m_strTitle;
|
||||
string m_strIcon;
|
||||
|
||||
void(void) CUIMenuButton;
|
||||
|
||||
virtual void(void) m_vFunc = 0;
|
||||
virtual void(void) Draw;
|
||||
virtual void(vector) SetSize;
|
||||
virtual void(string) SetTitle;
|
||||
virtual void(string) SetIcon;
|
||||
virtual void(void(void)) SetFunc;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
};
|
||||
|
||||
void CUIMenuButton::CUIMenuButton(void)
|
||||
void
|
||||
VGUIMenuButton::VGUIMenuButton(void)
|
||||
{
|
||||
m_vecColor = UI_MAINCOLOR;
|
||||
m_flAlpha = 1.0f;
|
||||
|
@ -51,7 +56,8 @@ void CUIMenuButton::CUIMenuButton(void)
|
|||
m_iFlags = MBUTTON_VISIBLE | MBUTTON_SHOWOFFLINE | MBUTTON_SHOWSP | MBUTTON_SHOWMP;
|
||||
}
|
||||
|
||||
void CUIMenuButton::Draw(void)
|
||||
void
|
||||
VGUIMenuButton::Draw(void)
|
||||
{
|
||||
// If we're not ingame
|
||||
if (clientstate() == 2 && !g_background) {
|
||||
|
@ -101,7 +107,8 @@ void CUIMenuButton::Draw(void)
|
|||
}
|
||||
}
|
||||
|
||||
bool CUIMenuButton::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
bool
|
||||
VGUIMenuButton::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
|
@ -137,19 +144,20 @@ bool CUIMenuButton::Input (float flEVType, float flKey, float flChar, float flDe
|
|||
return (ret);
|
||||
}
|
||||
|
||||
void CUIMenuButton::SetSize (vector vecSize)
|
||||
{
|
||||
m_vecSize = vecSize;
|
||||
}
|
||||
void CUIMenuButton::SetTitle (string strName)
|
||||
void
|
||||
VGUIMenuButton::SetTitle (string strName)
|
||||
{
|
||||
m_strTitle = strName;
|
||||
}
|
||||
void CUIMenuButton::SetIcon (string strName)
|
||||
|
||||
void
|
||||
VGUIMenuButton::SetIcon (string strName)
|
||||
{
|
||||
m_strIcon = strName;
|
||||
}
|
||||
void CUIMenuButton::SetFunc (void(void) vFunc)
|
||||
|
||||
void
|
||||
VGUIMenuButton::SetFunc (void(void) vFunc)
|
||||
{
|
||||
m_vFunc = vFunc;
|
||||
}
|
||||
|
|
|
@ -19,55 +19,51 @@ enumflags
|
|||
IMAGE_VISIBLE
|
||||
};
|
||||
|
||||
class CUIPic:CUIWidget
|
||||
class
|
||||
VGUIPic:VGUIWidget
|
||||
{
|
||||
vector m_vecSize;
|
||||
public:
|
||||
void VGUIPic(void);
|
||||
|
||||
nonvirtual void SetImage(string);
|
||||
nonvirtual string GetImage(void);
|
||||
|
||||
virtual void Draw(void);
|
||||
virtual bool Input(float, float, float, float);
|
||||
|
||||
private:
|
||||
string m_strImage;
|
||||
|
||||
void(void) CUIPic;
|
||||
|
||||
virtual void(vector) SetSize;
|
||||
virtual vector() GetSize;
|
||||
|
||||
virtual void(string) SetImage;
|
||||
virtual string() GetImage;
|
||||
|
||||
virtual void(void) Draw;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
};
|
||||
|
||||
void CUIPic::CUIPic(void)
|
||||
void
|
||||
VGUIPic::VGUIPic(void)
|
||||
{
|
||||
m_vecSize = [16,16];
|
||||
m_iFlags = IMAGE_VISIBLE;
|
||||
}
|
||||
|
||||
void CUIPic::Draw(void)
|
||||
void
|
||||
VGUIPic::Draw(void)
|
||||
{
|
||||
if (m_strImage) {
|
||||
drawpic(m_parent.m_vecOrigin + m_vecOrigin, m_strImage, m_vecSize, [1,1,1], 1.0f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool CUIPic::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
bool
|
||||
VGUIPic::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CUIPic::SetSize (vector vecSize)
|
||||
{
|
||||
m_vecSize = vecSize;
|
||||
}
|
||||
vector CUIPic::GetSize(void)
|
||||
{
|
||||
return m_vecSize;
|
||||
}
|
||||
|
||||
void CUIPic::SetImage (string strName)
|
||||
void
|
||||
VGUIPic::SetImage (string strName)
|
||||
{
|
||||
m_strImage = strName;
|
||||
}
|
||||
string CUIPic::GetImage(void)
|
||||
|
||||
string
|
||||
VGUIPic::GetImage(void)
|
||||
{
|
||||
return m_strImage;
|
||||
}
|
||||
|
|
|
@ -22,25 +22,28 @@ enumflags
|
|||
RADIO_ACTIVE
|
||||
};
|
||||
|
||||
class CUIRadio:CUIWidget
|
||||
class VGUIRadio:VGUIWidget
|
||||
{
|
||||
public:
|
||||
void VGUIRadio(void);
|
||||
|
||||
nonvirtual void SetTitle(string);
|
||||
nonvirtual int GetValue(void);
|
||||
nonvirtual void SetValue(int);
|
||||
nonvirtual void SetFunc(void(void));
|
||||
|
||||
virtual void Draw(void);
|
||||
virtual bool(float, float, float, float) Input;
|
||||
|
||||
private:
|
||||
vector m_vecColor;
|
||||
float m_flAlpha;
|
||||
vector m_vecSize;
|
||||
string m_strTitle;
|
||||
virtual void(void) m_vFunc = 0;
|
||||
|
||||
void(void) CUIRadio;
|
||||
virtual void(void) Draw;
|
||||
virtual void(vector) SetSize;
|
||||
virtual void(string) SetTitle;
|
||||
virtual int(void) GetValue;
|
||||
virtual void(int) SetValue;
|
||||
virtual void(void(void)) SetFunc;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
};
|
||||
|
||||
void CUIRadio::CUIRadio(void)
|
||||
void VGUIRadio::VGUIRadio(void)
|
||||
{
|
||||
m_vecColor = UI_MAINCOLOR;
|
||||
m_flAlpha = 1.0f;
|
||||
|
@ -48,15 +51,12 @@ void CUIRadio::CUIRadio(void)
|
|||
m_iFlags = RADIO_VISIBLE;
|
||||
}
|
||||
|
||||
void CUIRadio::SetSize (vector vecSize)
|
||||
{
|
||||
m_vecSize = vecSize;
|
||||
}
|
||||
void CUIRadio::SetTitle (string strName)
|
||||
|
||||
void VGUIRadio::SetTitle (string strName)
|
||||
{
|
||||
m_strTitle = strName;
|
||||
}
|
||||
int CUIRadio::GetValue(void)
|
||||
int VGUIRadio::GetValue(void)
|
||||
{
|
||||
if (m_iFlags & RADIO_ACTIVE) {
|
||||
return (1);
|
||||
|
@ -64,7 +64,7 @@ int CUIRadio::GetValue(void)
|
|||
return (0);
|
||||
}
|
||||
}
|
||||
void CUIRadio::SetValue (int iValue)
|
||||
void VGUIRadio::SetValue (int iValue)
|
||||
{
|
||||
if (iValue == TRUE) {
|
||||
m_iFlags |= RADIO_ACTIVE;
|
||||
|
@ -72,12 +72,12 @@ void CUIRadio::SetValue (int iValue)
|
|||
m_iFlags -= (m_iFlags & RADIO_ACTIVE);
|
||||
}
|
||||
}
|
||||
void CUIRadio::SetFunc (void(void) vFunc)
|
||||
void VGUIRadio::SetFunc (void(void) vFunc)
|
||||
{
|
||||
m_vFunc = vFunc;
|
||||
}
|
||||
|
||||
void CUIRadio::Draw(void)
|
||||
void VGUIRadio::Draw(void)
|
||||
{
|
||||
#ifndef CLASSIC_VGUI
|
||||
drawfill(m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, m_vecColor, m_flAlpha);
|
||||
|
@ -112,7 +112,7 @@ void CUIRadio::Draw(void)
|
|||
}
|
||||
}
|
||||
|
||||
bool CUIRadio::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
bool VGUIRadio::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
|
|
|
@ -22,8 +22,29 @@ enumflags
|
|||
SCROLLBAR_SLIDER_DOWN
|
||||
};
|
||||
|
||||
class CUIScrollbar:CUIWidget
|
||||
/** This is a scollbar widget. It needs rework. */
|
||||
class VGUIScrollbar:VGUIWidget
|
||||
{
|
||||
public:
|
||||
void VGUIScrollbar(void);
|
||||
|
||||
/** Sets the ??? */
|
||||
nonvirtual void SetLength(int);
|
||||
nonvirtual int GetLength(void);
|
||||
nonvirtual void SetMin(float);
|
||||
nonvirtual float GetMin(void);
|
||||
nonvirtual void SetMax(float);
|
||||
nonvirtual float GetMax(void);
|
||||
nonvirtual void SetStep(float);
|
||||
nonvirtual float GetStep(void);
|
||||
nonvirtual void SetValue(float,int);
|
||||
nonvirtual float GetValue(void);
|
||||
nonvirtual void CallOnChange(void(void));
|
||||
|
||||
virtual void Draw(void);
|
||||
virtual bool Input(float, float, float, float);
|
||||
|
||||
private:
|
||||
vector m_vecColor;
|
||||
float m_flAlpha;
|
||||
|
||||
|
@ -33,35 +54,18 @@ class CUIScrollbar:CUIWidget
|
|||
float m_flMax;
|
||||
float m_flStep;
|
||||
float m_flValue;
|
||||
|
||||
void(void) CUIScrollbar;
|
||||
|
||||
virtual void(void) m_vChangedCB = 0;
|
||||
|
||||
virtual void(int) SetLength;
|
||||
virtual int(void) GetLength;
|
||||
virtual void(float) SetMin;
|
||||
virtual float() GetMin;
|
||||
virtual void(float) SetMax;
|
||||
virtual float() GetMax;
|
||||
virtual void(float) SetStep;
|
||||
virtual float() GetStep;
|
||||
virtual void(float, int) SetValue;
|
||||
virtual float() GetValue;
|
||||
|
||||
virtual void(void(void)) CallOnChange;
|
||||
|
||||
virtual bool(float, float, float, float) Input;
|
||||
virtual void(void) Draw;
|
||||
};
|
||||
|
||||
void CUIScrollbar::CUIScrollbar(void)
|
||||
void VGUIScrollbar::VGUIScrollbar(void)
|
||||
{
|
||||
m_vecColor = UI_MAINCOLOR;
|
||||
m_flAlpha = 1.0f;
|
||||
m_iFlags = SCROLLBAR_VISIBLE;
|
||||
}
|
||||
|
||||
void CUIScrollbar::Draw(void)
|
||||
void VGUIScrollbar::Draw(void)
|
||||
{
|
||||
vector vecSize = [20, m_iLength];
|
||||
|
||||
|
@ -168,7 +172,7 @@ void CUIScrollbar::Draw(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
bool CUIScrollbar::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
bool VGUIScrollbar::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
bool ret = false;
|
||||
vector vecUpPos = m_parent.m_vecOrigin + m_vecOrigin;
|
||||
|
@ -202,43 +206,43 @@ bool CUIScrollbar::Input (float flEVType, float flKey, float flChar, float flDev
|
|||
return (ret);
|
||||
}
|
||||
|
||||
void CUIScrollbar::SetLength (int iLength)
|
||||
void VGUIScrollbar::SetLength (int iLength)
|
||||
{
|
||||
m_iLength = iLength;
|
||||
}
|
||||
int CUIScrollbar::GetLength(void)
|
||||
int VGUIScrollbar::GetLength(void)
|
||||
{
|
||||
return m_iLength;
|
||||
}
|
||||
|
||||
void CUIScrollbar::SetMin (float flVal)
|
||||
void VGUIScrollbar::SetMin (float flVal)
|
||||
{
|
||||
m_flMin = flVal;
|
||||
}
|
||||
float CUIScrollbar::GetMin(void)
|
||||
float VGUIScrollbar::GetMin(void)
|
||||
{
|
||||
return m_flMin;
|
||||
}
|
||||
|
||||
void CUIScrollbar::SetMax (float flVal)
|
||||
void VGUIScrollbar::SetMax (float flVal)
|
||||
{
|
||||
m_flMax = flVal;
|
||||
}
|
||||
float CUIScrollbar::GetMax(void)
|
||||
float VGUIScrollbar::GetMax(void)
|
||||
{
|
||||
return m_flMax;
|
||||
}
|
||||
|
||||
void CUIScrollbar::SetStep (float flVal)
|
||||
void VGUIScrollbar::SetStep (float flVal)
|
||||
{
|
||||
m_flStep = flVal;
|
||||
}
|
||||
float CUIScrollbar::GetStep(void)
|
||||
float VGUIScrollbar::GetStep(void)
|
||||
{
|
||||
return m_flStep;
|
||||
}
|
||||
|
||||
void CUIScrollbar::SetValue (float flVal, int iCallBack)
|
||||
void VGUIScrollbar::SetValue (float flVal, int iCallBack)
|
||||
{
|
||||
m_flValue = bound(m_flMin, flVal, m_flMax);
|
||||
|
||||
|
@ -246,12 +250,12 @@ void CUIScrollbar::SetValue (float flVal, int iCallBack)
|
|||
m_vChangedCB();
|
||||
}
|
||||
}
|
||||
float CUIScrollbar::GetValue(void)
|
||||
float VGUIScrollbar::GetValue(void)
|
||||
{
|
||||
return m_flValue;
|
||||
}
|
||||
|
||||
void CUIScrollbar::CallOnChange (void(void) vFunc)
|
||||
void VGUIScrollbar::CallOnChange (void(void) vFunc)
|
||||
{
|
||||
m_vChangedCB = vFunc;
|
||||
}
|
||||
|
|
|
@ -21,20 +21,24 @@ enumflags
|
|||
SLIDER_DOWN,
|
||||
};
|
||||
|
||||
class CUISlider:CUIWidget
|
||||
class VGUISlider:VGUIWidget
|
||||
{
|
||||
public:
|
||||
void VGUISlider(void);
|
||||
|
||||
nonvirtual void SetTitle(string);
|
||||
|
||||
/* overrides */
|
||||
virtual void Draw(void);
|
||||
virtual bool Input(float, float, float, float);
|
||||
|
||||
private:
|
||||
float m_flAlpha;
|
||||
vector m_vecSize;
|
||||
vector m_vecColor;
|
||||
|
||||
void(void) CUISlider;
|
||||
virtual void(void) Draw;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
virtual void(vector) SetSize;
|
||||
virtual void(string) SetTitle;
|
||||
};
|
||||
|
||||
void CUISlider::CUISlider(void)
|
||||
void VGUISlider::VGUISlider(void)
|
||||
{
|
||||
m_vecColor = [76,88,68] / 255;
|
||||
m_flAlpha = 1.0f;
|
||||
|
@ -42,7 +46,7 @@ void CUISlider::CUISlider(void)
|
|||
m_iFlags = BUTTON_VISIBLE;
|
||||
}
|
||||
|
||||
void CUISlider::Draw(void)
|
||||
void VGUISlider::Draw(void)
|
||||
{
|
||||
drawfill(m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, m_vecColor, m_flAlpha);
|
||||
|
||||
|
@ -66,16 +70,12 @@ void CUISlider::Draw(void)
|
|||
}
|
||||
}
|
||||
|
||||
bool CUISlider::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
bool VGUISlider::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CUISlider::SetSize (vector vecSize)
|
||||
{
|
||||
m_vecSize = vecSize;
|
||||
}
|
||||
void CUISlider::SetTitle (string strName)
|
||||
void VGUISlider::SetTitle (string strName)
|
||||
{
|
||||
m_strTitle = strName;
|
||||
}
|
||||
|
|
|
@ -14,55 +14,48 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
class CUITabView:CUIWidget
|
||||
class VGUITabView:VGUIWidget
|
||||
{
|
||||
vector m_vecSize;
|
||||
public:
|
||||
void VGUITabView(void);
|
||||
|
||||
/** Sets the title of the tab view. */
|
||||
nonvirtual void SetTitle(string);
|
||||
|
||||
/* overrides */
|
||||
virtual void PositionChanged(vector, vector);
|
||||
virtual void SizeChanged(vector, vector);
|
||||
virtual void Draw(void);
|
||||
virtual bool Input(float, float, float, float);
|
||||
|
||||
private:
|
||||
vector m_vecOutlineSize;
|
||||
vector m_vecOutlinePos;
|
||||
string m_strTitle;
|
||||
|
||||
void(void) CUITabView;
|
||||
virtual void(void) Draw;
|
||||
virtual void(vector) SetPos;
|
||||
virtual vector() GetPos;
|
||||
virtual void(vector) SetSize;
|
||||
virtual vector() GetSize;
|
||||
virtual void(string) SetTitle;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
};
|
||||
|
||||
void CUITabView::CUITabView(void)
|
||||
void VGUITabView::VGUITabView(void)
|
||||
{
|
||||
m_vecSize = [96,16];
|
||||
m_iFlags = BUTTON_VISIBLE;
|
||||
}
|
||||
|
||||
void CUITabView::SetPos (vector vecSize)
|
||||
void VGUITabView:: PositionChanged (vector vecOld, vector vecNew)
|
||||
{
|
||||
m_vecOrigin = vecSize;
|
||||
m_vecOutlinePos = m_vecOrigin + [0, 20];
|
||||
}
|
||||
vector CUITabView::GetPos(void)
|
||||
{
|
||||
return m_vecOrigin;
|
||||
m_vecOutlinePos = vecNew + [0, 20];
|
||||
}
|
||||
|
||||
void CUITabView::SetSize (vector vecSize)
|
||||
void VGUITabView::SizeChanged (vector vecOld, vector vecNew)
|
||||
{
|
||||
m_vecSize = vecSize;
|
||||
m_vecOutlineSize = m_vecSize - [0, 20];
|
||||
}
|
||||
vector CUITabView::GetSize(void)
|
||||
{
|
||||
return m_vecSize;
|
||||
m_vecOutlineSize = vecNew - [0, 20];
|
||||
}
|
||||
|
||||
void CUITabView::SetTitle (string strName)
|
||||
void VGUITabView::SetTitle (string strName)
|
||||
{
|
||||
m_strTitle = strName;
|
||||
SetSize([stringwidth(m_strTitle, TRUE, [g_fntDefault.iScaleX, g_fntDefault.iScaleY]), 16]);
|
||||
}
|
||||
void CUITabView::Draw(void)
|
||||
void VGUITabView::Draw(void)
|
||||
{
|
||||
|
||||
//drawfill(m_parent.m_vecOrigin + m_vecOutlinePos, [m_vecOutlineSize[0], 1], [1,1,1], 0.5f);
|
||||
|
@ -73,7 +66,7 @@ void CUITabView::Draw(void)
|
|||
//Font_DrawText(m_parent.m_vecOrigin + m_vecOrigin + [8, 8], m_strTitle, g_fntDefault);
|
||||
}
|
||||
|
||||
bool CUITabView::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
bool VGUITabView::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -22,23 +22,28 @@ enumflags
|
|||
TEXTBOX_FOCUS
|
||||
};
|
||||
|
||||
class CUITextBox:CUIWidget
|
||||
class VGUITextBox:VGUIWidget
|
||||
{
|
||||
public:
|
||||
void VGUITextBox(void);
|
||||
|
||||
/** Set the starting text of the textbox. */
|
||||
nonvirtual void SetText(string);
|
||||
/** Get the text inside the textbox. */
|
||||
nonvirtual string GetText(void);
|
||||
|
||||
/* overrides */
|
||||
virtual void Draw(void);
|
||||
virtual bool Input(float, float, float, float);
|
||||
|
||||
private:
|
||||
vector m_vecColor;
|
||||
float m_flAlpha;
|
||||
vector m_vecSize;
|
||||
string m_strText;
|
||||
float m_flTime;
|
||||
|
||||
void(void) CUITextBox;
|
||||
virtual void(void) Draw;
|
||||
virtual void(vector) SetSize;
|
||||
virtual void(string) SetText;
|
||||
virtual string() GetText;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
};
|
||||
|
||||
void CUITextBox::CUITextBox(void)
|
||||
void VGUITextBox::VGUITextBox(void)
|
||||
{
|
||||
m_vecColor = UI_MAINCOLOR;
|
||||
m_flAlpha = 1.0f;
|
||||
|
@ -46,20 +51,16 @@ void CUITextBox::CUITextBox(void)
|
|||
m_iFlags = BUTTON_VISIBLE;
|
||||
}
|
||||
|
||||
void CUITextBox::SetSize (vector vecSize)
|
||||
{
|
||||
m_vecSize = vecSize;
|
||||
}
|
||||
void CUITextBox::SetText (string strName)
|
||||
void VGUITextBox::SetText (string strName)
|
||||
{
|
||||
m_strText = strName;
|
||||
}
|
||||
string CUITextBox::GetText(void)
|
||||
string VGUITextBox::GetText(void)
|
||||
{
|
||||
return m_strText;
|
||||
}
|
||||
|
||||
void CUITextBox::Draw(void)
|
||||
void VGUITextBox::Draw(void)
|
||||
{
|
||||
|
||||
#ifdef CLASSIC_VGUI
|
||||
|
@ -97,7 +98,7 @@ void CUITextBox::Draw(void)
|
|||
}
|
||||
}
|
||||
|
||||
bool CUITextBox::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
bool VGUITextBox::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
|
|
|
@ -22,58 +22,49 @@ enumflags
|
|||
WINDOW_CANRESIZE
|
||||
};
|
||||
|
||||
class CUIWindow:CUIWidget
|
||||
/** Top-most window class in VGUILib */
|
||||
class VGUIWindow:VGUIWidget
|
||||
{
|
||||
vector m_vecOrigin;
|
||||
public:
|
||||
void VGUIWindow(void);
|
||||
|
||||
/** Set the title of the window widget. */
|
||||
nonvirtual void SetTitle(string);
|
||||
/** Returns the title of the window widget. */
|
||||
nonvirtual string GetTitle(void);
|
||||
|
||||
/** Sets the icon of the window widget. */
|
||||
nonvirtual void SetIcon(string);
|
||||
/** Returns the icon of the window widget. */
|
||||
nonvirtual string GetIcon(void);
|
||||
|
||||
/** Called when the window is was resized by the user. */
|
||||
nonvirtual void CallOnResize(void(void) vFunc);
|
||||
/** Called when the window has been repositioned by the user. */
|
||||
nonvirtual void CallOnMove(void(void) vFunc);
|
||||
|
||||
/* overrides */
|
||||
virtual void Draw(void);
|
||||
virtual void SizeChanged(vector, vector);
|
||||
virtual bool Input(float, float, float, float);
|
||||
|
||||
private:
|
||||
vector m_vecColor;
|
||||
float m_flAlpha;
|
||||
vector m_vecSize;
|
||||
vector m_vecMinSize;
|
||||
vector m_vecMaxSize;
|
||||
vector m_vecDragOffset;
|
||||
string m_strTitle;
|
||||
string m_strIcon;
|
||||
|
||||
CUIButton m_btnClose;
|
||||
VGUIButton m_btnClose;
|
||||
|
||||
virtual void(void) m_vResizeCB = 0;
|
||||
virtual void(void) m_vMoveCB = 0;
|
||||
|
||||
void(void) CUIWindow;
|
||||
|
||||
virtual void(vector) SetPos;
|
||||
virtual vector(void) GetPos;
|
||||
|
||||
virtual void(string) SetTitle;
|
||||
virtual string() GetTitle;
|
||||
|
||||
virtual void(string) SetIcon;
|
||||
virtual string() GetIcon;
|
||||
|
||||
virtual void(vector) SetSize;
|
||||
virtual vector() GetSize;
|
||||
|
||||
virtual void(vector) SetMinSize;
|
||||
virtual vector() GetMinSize;
|
||||
|
||||
virtual void(vector) SetMaxSize;
|
||||
virtual vector() GetMaxSize;
|
||||
|
||||
|
||||
virtual void(void(void) vFunc) CallOnResize;
|
||||
virtual void(void(void) vFunc) CallOnMove;
|
||||
|
||||
virtual bool(void) Visible;
|
||||
virtual void(void) Draw;
|
||||
virtual void(void) Show;
|
||||
virtual void(void) Hide;
|
||||
virtual bool(float, float, float, float) Input;
|
||||
};
|
||||
|
||||
void CUIWindow::CUIWindow(void)
|
||||
void VGUIWindow::VGUIWindow(void)
|
||||
{
|
||||
static void WindowButtonClose(void) {
|
||||
m_parent.m_iFlags -= (m_parent.m_iFlags & WINDOW_VISIBLE);
|
||||
m_parent.Hide();
|
||||
}
|
||||
m_vecColor = UI_MAINCOLOR;
|
||||
m_flAlpha = 1.0f;
|
||||
|
@ -83,7 +74,7 @@ void CUIWindow::CUIWindow(void)
|
|||
|
||||
m_strTitle = "Window";
|
||||
|
||||
m_btnClose = spawn(CUIButton);
|
||||
m_btnClose = spawn(VGUIButton);
|
||||
m_btnClose.SetTitle(__NULL__);
|
||||
m_btnClose.SetIcon("textures/ui/steam/icon_close");
|
||||
|
||||
|
@ -99,88 +90,41 @@ void CUIWindow::CUIWindow(void)
|
|||
SetSize([320,240]);
|
||||
}
|
||||
|
||||
bool
|
||||
CUIWindow::Visible(void)
|
||||
{
|
||||
return (m_iFlags & WINDOW_VISIBLE) ? true : false;
|
||||
}
|
||||
|
||||
void CUIWindow::SetTitle (string strName)
|
||||
void VGUIWindow::SetTitle (string strName)
|
||||
{
|
||||
m_strTitle = strName;
|
||||
}
|
||||
string CUIWindow::GetTitle(void)
|
||||
string VGUIWindow::GetTitle(void)
|
||||
{
|
||||
return m_strTitle;
|
||||
}
|
||||
|
||||
void CUIWindow::SetIcon (string strName)
|
||||
void VGUIWindow::SetIcon (string strName)
|
||||
{
|
||||
m_strIcon = strName;
|
||||
}
|
||||
string CUIWindow::GetIcon(void)
|
||||
string VGUIWindow::GetIcon(void)
|
||||
{
|
||||
return m_strIcon;
|
||||
}
|
||||
|
||||
void CUIWindow::SetSize (vector vecNewSize)
|
||||
void VGUIWindow:: SizeChanged (vector vecOld, vector vecNew)
|
||||
{
|
||||
m_vecSize[0] = bound(m_vecMinSize[0], vecNewSize[0], m_vecMaxSize[0]);
|
||||
m_vecSize[1] = bound(m_vecMinSize[1], vecNewSize[1], m_vecMaxSize[1]);
|
||||
m_btnClose.SetPos([m_vecSize[0] - 24, 4]);
|
||||
}
|
||||
vector CUIWindow::GetSize(void)
|
||||
{
|
||||
return m_vecSize;
|
||||
m_btnClose.SetPos([vecNew[0] - 24, 4]);
|
||||
}
|
||||
|
||||
void CUIWindow::SetMinSize (vector vecNewSize)
|
||||
{
|
||||
m_vecMinSize = vecNewSize;
|
||||
}
|
||||
vector CUIWindow::GetMinSize(void)
|
||||
{
|
||||
return m_vecMinSize;
|
||||
}
|
||||
|
||||
void CUIWindow::SetMaxSize (vector vecNewSize)
|
||||
{
|
||||
m_vecMaxSize = vecNewSize;
|
||||
}
|
||||
vector CUIWindow::GetMaxSize(void)
|
||||
{
|
||||
return m_vecMaxSize;
|
||||
}
|
||||
|
||||
void CUIWindow::SetPos (vector vecNewPos)
|
||||
{
|
||||
m_vecOrigin[0] = bound(0, vecNewPos[0], video_res[0] - 32);
|
||||
m_vecOrigin[1] = bound(0, vecNewPos[1], video_res[1] - 32);
|
||||
}
|
||||
vector CUIWindow::GetPos(void)
|
||||
{
|
||||
return m_vecOrigin;
|
||||
}
|
||||
|
||||
void CUIWindow::CallOnMove (void(void) vFunc)
|
||||
void VGUIWindow::CallOnMove (void(void) vFunc)
|
||||
{
|
||||
m_vMoveCB = vFunc;
|
||||
}
|
||||
void CUIWindow::CallOnResize (void(void) vFunc)
|
||||
void VGUIWindow::CallOnResize (void(void) vFunc)
|
||||
{
|
||||
m_vResizeCB = vFunc;
|
||||
}
|
||||
|
||||
void CUIWindow::Hide(void)
|
||||
{
|
||||
m_iFlags -= (m_iFlags & WINDOW_VISIBLE);
|
||||
}
|
||||
void CUIWindow::Show(void)
|
||||
{
|
||||
m_iFlags |= WINDOW_VISIBLE;
|
||||
}
|
||||
|
||||
void CUIWindow::Draw(void)
|
||||
|
||||
void VGUIWindow::Draw(void)
|
||||
{
|
||||
#ifdef CLASSIC_VGUI
|
||||
drawfill(m_vecOrigin, m_vecSize, [0,0,0], 0.5);
|
||||
|
@ -223,7 +167,7 @@ void CUIWindow::Draw(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
bool CUIWindow::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
bool VGUIWindow::Input (float flEVType, float flKey, float flChar, float flDevID)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue