Skip to content

Commit

Permalink
to version 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ericoporto committed Feb 17, 2021
1 parent 12859a0 commit 6346388
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 22 deletions.
19 changes: 13 additions & 6 deletions README.BBCode
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[size=14pt][b]ImGi[/b][/size] [color=gray][b] version 0.2.2 [/b][/color]
[size=14pt][b]ImGi[/b][/size] [color=gray][b] version 0.3.0 [/b][/color]
[url=https://ci.appveyor.com/project/ericoporto/imgi][img]https://ci.appveyor.com/api/projects/status/tq90vg1if9bvdyie?svg=true[/img][/url]

[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]
[url=https://github.com/ericoporto/ImGi/releases/download/0.3.0/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.3.0/imgi_demo_windows.zip]Demo Windows[/url] | [url=https://github.com/ericoporto/ImGi/releases/download/0.3.0/imgi_demo_linux.tar.gz]Demo Linux[/url] | [url=https://github.com/ericoporto/ImGi/archive/0.3.0.zip] Download project .zip [/url]

AGS Script Module for Immediate Gui, uses script Overlays to render the interface.

Expand Down Expand Up @@ -96,7 +97,9 @@ 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.
This control is an editable TextBox. Click on it to give focus and enter the text input with the keyboard. Enter exits focus.

The character limit is defined in [color=grey][b][tt]bufsz[/tt][/b][/color]. This function will return the [color=grey][b][tt]buf[/tt][/b][/color] String modified, just assign it to the same String so it's content can be updated.

[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]
Expand All @@ -111,16 +114,20 @@ This control is a Button. When clicked, it will return a value different than fa
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]
[code=ags]ImGi_Res ImGi.Number(String label, ImGi_Real* value, float step = 0, String format = 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.

You can pass a format string similar to the one used with String.Format to specify how the number should be rendered. It's a float, so make sure to use either `"%f"` or `"%g"`.

[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]
[code=ags]ImGi_Res ImGi.Slider(String label, ImGi_Real* value, float low, float high, float step = 0, String format = 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.
This control is a Slider. You can adjust it manually with the mouse or you can hold shift and click to specify a value with the keyboard.

You can pass a format string similar to the one used with String.Format to specify how the number should be rendered. It's a float, so make sure to use either `"%f"` or `"%g"`.
[hr]

[size=12pt][b]Style and Design customization[/b][/size]
Expand Down
2 changes: 1 addition & 1 deletion imgi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<Name>ImGi</Name> <!-- set the module name -->
<Description>Script Module for Immediate Gui</Description> <!-- set the module description -->
<Author>eri0o</Author> <!-- set the module author -->
<Version>0.2.2</Version> <!-- set the module version -->
<Version>0.3.0</Version> <!-- set the module version -->
<Key>488029724</Key> <!-- set the module unique key -->
</AGSModule>
2 changes: 1 addition & 1 deletion imgi_demo/Game.agf
Original file line number Diff line number Diff line change
Expand Up @@ -4655,7 +4655,7 @@
<Name>ImGi</Name>
<Description>Script Module for Immediate Gui</Description>
<Author>eri0o</Author>
<Version>0.2.2</Version>
<Version>0.3.0</Version>
<Key>488029724</Key>
<IsHeader>False</IsHeader>
</Script>
Expand Down
57 changes: 45 additions & 12 deletions imgi_demo/imgi.asc
Original file line number Diff line number Diff line change
Expand Up @@ -2053,10 +2053,24 @@ int _ImGi_Calculate_Command_Hash()
}
return hn;
}

// this is limited by the number of Overlays
// It should be 20 in 3.5 and below, but we are bending to use only 1 overlay and paying the price in performance
// select SO or MO
// - SO: Single Overlay Rendering, slower but more compatible
// - MO: Multiple Overlay Rendering, can break in AGS3 but it's faster

// MAX_CLIPS is limited by the number of Overlays
// It should be 20 in 3.5 and below
////- MO -////
//#define MAX_CLIPS 20
//#define R_CLEAR r_mo_clear
//#define R_RENDER_CLIPS r_mo_render_clips

///- SO -////
// in SO mode, clips are just bitmaps
#define MAX_CLIPS 60
#define R_CLEAR r_so_clear
#define R_RENDER_CLIPS r_so_render_clips


struct R_Clips {
int x;
int y;
Expand Down Expand Up @@ -2088,8 +2102,7 @@ void r_set_clip_rect(int r_x, int r_y, int r_w, int r_h)
_clips[r_c_i].srf = _clips[r_c_i].spr.GetDrawingSurface();
}


void r_clear()
void r_mo_clear()
{
r_c_i = -1;
for(int i=0; i<MAX_CLIPS; i++) {
Expand All @@ -2106,6 +2119,24 @@ void r_clear()
r_set_clip_rect(0, 0, Screen.Width, Screen.Height);
}

void r_so_clear()
{
r_c_i = -1;
for(int i=0; i<MAX_CLIPS; i++) {
if(_clips[i].spr != null) {
_clips[i].spr.Delete();
_clips[i].spr = null;
}
}
if(_clips[0].ovr != null) {
_clips[0].ovr.Remove();
_clips[0].ovr = null;
}

r_set_clip_rect(0, 0, Screen.Width, Screen.Height);
}



void r_draw_rect(int r_x, int r_y, int r_w, int r_h, int color) {
_clips[r_c_i].srf.DrawingColor = color;
Expand Down Expand Up @@ -2140,9 +2171,8 @@ void r_draw_icon(int r_x, int r_y, int r_w, int r_h, int color, int id) {

}

void r_render_clips()
void r_mo_render_clips()
{
/* //proper way with multiple overlays
for(int i=0; i<r_c_i+1; i++)
{
if(_clips[i].srf != null) {
Expand All @@ -2153,8 +2183,11 @@ void r_render_clips()
_clips[i].ovr = Overlay.CreateGraphical(_clips[i].x, _clips[i].y, _clips[i].spr.Graphic, true);
}
}
*/

}

void r_so_render_clips()
{

//hacky way with a single overlay
_clips[0].srf = _clips[0].spr.GetDrawingSurface();
for(int i=1; i<r_c_i+1; i++)
Expand Down Expand Up @@ -2234,7 +2267,7 @@ void r_render()


// things changed so we will clear and re-render
r_clear();
R_CLEAR();
ImGi_Cmd* cmd;
for(int i=0; i<_ImGi.stk_cmd_index; )
{
Expand All @@ -2249,7 +2282,7 @@ void r_render()
i++;
}

r_render_clips();
R_RENDER_CLIPS();
}

//// HACKS
Expand Down Expand Up @@ -2281,7 +2314,7 @@ void on_event (EventType event, int data)
if(event == eEventLeaveRoom)
{
// make sure no Overlay is left behind!
r_clear();
R_CLEAR();
}
}

Expand Down
2 changes: 1 addition & 1 deletion imgi_demo/imgi.ash
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ImGi Module Header
//
// ImGi Version 0.2.3
// ImGi Version 0.3.0
//
// ImGi is a Immediate GUI for Adventure Game Studio!
// Create dynamic GUIs through AGS Script, rendered to screen using Overlays.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"name": "ImGi",
"text": "Module for Immediate Gui, uses script Overlays to render the interface.",
"forum": "https://www.adventuregamestudio.co.uk/forums/index.php?topic=58842.0",
"version": "0.2.2",
"version": "0.3.0",
"author": "eri0o"
}

0 comments on commit 6346388

Please sign in to comment.