Level Script External Code

From Wolfire Games Wiki
Revision as of 07:47, 5 November 2017 by Merlyn (talk | contribs) (Unsorted Functions: Split out dear imgui functions)
Jump to: navigation, search

This is a list of the external code that is only available to be used inside a level script or hotspot - variables, functions, and classes that "magically" exist.

Some code is not available to be used in a hotspot script, and will be marked below.

To see a list of external code that is available to all scripts, please see this page - Common Script External Code

This list is pulled from the ~/Documents/Wolfire/Overgrowth/aslevel_docs.h file, which is automatically generated by the game.

See this page to find the location for the Wolfire/Overgrowth folder on each OS - How to clear the game's cache

TODO: These can be documented individually, possibly on their own pages - or maybe as just subsections?

Global Variables

HUDImages hud;
int imgui_text_input_CursorPos;
int imgui_text_input_SelectionEnd;
int imgui_text_input_SelectionStart;
SaveFile save_file;
ScreenMetrics screenMetrics;
uint SOCKET_ID_INVALID;  // A value to specify that the socket you got back is not valid - Not used in hotspot scripts
float the_time;  // The current time in seconds since engine started (in-game time)
float time_step;  // Time in seconds between engine time steps
float ui_time;  // The current time in seconds since engine started (absolute time)

Constants

enum ContainerAlignment;
enum DividerOrientation;
enum ExpansionPolicy;
enum IMTweenType;
enum ImGuiCol_;
enum ImGuiColorEditMode_;
enum ImGuiInputTextFlags_;
enum ImGuiKey_;
enum ImGuiSelectableFlags_;
enum ImGuiSetCond_;
enum ImGuiTreeNodeFlags_;
enum ImGuiWindowFlags_;
enum PhxGuiConstantsType;
enum PlaceholderObjectType;
enum TextFlags;
enum UIMouseState;
enum UIState;

Global Functions

Unsorted Functions

void AddFileString(const string &in);
IMGUI@ CreateIMGUI();
int CreateIMUIContext();
void DisposeIMUIContext(int id);
string GetFileLine();
IMUIContext@ GetIMUIContext(int id);
string GetUserPickedReadPath(const string &in suffix, const string &in default_path);
string GetUserPickedWritePath(const string &in suffix, const string &in default_path);
vec4 HexColor(const string &in hex);
bool LoadFile(const string &in);
IMImage@ ModGetThumbnailImage(ModID& sid);
void StartWriteFile();
bool WriteFile(const string &in);
bool WriteFileToWriteDir(const string &in);

Dear ImGui Functions

These functions expose the Dear ImGui library that is integrated into the Phoenix engine.

For a little more documentation on Dear ImGui functions, see this page - https://github.com/ocornut/imgui/blob/master/imgui.h

None of these network functions are available to be used in hotspot scripts

void ImGui_AlignFirstTextHeightToWidgets();
bool ImGui_Begin(const string &in name, bool &inout is_open, int flags = 0);  // bool ImGui_Begin(const string &in name, bool &inout is_open, ImGuiWindowFlags flags = 0)
bool ImGui_Begin(const string &in name, int flags = 0);  // bool ImGui_Begin(const string &in name, ImGuiWindowFlags flags = 0)
bool ImGui_BeginChild(const string &in str_id, const vec2 &in size = vec2(0, 0), bool border = false, int extra_flags = 0);  // bool ImGui_BeginChild(const string &in str_id, const vec2 &in size = vec2(0, 0), bool border = false, ImGuiWindowFlags extra_flags = 0)
bool ImGui_BeginChild(uint id, const vec2 &in size = vec2(0, 0), bool border = false, int extra_flags = 0);  // bool ImGui_BeginChild(uint id, const vec2 &in size = vec2(0, 0), bool border = false, ImGuiWindowFlags extra_flags = 0)
bool ImGui_BeginChildFrame(uint id, const vec2 &in size, int extra_flags = 0);  // bool ImGui_BeginChildFrame(uint id, const vec2 &in size, ImGuiWindowFlags extra_flags = 0)
void ImGui_BeginGroup();
bool ImGui_BeginMenu(const string &in label, bool enabled = true);
bool ImGui_BeginMenuBar();
bool ImGui_BeginPopup(const string &in popup_id);
bool ImGui_BeginPopupContextItem(const string &in popup_id, int mouse_button = 1);
bool ImGui_BeginPopupContextVoid(const string &in popup_id, int mouse_button = 1);
bool ImGui_BeginPopupContextVoid(int mouse_button = 1);
bool ImGui_BeginPopupContextWindow(bool also_over_items = true, int mouse_button = 1);
bool ImGui_BeginPopupContextWindow(bool also_over_items, const string &in popup_id, int mouse_button = 1);
bool ImGui_BeginPopupModal(const string &in name, bool &inout is_open, int extra_flags = 0);  // bool ImGui_BeginPopupModal(const string &in name, bool &inout is_open, ImGuiWindowFlags extra_flags = 0)
bool ImGui_BeginPopupModal(const string &in name, int extra_flags = 0);  // bool ImGui_BeginPopupModal(const string &in name, ImGuiWindowFlags extra_flags = 0)
void ImGui_Bullet();
void ImGui_BulletText(const string &in label);  // Note: label is not a format string, unlike in Dear ImGui. Use string concatenation instead
bool ImGui_Button(const string &in, const vec2 &in size = vec2(0, 0));
vec2 ImGui_CalcItemRectClosestPoint(const vec2 &in pos, bool on_edge = false, float outward = 0.0f);
void ImGui_CalcListClipping(int items_count, float items_height, int &out out_items_display_start, int &out out_items_display_end);
vec2 ImGui_CalcTextSize(const string &in text, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
void ImGui_CaptureKeyboardFromApp(bool capture = true);
void ImGui_CaptureMouseFromApp(bool capture = true);
bool ImGui_Checkbox(const string &in label, bool &inout value);
bool ImGui_CheckboxFlags(const string &in label, uint &inout flags, uint flags_value);
void ImGui_CloseCurrentPopup();
bool ImGui_CollapsingHeader(const string &in label, bool &inout is_open, int flags = 0);  // bool ImGui_CollapsingHeader(const string &in label, bool &inout is_open, ImGuiTreeNodeFlags flags = 0)
bool ImGui_CollapsingHeader(const string &in label, int flags = 0);  // bool ImGui_CollapsingHeader(const string &in label, ImGuiTreeNodeFlags flags = 0)
bool ImGui_ColorButton(const vec4 &in col, bool small_height = false, bool outline_border = true);
uint ImGui_ColorConvertFloat4ToU32(const vec4 &in value);
void ImGui_ColorConvertHSVtoRGB(float h, float s, float v, float &out out_r, float &out out_g, float &out out_b);
void ImGui_ColorConvertRGBtoHSV(float r, float g, float b, float &out out_h, float &out out_s, float &out out_v);
vec4 ImGui_ColorConvertU32ToFloat4(uint value);
bool ImGui_ColorEdit3(const string &in label, vec3 &inout color);
bool ImGui_ColorEdit4(const string &in label, vec4 &inout color, bool show_alpha = true);
void ImGui_ColorEditMode(int);  // void ImGui_ColorEditMode(ImGuiColorEditMode mode)
bool ImGui_Columns(int count = 1, bool border = true);
bool ImGui_Columns(int count, const string &in id, bool border = true);
bool ImGui_Combo(const string &in label, int &inout current_item, const array<string> &in items, int height_in_items = -1);
bool ImGui_Combo(const string &in label, int &inout current_item, const string &in items_separated_by_zeros, int height_in_items = -1);
bool ImGui_DragFloat(const string &in label, float &inout value, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const string &in display_format = "%.3f", float power = 1.0f);
bool ImGui_DragFloat2(const string &in label, vec2 &inout value, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const string &in display_format = "%.3f", float power = 1.0f);
bool ImGui_DragFloat3(const string &in label, vec3 &inout value, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const string &in display_format = "%.3f", float power = 1.0f);
bool ImGui_DragFloat4(const string &in label, vec4 &inout value, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const string &in display_format = "%.3f", float power = 1.0f);
bool ImGui_DragInt(const string &in label, int &inout value, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const string &in display_format = "%.0f");
void ImGui_DrawSettings();
void ImGui_Dummy(const vec2 &in size);
void ImGui_End();
void ImGui_EndChild();
void ImGui_EndChildFrame();
void ImGui_EndGroup();
void ImGui_EndMenu();
void ImGui_EndMenuBar();
void ImGui_EndPopup();
int ImGui_GetColumnIndex();
float ImGui_GetColumnOffset(int column_index = -1);
float ImGui_GetColumnWidth(int column_index = -1);
int ImGui_GetColumnsCount();
vec2 ImGui_GetContentRegionAvail();
float ImGui_GetContentRegionAvailWidth();
vec2 ImGui_GetContentRegionMax();
vec2 ImGui_GetCursorPos();
float ImGui_GetCursorPosX();
float ImGui_GetCursorPosY();
vec2 ImGui_GetCursorScreenPos();
vec2 ImGui_GetCursorStartPos();
int ImGui_GetFrameCount();
vec2 ImGui_GetItemRectMax();
vec2 ImGui_GetItemRectMin();
vec2 ImGui_GetItemRectSize();
float ImGui_GetItemsLineHeightWithSpacing();
int ImGui_GetKeyIndex(int imgui_key);  // int ImGui_GetKeyIndex(ImGuiKey key)
int ImGui_GetMouseCursor();  // ImGuiMouseCursor ImGui_GetMouseCursor()
vec2 ImGui_GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f);
vec2 ImGui_GetMousePos();
vec2 ImGui_GetMousePosOnOpeningCurrentPopup();
float ImGui_GetScrollMaxX();
float ImGui_GetScrollMaxY();
float ImGui_GetScrollX();
float ImGui_GetScrollY();
string ImGui_GetStyleColName(int idx);  // string ImGui_GetStyleColName(ImGuiCol idx)
string ImGui_GetTextBuf();
float ImGui_GetTextLineHeight();
float ImGui_GetTextLineHeightWithSpacing();
float ImGui_GetTime();
float ImGui_GetTreeNodeToLabelSpacing();
vec2 ImGui_GetWindowContentRegionMax();
vec2 ImGui_GetWindowContentRegionMin();
float ImGui_GetWindowContentRegionWidth();
float ImGui_GetWindowHeight();
vec2 ImGui_GetWindowPos();
vec2 ImGui_GetWindowSize();
float ImGui_GetWindowWidth();
void ImGui_Indent(float indent_w = 0.0f);
bool ImGui_InputFloat(const string &in label, float &inout value, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, int extra_flags = 0);  // bool ImGui_InputFloat(const string &in label, float &inout value, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0)
bool ImGui_InputFloat2(const string &in label, vec2 &inout value, int decimal_precision = -1, int extra_flags = 0);  // bool ImGui_InputFloat2(const string &in label, vec2 &inout value, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0)
bool ImGui_InputFloat3(const string &in label, vec3 &inout value, int decimal_precision = -1, int extra_flags = 0);  // bool ImGui_InputFloat3(const string &in label, vec3 &inout value, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0)
bool ImGui_InputFloat4(const string &in label, vec4 &inout value, int decimal_precision = -1, int extra_flags = 0);  // bool ImGui_InputFloat4(const string &in label, vec4 &inout value, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0)
bool ImGui_InputInt(const string &in label, int &inout value, int step = 1, int step_fast = 100, int extra_flags = 0);  // bool ImGui_InputInt(const string &in label, int &inout value, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0)
bool ImGui_InputText(const string &in label, int flags = 0);  // bool ImGui_InputText(const string &in label, ImGuiInputTextFlags flags = 0)
bool ImGui_InputTextMultiline(const string &in label, const vec2 &in size = vec2(0, 0), int flags = 0);  // bool ImGui_InputTextMultiline(const string &in label, const vec2 &in size = vec2(0, 0), ImGuiInputTextFlags flags = 0)
bool ImGui_InvisibleButton(const string &in str_id, const vec2 &in size);
bool ImGui_IsAnyItemActive();
bool ImGui_IsAnyItemHovered();
bool ImGui_IsItemActive();
bool ImGui_IsItemClicked(int mouse_button = 0);
bool ImGui_IsItemHovered();
bool ImGui_IsItemHoveredRect();
bool ImGui_IsItemVisible();
bool ImGui_IsKeyDown(int key_index);
bool ImGui_IsKeyPressed(int key_index, bool repeat = true);
bool ImGui_IsKeyReleased(int key_index);
bool ImGui_IsMouseClicked(int button, bool repeat = false);
bool ImGui_IsMouseDoubleClicked(int button);
bool ImGui_IsMouseDown(int button);
bool ImGui_IsMouseDragging(int button = 0, float lock_threshold = -1.0f);
bool ImGui_IsMouseHoveringAnyWindow();
bool ImGui_IsMouseHoveringRect(const vec2 &in r_min, const vec2 &in r_max, bool clip = true);
bool ImGui_IsMouseHoveringWindow();
bool ImGui_IsMouseReleased(int button);
bool ImGui_IsPosHoveringAnyWindow(const vec2 &in pos);
bool ImGui_IsRectVisible(const vec2 &in rect_min, const vec2 &in rect_max);
bool ImGui_IsRectVisible(const vec2 &in size);
bool ImGui_IsRootWindowFocused();
bool ImGui_IsRootWindowOrAnyChildFocused();
bool ImGui_IsRootWindowOrAnyChildHovered();
bool ImGui_IsWindowCollapsed();
bool ImGui_IsWindowFocused();
bool ImGui_IsWindowHovered();
void ImGui_LabelText(const string &in str, const string &in label);  // Note: label is not a format string, unlike in Dear ImGui. Use string concatenation instead
bool ImGui_ListBox(const string &in label, int &inout current_item, const array<string> &in items, int height_in_items = -1);
void ImGui_ListBoxFooter();
bool ImGui_ListBoxHeader(const string &in label);
bool ImGui_ListBoxHeader(const string &in label, const vec2 &in size);
bool ImGui_ListBoxHeader(const string &in label, int items_count, int height_in_items = -1);
bool ImGui_MenuItem(const string &in label, bool selected = false, bool enabled = true);
void ImGui_NewLine();
bool ImGui_NextColumn();
void ImGui_OpenPopup(const string &in popup_id);
void ImGui_PopItemWidth();
void ImGui_PopStyleColor(int count = 1);
void ImGui_PushItemWidth(int item_width);
void ImGui_PushStyleColor(int idx, const vec4 &in col);  // void ImGui_PushStyleColor(ImGuiCol idx, const vec4 &in col)
bool ImGui_RadioButton(const string &in label, bool active);
bool ImGui_RadioButton(const string &in label, int &inout value, int v_button);
void ImGui_ResetMouseDragDelta(int button = 0);
void ImGui_SameLine(float pos_x = 0.0, float spacing_w = -1.0);
bool ImGui_Selectable(const string &in label, bool selected = false, int flags = 0, const vec2 &in size = vec2(0, 0));  // ImGui_Selectable(const string &in label, bool selected = false, ImGuiSelectableFlags flags = 0, const vec2& size = vec2(0, 0))
void ImGui_Separator();
void ImGui_SetColumnOffset(int column_index, float offset_x);
void ImGui_SetCursorPos(const vec2 &in local_pos);
void ImGui_SetCursorPosX(float x);
void ImGui_SetCursorPosY(float y);
void ImGui_SetCursorScreenPos(const vec2 &in pos);
void ImGui_SetItemAllowOverlap();
void ImGui_SetKeyboardFocusHere(int offset = 0);
void ImGui_SetMouseCursor(int type);  // void ImGui_SetMouseCursor(ImGuiMouseCursor type)
void ImGui_SetNextTreeNodeOpen(bool is_open, int cond = 0);  // void ImGui_SetNextTreeNodeOpen(bool is_open, ImGuiSetCond cond = 0)
void ImGui_SetNextWindowCollapsed(bool collapsed, int cond = 0);  // void ImGui_SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0)
void ImGui_SetNextWindowContentSize(const vec2 &in size);
void ImGui_SetNextWindowContentWidth(float width);
void ImGui_SetNextWindowFocus();
void ImGui_SetNextWindowPos(const vec2 &in pos, int cond = 0);  // void ImGui_SetNextWindowPos(const vec2 &in pos, ImGuiSetCond cond = 0)
void ImGui_SetNextWindowPosCenter(int cond = 0);  // void ImGui_SetNextWindowPosCenter(ImGuiSetCond cond = 0)
void ImGui_SetNextWindowSize(const vec2 &in size, int cond = 0);  // void ImGui_SetNextWindowSize(const vec2 &in size, ImGuiSetCond cond = 0)
void ImGui_SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f);
void ImGui_SetScrollHere(float center_y_ratio = 0.5f);
void ImGui_SetScrollX(float scroll_x);
void ImGui_SetScrollY(float scroll_y);
void ImGui_SetTextBuf(const string &in value);
void ImGui_SetWindowCollapsed(bool collapsed, int cond = 0);  // void ImGui_SetWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0)
void ImGui_SetWindowCollapsed(const string &in name, bool collapsed, int cond = 0);  // void ImGui_SetWindowCollapsed(const string &in name, bool collapsed, ImGuiSetCond cond = 0)
void ImGui_SetWindowFocus();
void ImGui_SetWindowFocus(const string &in name);
void ImGui_SetWindowFontScale(float scale);
void ImGui_SetWindowPos(const string &in name, const vec2 &in pos, int cond = 0);  // void ImGui_SetWindowPos(const string &in name, const vec2 &in pos, ImGuiSetCond cond = 0)
void ImGui_SetWindowPos(const vec2 &in pos, int cond = 0);  // void ImGui_SetWindowPos(const vec2 &in pos, ImGuiSetCond cond = 0)
void ImGui_SetWindowSize(const string &in name, const vec2 &in size, int cond = 0);  // void ImGui_SetWindowSize(const string &in name, const vec2 &in size, ImGuiSetCond cond = 0)
void ImGui_SetWindowSize(const vec2 &in size, int cond = 0);  // void ImGui_SetWindowSize(const vec2 &in size, ImGuiSetCond cond = 0)
bool ImGui_SmallButton(const string &in label);
void ImGui_Spacing();
void ImGui_Text(const string &in label);  // Note: label is not a format string, unlike in Dear ImGui. Use string concatenation instead
void ImGui_TextColored(const vec4 &in color, const string &in label);  // Note: label is not a format string, unlike in Dear ImGui. Use string concatenation instead
void ImGui_TextDisabled(const string &in label);  // Note: label is not a format string, unlike in Dear ImGui. Use string concatenation instead
void ImGui_TextWrapped(const string &in label);  // Note: label is not a format string, unlike in Dear ImGui. Use string concatenation instead
void ImGui_TreeAdvanceToLabelPos();
bool ImGui_TreeNode(const ? &in ptr_id, const string &in label);  // Note: label is not a format string, unlike in Dear ImGui. Use string concatenation instead
bool ImGui_TreeNode(const string &in label);
bool ImGui_TreeNode(const string &in str_id, const string &in label);  // Note: label is not a format string, unlike in Dear ImGui. Use string concatenation instead
bool ImGui_TreeNodeEx(const ? &in ptr_id, int flags, const string &in label);  // bool ImGui_TreeNodeEx(const ? &in ptr_id, ImGuiTreeNodeFlags_ flags, const string &in label) - Note: label is not a format string, unlike in Dear ImGui. Use string concatenation instead
bool ImGui_TreeNodeEx(const string &in label, int flags = 0);  // bool ImGui_TreeNodeEx(const string &in label, ImGuiTreeNodeFlags_ flags = 0)
bool ImGui_TreeNodeEx(const string &in str_id, int flags, const string &in label);  // bool ImGui_TreeNodeEx(const string &in str_id, ImGuiTreeNodeFlags_ flags, const string &in label) - Note: label is not a format string, unlike in Dear ImGui. Use string concatenation instead
void ImGui_TreePop();
void ImGui_TreePush();
void ImGui_TreePush(const ? &in ptr_id);
void ImGui_TreePush(const string &in str_id);
void ImGui_Unindent(float indent_w = 0.0f);

Network Functions

Communicate over TCP network sockets with a remote server.

None of these network functions are available to be used in hotspot scripts

uint CreateSocketTCP(string& host, uint16 port);  // Open a TCP socket to a remote server with the given host and port
void DestroySocketTCP(uint socket);  // Close a TCP socket that you previously opened with CreateSocketTCP
bool IsValidSocketTCP(uint socket);  // Verify that the TCP socket id you have is a valid and open
int SocketTCPSend(uint socket, const array<uint8>& data);  // Send data over a TCP socket that you have previously opened with CreateSocketTCP

Classes

class FontSetup;
class GUIState;
class HUDImage;
class HUDImages;
class IMChangeImageFadeOutIn;
class IMChangeTextFadeOutIn;
class IMContainer;
class IMDivider;
class IMElement;
class IMFadeIn;
class IMFixedMessageOnClick;
class IMFixedMessageOnMouseOver;
class IMGUI;
class IMImage;
class IMMessage;
class IMMouseClickBehavior;
class IMMouseOverBehavior;
class IMMouseOverMove;
class IMMouseOverPulseBorder;
class IMMouseOverPulseBorderAlpha;
class IMMouseOverPulseColor;
class IMMouseOverScale;
class IMMouseOverShowBorder;
class IMMoveIn;
class IMPulseAlpha;
class IMPulseBorderAlpha;
class IMSpacer;
class IMText;
class IMTextSelectionList;
class IMUIContext;
class IMUIImage;
class IMUIText;
class IMUpdateBehavior;
class PlaceholderObject;
class SaveFile;
class SavedChunk;
class SavedLevel;
class ScreenMetrics;
class SizePolicy;