Third Party Tools / GUI Library for GameGuru

Author
Message
gaussmake1994
8
Years of Service
User Offline
Joined: 25th Jul 2015
Location:
Posted: 31st Jul 2015 23:00 Edited at: 5th Aug 2015 03:29
I realized "simple" GUI library for GameGuru. Tested on 1.01.0033.

Source code available at : https://github.com/alex4321/GameGuruUi .
Binary libraries link
v0.1 : https://www.dropbox.com/s/l1rnienvky18xd2/gameguruui-0.1.zip?dl=0
older: https://www.dropbox.com/s/sjvw5ra55rberhc/gameguruui.zip?dl=0

For installation you need to unpack all these libraries to GameGuru folder (e.g. C:\Program Files (x86)\Steam\steamapps\common\Game Guru) and require it from global.lua be next code :


UI based on "layers" (can be non-modal - e.g. for HUD, but in this case all input getted by game, not UI) and "modal" - can be used for input (e.g. dialogs).
Each layer contains one or more "blocks", that described by html files.

Next is examples (maybe later I'll create full demo project).

Non-modal layer (to show health)

E.g. , you have next LUA code :


"Line-by-line" description :
- it's load all blocks from "Files/uilayerbank/main/*.html" files, and pass health and healthMax variables.


informs our layer (and - this blocks) set new value to "health"

Let's see, how we can build block.

E.g. we have next Files/uilayerbank/main/healthbar.html

About body attributes:
- data-x, data-y - coords in pixels
- data-x-alignment - can be 'left', 'right', 'center'
- data-y-alignment - can be 'top', 'bottom', 'center'
So it's placed at top left corner.
- data-width, data-height - size in pixels
- data-cutby - path to widget region form mask. Basically, it'll be rectangle, but we can use image with alpha-channel to make non-standart form. In this example image must be in Files/uilayerbank/main/healthbar.png

And, finally - about JS.
You must implement next functions at all blocks:
- function filledBindings();
- function updateBinding(variableName);
You can get variable value by 'variables.get(variableName)', and set by 'variables.set(variableName, value)'

E.g.
healthbar.js

When block initializing - filledBindings function called.
When variabled updated by LUA, or from other block - updateBinding called.
In this example - both functions call updateHealth, that get 2 variable values.



Modal layers


In most - it's seems to non-modal layers. But in this mode you can get input.

E.g. we have next Lua code:

Line-by-line :

It'll load layer (same as non-modal)

Show layer and wait for exit from it (block mut set modalOpened variable to 0).

Get "dialogResult" variable value, and save it to local answer variable.

And we have next HTML :

As you can see - button "onclick" functions set two variables:
- dialogResult - used in out LUA code
- modalOpened - setting it to 0 will close modal layer.


Modal layer cursor changing
Now I implemented setting new cursor pointer for modal layers.
If you would use it - add "config.ini" with cursor parametrs in layerpath (e.g. "Files/uilayerbank/dialog/config.ini" for "dialog" layer at top example)
Parameters must be some lke next :

where "cursor" is path (relative to layer path). In this example - it'll be "Files\uilayerbank\dialog\cursor.png"
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 31st Jul 2015 23:12
Ok, looks great, can we get a video of what it can do? Some screen shots?

Thanks
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

gaussmake1994
8
Years of Service
User Offline
Joined: 25th Jul 2015
Location:
Posted: 31st Jul 2015 23:58 Edited at: 1st Aug 2015 00:00
Demo project files here : https://www.dropbox.com/s/p3xa732dduppmno/Demo.zip?dl=0
Screenshots:
At start

Damage getted, new value at healthbar:

Dialog:

About video - maybe some later.
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 1st Aug 2015 01:06
Excellent. Thank you.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

gaussmake1994
8
Years of Service
User Offline
Joined: 25th Jul 2015
Location:
Posted: 1st Aug 2015 01:19 Edited at: 1st Aug 2015 03:27
Now it need some refactoring (yes, code is horrible ), and changes.
Not implemented:
- windowed mode (as I can see, now GameGuru not used it, but it better to implement it for library, because it's mustn't be difficult).
- changing cursor pointer for modal layers (yes, you can change it by CSS for block, but now whole layer).
Maybe I'll implement it in next 2-3 days.
gaussmake1994
8
Years of Service
User Offline
Joined: 25th Jul 2015
Location:
Posted: 1st Aug 2015 11:56 Edited at: 1st Aug 2015 21:12
Cursor changing implemented.
See details and new binaries link at top post.

upd.
Added 'void fpscUiDestroyLayer(int id)' to unload non-necessary layers.
See details (updated dialog example) and new binaries link at top post.
gaussmake1994
8
Years of Service
User Offline
Joined: 25th Jul 2015
Location:
Posted: 5th Aug 2015 03:30
Fixed some issues with library unloading.
You can download v0.1 here - https://www.dropbox.com/s/l1rnienvky18xd2/gameguruui-0.1.zip?dl=0
stor
9
Years of Service
User Offline
Joined: 27th Feb 2015
Location:
Posted: 23rd Sep 2015 07:22
Can I add advertising on the game with your extension??? Like Google's ads because it works with HTML??? If so it's really good extension.
PM
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 25th Sep 2015 17:23
Thanks for sharing gaussmake1994.

Looks like it needs some other QT dependencies to make it run though - fails with "QT Windows Plugin" required?

Cheers.
gaussmake1994
8
Years of Service
User Offline
Joined: 25th Jul 2015
Location:
Posted: 26th Oct 2015 21:42 Edited at: 29th Oct 2015 20:36
Sorry, I can't check it earlier.
About Qt dependencies - if demo project crashes - try to install latest Qt creator and copy libraryes from it.
About ads - yes, you can (seems like it's need "non-modal" layer in this case).
Also, soon (maybe 4-5 days, but most like week) I'll fix one bug with switching of windows (in some cases - it's not switches back after using of modal layers) and provide more examples.

UPD. bug with windows switching fixed. Now I works for example project. Also, I implemented part of my lua-side library that will provide "variable bindings" for it (you will just type next :

and it'll update layer variable automatically)
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 4th Nov 2015 08:32
looks interesting, will have a look when I get more time
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; LG TFT monitor (widescreen). Wanting a new PC at some point.
Interests: Drumming, Saxophone, Art, Theatre, Music.

Login to post a reply

Server time is: 2024-03-28 19:15:09
Your offset time is: 2024-03-28 19:15:09