The Croc Programming Language

module imgui

This library provides an interface to Omar Cornut's ImGui library. With this you can make lightweight immediate-mode GUIs for developer use inside games, content creation tools, and so on.

ImGui does not render anything; all it outputs is a vertex buffer and a list of draw commands, and you're responsible for drawing them. You also must feed it inputs from the keyboard, mouse etc. For an example on how to do this, there is a "imguitest" program in Croc's samples which renders a GUI with OpenGL and uses GLFW for windowing.

Currently Unsupported Features

The following features are not yet wrapped:

  • Custom font support. Only the default font is available, and it only supports ASCII text.

  • Direct draw-list manipulation, useful for writing your own widgets.

  • Getting and setting tree state storage.

global function init()

Bound VM: the ImGui library has only a single global state, and has some callback functions which are registered with it. Because of those reasons, this library only allows one VM to be "bound" to it any time. You must call this function to bind the VM to the library.

Attempting to call this function again - from the same VM or from another - will throw a StateError. It is currently not possible to switch which VM is bound, short of calling shutdown in the bound VM and then this function in another.

Throws:
StateError

in the situation described above.

global function shutdown()

Bound VM: this unbinds the current VM from the library as explained in init. Any callback functions currently registered with the library will be unregistered.

global function getStyle()
global function setStyle()
global function newFrame()
global function render()
global function showUserGuide()
global function showStyleEditor()
global function showTestWindow()
global function showTestWindowClosable()
global function begin()
global function beginClosable()
global function end()
global function beginChild()
global function endChild()
global function getWindowIsFocused()
global function getWindowSize()
global function getWindowWidth()
global function setWindowSize()
global function getWindowPos()
global function setWindowPos()
global function getWindowContentRegion()
global function getWindowFontSize()
global function setWindowFontScale()
global function setScrollPosHere()
global function setKeyboardFocusHere()
global function pushItemWidth()
global function popItemWidth()
global function getItemWidth()
global function pushAllowKeyboardFocus()
global function popAllowKeyboardFocus()
global function pushStyleColor()
global function popStyleColor()
global function setTooltip()
global function beginTooltip()
global function endTooltip()
global function separator()
global function sameLine()
global function spacing()
global function columns()
global function nextColumn()
global function getColumnOffset()
global function setColumnOffset()
global function getColumnWidth()
global function getCursorPos()
global function setCursorPos()
global function setCursorPosX()
global function setCursorPosY()
global function getCursorScreenPos()
global function alignFirstTextHeightToWidgets()
global function getTextLineSpacing()
global function getTextLineHeight()
global function pushID()
global function popID()
global function text()
global function textColored()
global function textUnformatted()
global function labelText()
global function bulletText()
global function button()
global function smallButton()
global function collapsingHeader()
global function sliderFloat()
global function sliderFloat2()
global function sliderFloat3()
global function sliderFloat4()
global function sliderAngle()
global function sliderInt()
global function plotLines()
global function plotHistogram()
global function checkbox()
global function checkboxFlags()
global function radioButton()
global function radioButtonMulti()
global function inputText()
global function inputFloat()
global function inputFloat2()
global function inputFloat3()
global function inputFloat4()
global function inputInt()
global function comboStr()
global function comboFunc()
global function colorButton()
global function colorEdit3()
global function colorEdit4()
global function colorEditMode()
global function treeNode()
global function treeNodeID()
global function treePush()
global function treePop()
global function openNextNode()
global function value()
global function color()
global function color32()
global function logButtons()
global function logToTTY()
global function logToFile()
global function logToClipboard()
global function setNewWindowDefaultPos()
global function isHovered()
global function getItemBox()
global function isClipped()
global function isKeyPressed()
global function isMouseClicked()
global function isMouseDoubleClicked()
global function isMouseHoveringWindow()
global function isMouseHoveringAnyWindow()
global function isMouseHoveringBox()
global function isPosHoveringAnyWindow()
global function getMousePos()
global function getTime()
global function getFrameCount()
global function getStyleColorName()
global function getDefaultFontInfo()
global function getDefaultFontData()
global function calcTextSize()
HTML and JavaScript source derived from by Victor Nakoryakov; Page generated on 15 Nov 2014 10:28:14