[ Back to Geeks3D.com ]
 GeeXLab
Laboratory for Real Time 3D Programming (prototyping and demos) OpenGL, Lua, Python, GLSL, PhysX and more...Reference Guide Host-API Lua / Python
» Back to Homepage
» Back to Developer's Guide Index
HYP_Utils Library
Utils library
Number of functions: 45
HYP_Utils.GetVersion
Returns Demoniak3D version.
: Lua - Python
major, minor, patch [INTEGER]: version identification: major, minor and patch numbers
:
major, minor, patch = HYP_Utils.GetVersion()
HYP_Utils.GetCurrentThreadId
Returns the current thread id.
: Lua - Python
threadId [INTEGER]: thread identifier
HYP_Utils.MsgBox
Displays a dialog box with a message.
: Lua - Python
message [STRING]: text to display
caption [STRING]: message box's caption
:
HYP_Utils.MsgBox("Hello From Demoniak3D")
HYP_Utils.OpenUrl
Opens an URL in the default browser.
: Lua - Python
url [STRING]: url to open
:
HYP_Utils.OpenUrl("http://www.geeks3d.com")
HYP_Utils.DrawText
Draws a text.
: Lua - Python
x, y [INTEGER]: start position of the text in screen space: the position (0;0) is the top-left corner of the screen.
r, g, b [REAL]: text's color
text [STRING]: text to display
:
HYP_Utils.DrawText(10, 100, 1.0, 1.0, 0.0, "Hello from GeeXLab")
HYP_Utils.DrawText2D
Draws a 2D text - Only with bitmap fonts.
: Lua - Python
fontId [INTEGER]: font object identifier.
x, y [INTEGER]: start position of the text in screen space: the position (0;0) is the top-left corner of the screen.
r, g, b [REAL]: text's color
text [STRING]: text to display
:
HYP_Utils.DrawText2D(fontId, 10, 100, 1.0, 1.0, 0.0, "Hello from GeeXLab")
HYP_Utils.DrawText3D
Draws a 2D text - Only with bitmap fonts.
: Lua - Python
fontId [INTEGER]: font object identifier.
x, y, z [REAL]: 3D position of text start.
r, g, b [REAL]: text's color
text [STRING]: text to display
:
HYP_Utils.DrawText3D(fontId, 0.0, 20.0, 0.0, 1.0, 1.0, 0.0, "Hello from GeeXLab")
HYP_Utils.GetElapsedTime
Returns script's elapsed time in milliseconds
: Lua - Python
elapsed [INTEGER]: elapsed time in milliseconds
:
elapsed = HYP_Utils.GetElapsedTime()
elapsedSeconds = HYP_Utils.GetElapsedTime() * 0.001
HYP_Utils.GetElapsedTimeSeconds
Returns script's elapsed time in seconds
: Lua - Python
elapsed [INTEGER]: elapsed time in seconds
:
elapsed = HYP_Utils.GetElapsedTimeSeconds()
HYP_Utils.GetTimeStep
Returns script's frame time or time step: the frame time is the time elapsed between two frames.
: Lua - Python
timeStep [REAL]: time step in seconds
:
timeStep = HYP_Utils.GetTimeStep()
HYP_Utils.CreateFont
Creates a 2D font object based on a true type font.
: Lua - Python
ttfName [STRING]: TrueType font name
size [INTEGER]: font size
fontId [INTEGER]: font object identifier
:
fontId = HYP_Utils.CreateFont("Arial", 14)
HYP_Utils.DestroyFont
Destroys a 2D font object.
: Lua - Python
fontId [INTEGER]: font identifier
:
HYP_Utils.DestroyFont(fontId)
HYP_Utils.CreateFontBitmap
Creates a 2D font object based on a bitmap file.
: Lua - Python
charSet_file [STRING]: character descriptor file path.
isAbsolutePath [INTEGER]: If 1, the descriptor file path is an absolute path.
fontId [INTEGER]: font object identifier
:
fontId = HYP_Utils.CreateFontBitmap(charSet_file, 0)
HYP_Utils.BitmapFontCreateCharset
Creates a charset object from a charset file for bitmap fonts.
: Lua - Python
charSet_file [STRING]: character descriptor file path.
isAbsolutePath [INTEGER]: If 1, the descriptor file path is an absolute path.
csId [INTEGER]: charset identifier
:
csId = HYP_Utils.BitmapFontCreateCharset(charSet_file, 0)
HYP_Utils.BitmapFontDestroyCharset
Destroy a charset objet.
: Lua - Python
csId [INTEGER]: charset identifier
:
HYP_Utils.BitmapFontDestroyCharset(csId)
HYP_Utils.BitmapFontCreateFromCharset
Creates a 2D bitmap font from a charset.
: Lua - Python
csId [INTEGER]: charset identifier
isFont3D [INTEGER]: If 1, sets the 3D state of the font.
fontId [INTEGER]: font identifier
:
fontId = HYP_Utils.BitmapFontCreateFromCharset(csId, 0)
HYP_Utils.BitmapFontSet3DState
Sets the 3D state of a bitmap font.
: Lua - Python
fontId [INTEGER]: font identifier
state [INTEGER]: 3D state of the font.
:
HYP_Utils.BitmapFontSet3DState(fontId, 1)
HYP_Utils.BitmapFontGetTextWidth
Returns the width of a text.
: Lua - Python
fontId [INTEGER]: font identifier
text [STRING]: text.
:
text_width = HYP_Utils.BitmapFontGetTextWidth(fontId, text)
HYP_Utils.BitmapFontSetTextCenteredState
Sets the centered state of a bitmap font.
: Lua - Python
fontId [INTEGER]: font identifier
state [INTEGER]: centered state of the font.
:
HYP_Utils.BitmapFontSetTextCenteredState(fontId, 1)
HYP_Utils.GetDemoDir
Returns the demo's directory.
: Lua - Python
directory [STRING]: demo's directory
HYP_Utils.GetAppDir
Returns Demoniak3D's root directory.
: Lua - Python
directory [STRING]: root directory
HYP_Utils.GetOpenGLRendererModel
Returns the OpenGL renderer description.
: Lua - Python
rendererDescr [STRING]: renderer description
HYP_Utils.GetOpenGLRendererVendor
Returns the OpenGL renderer vendor.
: Lua - Python
vendorDescr [STRING]: renderer vendor
HYP_Utils.IsATI
Returns true if ATI graphics card is detected.
: Lua - Python
ret [INTEGER]: 1 if ATI, 0 if not
HYP_Utils.IsNVIDIA
Returns true if NVIDIA graphics card is detected.
: Lua - Python
ret [INTEGER]: 1 if NVIDIA, 0 if not
HYP_Utils.Project3DTo2D
Projects a 3D point in world coordinates into a 2D point in screen coordinates. In screen space, the position (0;0) is in bottom-left corner.
: Lua - Python
pos_x, pos_y, pos_z [REAL]: position in 3D world coordinates
screen_x, screen_y [INTEGER]: position in screen coordinates
HYP_Utils.Project2DTo3D
Projects a 2D point in screen coordinates into a 3D point in world coordinates. In screen space, the position (0;0) is in bottom-left corner.
: Lua - Python
screen_x, screen_y [INTEGER]: position in screen coordinates
pos_x, pos_y, pos_z [REAL]: position in 3D world coordinates
HYP_Utils.Mat4Translate
Creates a translation matrix in the OpenGL convention.
: Lua - Python
x, y, z [REAL]: Translation vector
m0 .. to .. m15 [REAL]: 16 elements of the matrix
:
m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15 = HYP_Utils.Mat4Translate(x, y, z)
HYP_Utils.Mat4Scale
Creates a scaling matrix in the OpenGL convention.
: Lua - Python
x, y, z [REAL]: scale vector
m0 .. to .. m15 [REAL]: 16 elements of the matrix
:
m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15 = HYP_Utils.Mat4Scale(x, y, z)
HYP_Utils.Mat4RotateX
Creates a X-axis rotation matrix in the OpenGL convention.
: Lua - Python
angle [REAL]: rotation angle in degrees
m0 .. to .. m15 [REAL]: 16 elements of the matrix
:
m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15 = HYP_Utils.Mat4RotateX(angle)
HYP_Utils.Mat4RotateY
Creates a Y-axis rotation matrix in the OpenGL convention.
: Lua - Python
angle [REAL]: rotation angle in degrees
m0 .. to .. m15 [REAL]: 16 elements of the matrix
:
m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15 = HYP_Utils.Mat4RotateY(angle)
HYP_Utils.Mat4RotateZ
Creates a Z-axis rotation matrix in the OpenGL convention.
: Lua - Python
angle [REAL]: rotation angle in degrees
m0 .. to .. m15 [REAL]: 16 elements of the matrix
:
m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15 = HYP_Utils.Mat4RotateZ(angle)
HYP_Utils.Mat4RotateAxis
Creates an axis rotation matrix in the OpenGL convention.
: Lua - Python
angle [REAL]: rotation angle in degrees
x, y, z [REAL]: rotation axis
m0 .. to .. m15 [REAL]: 16 elements of the matrix
:
m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15 = HYP_Utils.Mat4RotateAxis(angle)
HYP_Utils.SharedVariableCreate
Creates a new shared variable. Shared variables allows communication between Lua and Python scripts.
: Lua - Python
name [STRING]: shared variable name
:
HYP_Utils.SharedVariableCreate("position")
HYP_Utils.SharedVariableDestroy
Destroys a shared variable.
: Lua - Python
name [STRING]: shared variable name
:
HYP_Utils.SharedVariableDestroy(name)
HYP_Utils.SharedVariableExist
tests the existence of a shared variable: returns 1 if the shared variable exists.
: Lua - Python
name [STRING]: shared variable name
:
doesExist = HYP_Utils.SharedVariableExist(name)
HYP_Utils.SharedVariableIsFloat
checks the float type of the shared variable.
: Lua - Python
name [STRING]: shared variable name
:
isfloat = HYP_Utils.SharedVariableIsFloat(name)
HYP_Utils.SharedVariableIsInteger
checks the integer type of the shared variable.
: Lua - Python
name [STRING]: shared variable name
:
isint = HYP_Utils.SharedVariableIsInteger(name)
HYP_Utils.SharedVariableIsString
checks the string type of the shared variable.
: Lua - Python
name [STRING]: shared variable name
:
isstr = HYP_Utils.SharedVariableIsString(name)
HYP_Utils.SharedVariableSetValue4f
Sets a 4D float value to a shared variable.
: Lua - Python
name [STRING]: shared variable name
x, y, z, w [REAL]: 4D float value
:
HYP_Utils.SharedVariableSetValue4f(name, x, y, z, w)
HYP_Utils.SharedVariableSetValue4i
Sets a 4D integer value to a shared variable.
: Lua - Python
name [STRING]: shared variable name
x, y, z, w [INTEGER]: 4D integer value
:
HYP_Utils.SharedVariableSetValue4i(name, x, y, z, w)
HYP_Utils.SharedVariableSetValueStr
Sets a string value to a shared variable.
: Lua - Python
name [STRING]: shared variable name
str [STRING]: string value
:
HYP_Utils.SharedVariableSetValueStr(name, "Hello!")
HYP_Utils.SharedVariableGetValue
Gets the value of a shared variable. The type of value returned depends on the last affectation.
: Lua - Python
name [STRING]: shared variable name
:
x, y, z, w = HYP_Utils.SharedVariableGetValue(name)
or
str = HYP_Utils.SharedVariableGetValue(name)
HYP_Utils.DropFilesGetNumFiles
Returns the number of dropped files.
: Lua - Python
n [INTEGER]: number of dropped files
:
n = HYP_Utils.DropFilesGetNumFiles()
HYP_Utils.DropFilesGetFilenameByIndex
Returns the name of a drag n dropped file.
: Lua - Python
index [INTEGER]: index of a dropped file
filename [STRING]: dropped filename
:
filename = HYP_Utils.DropFilesGetFilenameByIndex(index)
|