-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.BBCode
135 lines (94 loc) · 5.73 KB
/
README.BBCode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
[size=14pt][b]ImGi[/b][/size] [color=gray][b] version 0.2.2 [/b][/color]
[url=https://github.com/ericoporto/ImGi/releases/download/0.2.2/imgi.scm]Get Latest Release [b]imgi.scm[/b][/url] | [url=https://github.com/ericoporto/ImGi]GitHub Repo[/url] | [url=https://github.com/ericoporto/ImGi/releases/download/0.2.2/imgi_demo_windows.zip]Demo Windows[/url] | [url=https://github.com/ericoporto/ImGi/releases/download/0.2.2/imgi_demo_linux.tar.gz]Demo Linux[/url] | [url=https://github.com/ericoporto/ImGi/archive/0.2.2.zip] Download project .zip [/url]
AGS Script Module for Immediate Gui, uses script Overlays to render the interface.
[color=red][glow=white,2,300][b]This is beta quality[/b][/glow][/color], I predict Overlays will enter into fashion in one of the next seasons so this module is being written for when the time comes. 8-)
[img]https://raw.githubusercontent.com/ericoporto/ImGi/main/docs/images/screenshot.gif[/img]
[size=14pt][b]Usage[/b][/size]
[spoiler]
[code=ags]function repeatedly_execute() // In Room Script, use room_RepExec()
{
ImGi.Begin();
if(ImGi.BeginWindow("Hello World", 32, 32, 130, 60, eImGi_Opt_AlignCenter | eImGi_Opt_NoClose))
{
int row[];
row = new int[2];
row[0] = 60; // set a predefined column width size per element in row
row[1] = 70; // this is the width of other column
ImGi.LayoutRow(2 /*n columns*/, row); // rows after this line have such column config
ImGi.Label("A Label:");
if(ImGi.Button("A Button!"))
{
player.Say("You clicked the button!");
}
ImGi.EndWindow();
}
ImGi.End();
}[/code][/spoiler]
[size=14pt][b]Script API[/b][/size]
[spoiler]
ImGi entire API uses static functions and attributes
[size=12pt][b]Basic[/b][/size]
[b][tt]ImGi.Begin[/tt][/b]
[code=ags]void ImGi.Begin()[/code]
Call only once per frame and make sure to call End() after.
[b][tt]ImGi.End[/tt][/b]
[code=ags]void ImGi.End()[/code]
Call only once per frame, after Begin() is called.
[hr]
[size=12pt][b]Layout System[/b][/size]
[b][tt]ImGi.LayoutRow[/tt][/b]
[code=ags]void ImGi.LayoutRow(int count, int widths[], int height = 0)[/code]
Pass an array of widths with count elements to configure the columns in a row. You can optionally specify a height.
[hr]
[size=12pt][b]Window[/b][/size]
A window can be created by a [tt]BeginWindow[/tt] and if this is successful (returns any non false value),
it has to call [tt]EndWindow[/tt] to specify where it logically ends.
All controls must exist within a window.
[b][tt]ImGi.BeginWindow[/tt][/b]
[code=ags]ImGi_Res ImGi.BeginWindow(String title, int x, int y, int width, int height, ImGi_Opt opt = 0)[/code]
Creates a window, make sure to call a matching EndWindow() if this method return is not false.
[b][tt]ImGi.EndWindow[/tt][/b]
[code=ags]void ImGi.EndWindow()[/code]
Has to be called each time a BeginWindow is successful once all elements inside the window are listed
[b][tt]ImGi.OpenWindow[/tt][/b]
[code=ags]void ImGi.OpenWindow(String title)[/code]
If a window of matching title is closed, it opens again.
[hr]
[size=12pt][b]Controls[/b][/size]
Controls are things you can place inside a window. Controls cannot exist outside of windows.
Every controls takes a string as label, this string can't be empty and can't match the label of other control.
[b][tt]ImGi.Label[/tt][/b]
[code=ags]void ImGi.Label(String label)[/code]
[img]https://raw.githubusercontent.com/ericoporto/ImGi/main/docs/images/ctrl_label.gif[/img]
This control is a Label containing the specified text. It has no interaction.
[b][tt]ImGi.Text[/tt][/b]
[code=ags]void ImGi.Text(String text)[/code]
[img]https://raw.githubusercontent.com/ericoporto/ImGi/main/docs/images/ctrl_text.gif[/img]
This control is a Multiline Label for visualization only. It has no interaction.
[b][tt]ImGi.TextBox[/tt][/b]
[code=ags]String ImGi.TextBox(String label, String buf, int bufsz, ImGi_Result* res = 0, ImGi_Opt opt = 0)[/code]
This control is an editable TextBox. Click on it to give focus and enter the text input with the keyboard. Enter exits focus.
[b][tt]ImGi.Button[/tt][/b]
[code=ags]ImGi_Res ImGi.Button(String label, ImGi_Icon icon = 0, ImGi_Opt opt = eImGi_Opt_AlignCenter)[/code]
[img]https://raw.githubusercontent.com/ericoporto/ImGi/main/docs/images/ctrl_button.gif[/img]
This control is a Button. When clicked, it will return a value different than false.
[b][tt]ImGi.CheckBox[/tt][/b]
[code=ags]ImGi_Res ImGi.CheckBox(String label, CheckBoxState* chkst)[/code]
[img]https://raw.githubusercontent.com/ericoporto/ImGi/main/docs/images/ctrl_checkbox.gif[/img]
This control is a CheckBox. It doesn't store state, so make sure to pass it's state.
[b][tt]ImGi.Number[/tt][/b]
[code=ags]ImGi_Res ImGi.Number(String label, ImGi_Real* value, float step = 0, ImGi_Opt opt = 0)[/code]
[img]https://raw.githubusercontent.com/ericoporto/ImGi/main/docs/images/ctrl_number.gif[/img]
This control shows a Number, set step to allow quick mouse drag adjustments. Holding shift and clicking it allows entering input with the keyboard.
[b][tt]ImGi.Slider[/tt][/b]
[code=ags]ImGi_Res ImGi.Slider(String label, ImGi_Real* value, float low, float high, float step = 0, ImGi_Opt opt = 0)[/code]
[img]https://raw.githubusercontent.com/ericoporto/ImGi/main/docs/images/ctrl_slider.gif[/img]
This control is a Slider.
[hr]
[size=12pt][b]Style and Design customization[/b][/size]
[b][tt]ImGi.Style[/tt][/b]
[code=ags]ImGi_Style* ImGi.Style[/code]
Holds the Current Style for ImGi.
[hr][/spoiler]
[size=14pt][b]License[/b][/size]
This code is licensed with MIT [url=https://github.com/ericoporto/ImGi/blob/main/LICENSE][tt]LICENSE[/tt][/url]. The code on this module is based on rxi's Microui, which is also MIT licensed, referenced in the license, this port though has many changes - lots of new bugs too.