Difference between revisions of "Global Functions"

From King Arthur's Gold Wiki
Jump to: navigation, search
Line 47: Line 47:
 
|-
 
|-
 
!
 
!
! '''Irrlicht'''
+
! '''GUI'''
 
|-
 
|-
 
| [[LoadSkin]]
 
| [[LoadSkin]]

Revision as of 20:54, 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

Log
Log.png
Breaking yields 30 WoodMini.png (5 per hit)
Hits to break 6 hits (per log)

Use

The log can be mined by the builder or chopped up by the saw to get wood.

Tips

  • The log can be hidden behind and used to camouflage mines.
  • The log can be slashed by knights but will not give any wood to the slasher.
  • The log can prop open enemy doors.

Navigation

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.

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.