Difference between revisions of "Global Functions"
Shadlington (Talk | contribs) |
Shadlington (Talk | contribs) |
||
| Line 186: | Line 186: | ||
| [[FastRandom]] | | [[FastRandom]] | ||
| {{:FastRandom}} | | {{:FastRandom}} | ||
| + | |- | ||
| + | ! | ||
| + | ! '''Strings''' | ||
| + | |- | ||
| + | | [[formatInt]] | ||
| + | | {{:formatInt}} | ||
| + | |- | ||
| + | | [[formatFloat]] | ||
| + | | {{:formatFloat}} | ||
| + | |- | ||
| + | | [[parseInt]] | ||
| + | | {{:parseInt}} | ||
| + | |- | ||
| + | | [[parseFloat]] | ||
| + | | {{:parseFloat}} | ||
| + | |- | ||
| + | | [[join]] | ||
| + | | {{:join}} | ||
| + | |- | ||
| + | ! | ||
| + | ! '''Printing''' | ||
| + | |- | ||
| + | | [[print]] | ||
| + | | {{:print}} | ||
| + | |- | ||
| + | | [[printf]] | ||
| + | | {{:printf}} | ||
| + | |- | ||
| + | | [[printInt]] | ||
| + | | {{:printInt}} | ||
| + | |- | ||
| + | | [[printFloat]] | ||
| + | | {{:printFloat}} | ||
| + | |- | ||
| + | | [[printString]] | ||
| + | | {{:printString}} | ||
| + | |- | ||
| + | | [[printVec2f]] | ||
| + | | {{:printVec2f}} | ||
| + | |- | ||
| + | | [[printBool]] | ||
| + | | {{:printBool}} | ||
| + | |- | ||
| + | | [[printPos]] | ||
| + | | {{:printPos}} | ||
| + | |- | ||
| + | | [[printPosition2di]] | ||
| + | | {{:printPosition2di}} | ||
| + | |- | ||
| + | | [[error]] | ||
| + | | {{:error}} | ||
| + | |- | ||
| + | | [[warn]] | ||
| + | | {{:warn}} | ||
| + | |- | ||
| + | | [[warning]] | ||
| + | | {{:warning}} | ||
| + | |- | ||
| + | ! | ||
| + | ! '''World''' | ||
| + | |- | ||
| + | | [[getMap]] | ||
| + | | {{:getMap}} | ||
| + | |- | ||
| + | | [[getRules]] | ||
| + | | {{:getRules}} | ||
| + | |- | ||
| + | | [[getRespawn]] | ||
| + | | {{:getRespawn}} | ||
| + | |- | ||
| + | | [[getHUD]] | ||
| + | | {{:getHUD}} | ||
| + | |- | ||
| + | | [[getNet]] | ||
| + | | {{:getNet}} | ||
| + | |- | ||
| + | | [[getCamera]] | ||
| + | | {{:getCamera}} | ||
| + | |- | ||
| + | | [[getControls]] | ||
| + | | {{:getControls}} | ||
| + | |- | ||
| + | | [[getDriver]] | ||
| + | | {{:getNet}} | ||
| + | |- | ||
| + | | [[LoadRules]] | ||
| + | | {{:LoadRules}} | ||
| + | |- | ||
| + | | [[LoadMap]] | ||
| + | | {{:LoadMap}} | ||
| + | |- | ||
| + | | [[LoadNextMap]] | ||
| + | | {{:LoadNextMap}} | ||
| + | |- | ||
| + | | [[LoadMapCycle]] | ||
| + | | {{:LoadMapCycle}} | ||
| + | |- | ||
| + | | [[getGameTime]] | ||
| + | | {{:getGameTime}} | ||
|- | |- | ||
! | ! | ||
| Line 198: | Line 297: | ||
| [[CreateGridMenu]] | | [[CreateGridMenu]] | ||
| {{:CreateGridMenu}} | | {{:CreateGridMenu}} | ||
| + | |- | ||
| + | | [[makeAnimatedParticle]] | ||
| + | | {{:makeAnimatedParticle}} | ||
| + | |- | ||
| + | | [[makeAnimatedParticle]] | ||
| + | | {{:makeAnimatedParticle}} | ||
| + | |- | ||
| + | | [[Play]] | ||
| + | | {{:Play}} | ||
|- | |- | ||
Revision as of 19:05, 13 August 2012
Something here about the general concept of global functions.
Then a big ol' list of the functions, linking to their own articles.
| Function | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Blobs | |||||||||||
| CreateBlob |
Creates a CBlob with the given factory and the given path to a config file defining the CBlob. Returns a reference to the created CBlob. | ||||||||||
| getBlob |
Returns a reference to the CBlob with the given index in the list of blobs that currently exist. | ||||||||||
| getBlobByNetworkId |
Returns a reference to the CBlob with the given Network ID. | ||||||||||
| getBlobByName |
Returns a reference to the first CBlob with the given name. Probably not very useful. | ||||||||||
| getPlayingBlobsSize |
Returns the number of CBlobs that are currently active and in play - i.e. not settled map blocks or in inventories. | ||||||||||
| getBlobSize |
Returns the number of CBlobs that currently exist. | ||||||||||
| Inventory | |||||||||||
| AddRequirement |
Pushes the given requirements to a CBitStream, to be read by other requirement methods. | ||||||||||
| ReadRequirement |
Reads requirements from the given CBitStream into variables you provide. | ||||||||||
| hasRequirements |
Checks 1 or 2 inventories to see if they have the given requirements, and writes any missing requirements into a given CBitStream. Returns true if the requirements are met, otherwise false. | ||||||||||
| TakeRequirementsCombined |
Removes the requirements in the given CBitStream from one of the CInventorys passed to it. | ||||||||||
| GUI | |||||||||||
| LoadSkin |
Loads a skin config file. See GUI/guiSkin.cfg for example file. | ||||||||||
| DrawPane |
Draws a pane with a shape specified by the given rect. | ||||||||||
| DrawSunkenPane |
Draws a sunken pane with a shape specified by the given rect. | ||||||||||
| DrawWindow |
Draws a window with a shape specified by the given rect. | ||||||||||
| DrawFramedPane |
Draws a framed pane with a shape specified by the given rect. | ||||||||||
| DrawButton |
Draws a button with a shape specified by the given rect. | ||||||||||
| DrawButtonPressed |
Draws a pressed button with a shape specified by the given rect. | ||||||||||
| DrawButtonHover |
Draws a hover-highlighted button with a shape specified by the given rect. | ||||||||||
| DrawRectangle |
Draws a rectangle with a shape specified by the given rect. | ||||||||||
| DrawProgressBar |
Draws a progress bar with a shape specified by the given rect and a given % fill. | ||||||||||
| DrawIconByName |
Draws an icon added by AddIconToken using its token name. | ||||||||||
| DrawIcon |
Draws an icon from the given file. | ||||||||||
| DrawText |
Draws some text. | ||||||||||
| Maths | |||||||||||
| cos |
Returns the cosine of the given angle in radians. | ||||||||||
| FastCos |
Returns the cosine of the given angle in radians. Faster, less reliable version. | ||||||||||
| acos | Acos | ||||||||||
| cosh | Cosh | ||||||||||
| sin |
Returns the sine of the given angle in radians. | ||||||||||
| FastSin |
Returns the sine of the given angle in radians. Faster, less reliable version. | ||||||||||
| sinh | Sinh | ||||||||||
| asin | Asin | ||||||||||
| tan |
Returns the tangent of the given angle in radians. | ||||||||||
| atan | Atan | ||||||||||
| tanh | Tanh | ||||||||||
| pow |
Returns base raised to the power exponent. | ||||||||||
| sqrt |
Returns the square root of x. | ||||||||||
| FastSqrt | FastSqrt | ||||||||||
| InvSqrt |
Returns the inverse square root of x. | ||||||||||
| log |
The log is a wooden object spawned from the destruction of trees
UseThe log can be mined by the builder or chopped up by the saw to get wood. Tips
| ||||||||||
| log10 | Log10 | ||||||||||
| isValid |
Returns true if the given float is a valid number (not NaN or infinity) or not. | ||||||||||
| floor |
Returns the largest integral value that is not greater than the given number. | ||||||||||
| fraction | Fraction | ||||||||||
| ceil |
Returns the smallest integral value that is not less than the given number. | ||||||||||
| Equals |
Returns true if the two given floats are equal, otherwise false. | ||||||||||
| Min |
Returns the smaller of the two given numbers. | ||||||||||
| Max |
Returns the larger of the two given numbers. | ||||||||||
| abs |
Returns the absolute value of the given number. | ||||||||||
| FMod |
Returns the floating-point remainder of the given numerator divided by the given denominator. | ||||||||||
| Round |
Rounds the given float to the nearest whole number, as an int. | ||||||||||
| Roundf |
Rounds the given float to the nearest whole number, as a float. | ||||||||||
| get256DegreesFrom360 | Get256DegreesFrom360 | ||||||||||
| get360DegreesFrom256 | Get360DegreesFrom256 | ||||||||||
| Random |
Returns a pseudo-random int in the range 0 to the given max int. | ||||||||||
| FastRandom |
Returns a seemingly-random (much less random than Random, though it is faster) int in the range 0 to the given max int. | ||||||||||
| Strings | |||||||||||
| formatInt |
Returns a formatted string representation of the given int. | ||||||||||
| formatFloat |
Returns a formatted string representation of the given float. | ||||||||||
| parseInt |
Returns an int from the given string representation of an int. | ||||||||||
| parseFloat |
Returns a double from the given string representation of an float. | ||||||||||
| join | Join | ||||||||||
| Printing | |||||||||||
|
Prints the given text - to the console, if its available. | |||||||||||
| printf | Printf | ||||||||||
| printInt |
Prints the given integer with the given prefix text - to the console, if its available. | ||||||||||
| printFloat |
Prints the given float with the given prefix text - to the console, if its available. | ||||||||||
| printString |
Prints the given string with the given prefix text - to the console, if its available. | ||||||||||
| printVec2f |
Prints the given Vec2f with the given prefix text - to the console, if its available. | ||||||||||
| printBool |
Prints the given bool with the given prefix text - to the console, if its available. | ||||||||||
| printPos |
Prints the given position2d with the given prefix text - to the console, if its available. | ||||||||||
| printPosition2di | PrintPosition2di | ||||||||||
| error |
Prints an error with the given text - to the console, if its available. | ||||||||||
| warn | Warn | ||||||||||
| warning |
Prints a warning with the given text - to the console, if its available. | ||||||||||
| World | |||||||||||
| getMap |
Returns a reference to the CMap object. | ||||||||||
| getRules |
Returns a reference to the CRules object. | ||||||||||
| getRespawn |
Returns a reference to the CRespawn object. | ||||||||||
| getHUD |
Returns a reference to the CHUD object. | ||||||||||
| getNet |
Returns a reference to the CNet object. | ||||||||||
| getCamera |
Returns a reference to the CCamera object. | ||||||||||
| getControls |
Returns a reference to the CControls object. | ||||||||||
| getDriver |
Returns a reference to the CNet object. | ||||||||||
| LoadRules |
Loads the given rules config file. | ||||||||||
| LoadMap |
Loads the given map file. | ||||||||||
| LoadNextMap |
Loads the next map in the map cycle. | ||||||||||
| LoadMapCycle |
Loads the given map cycle file. | ||||||||||
| getGameTime |
Returns the game time (number of ticks) as an integer (s32). | ||||||||||
| Misc | |||||||||||
| AddIconMarker |
This defines a token (e.g. $EmptyShop$) for icon replacement in menus and suchlike. | ||||||||||
| AddColorMarker |
This defines a token (e.g. $RED$) for colouring text in menus and suchlike. | ||||||||||
| CreateGridMenu |
Creates a CGridMenu with the given position on-screen, a reference to the owner blob, the grid dimensions and a caption. Returns a reference to the created CGridMenu. | ||||||||||
| makeAnimatedParticle |
Creates a particle with a number of different options. | ||||||||||
| makeAnimatedParticle |
Creates a particle with a number of different options. | ||||||||||
| Play |
Plays the a sound file at the given position (position used to determine if it can be heard). | ||||||||||