Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit/AppGameKit Studio Showcase / [GUI Plugin] Nuklear an immediate-mode graphical user interface

Author
Message
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 23rd Jan 2021 13:28 Edited at: 23rd Jan 2021 15:09
After having the flu, this user interface is the best thing so far
You did a great job! 1337

Recently, I found a bug in the clipboard functionality of agk. It can't copy/paste cyrillic utf-8 well,
so as you have multi language support, this will be a good fix.
I would be glad if you can also implement it in your plugin,
Also, I have attached you the source code of the functions aswell

Please take a look at the demo plugin:
https://forum.thegamecreators.com/thread/227267


or directly in the cpp:



Also I found a strange bug on some unspecific devices.
=> They just do not render the UI, except the selected image from ComboBeginImageLabel, but no crash, no special entry in the nuklear.log.
AGK rendering works fine though and mouseclick detection of the UI elements aswell.
I've attached you a screenshot two screenshots


Is there a chance to change the nuklear.log raw writing path in the future?
I'd like to unify all software log files in one folder.

Attachments

Login to view attachments
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 24th Jan 2021 07:11
Thank you for reporting this issue.
And a big thank you for share your code.

I worked out my own solution from your code and some google.
THANK YOU again!

Quote: "Is there a chance to change the nuklear.log raw writing path in the future?
I'd like to unify all software log files in one folder."

You mean, so that you can define the path yourself?
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 27th Jan 2021 13:47 Edited at: 27th Jan 2021 13:56
Quote: " You mean, so that you can define the path yourself?
"

Exactly
like nk.SetLogPath("C:/RAWtotalLOGpath")
This would be awesome.

Is there any reason why the screen stays black on some unspecific devices? Or is it one of the stff you already mentioned?

MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 27th Jan 2021 18:27 Edited at: 27th Jan 2021 18:28
Quote: "Is there any reason why the screen stays black on some unspecific devices? Or is it one of the stff you already mentioned? "


I haven't noticed that yet. Do you have a concrete example?
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 27th Jan 2021 23:10 Edited at: 27th Jan 2021 23:11
@MadBit, I have added this to a 3D project and was getting an odd artefact flash for a frame or 2 when I zoomed the camera, what appears to be a tiny box at 0,0,0 but not anything I have created

I changed nkSync as follows and it stops, thought I'd mention it in case anyone else has this issue



Also, when creating a stand alone dialog with NKDLG_MB_WINDOW there is a transparent line between the header and body background, I changed nk.Render(0)<< from 1 and it draws correctly, what are the parameters for nk.Render? and could anything go wrong by setting this to 0, the examples seem to work with 0
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 28th Jan 2021 04:57
Quote: " I have added this to a 3D project and was getting an odd artefact flash for a frame or 2 when I zoomed the camera, what appears to be a tiny box at 0,0,0 but not anything I have created"

I have not yet tested Nuklear with 3D scenes, so I did not notice this.
I had to create a dummy object to draw the Nuklear surface.
Agk seems to set some OpenGL states in the background that Nuklear needs.
Thank you for finding a solution for this as well.
If you don't mind, I'll adopt it as well, if I can't find anything else.

Quote: "Also, when creating a stand alone dialog with NKDLG_MB_WINDOW there is a transparent line between the header and body background, I changed nk.Render(0)<< from 1 and it draws correctly, what are the parameters for nk.Render? and could anything go wrong by setting this to 0, the examples seem to work with 0"

I noticed that too, but I didn't know what that could be because I haven't had time to deal with it yet.
Now that you also write here the solution for it. Is that also comprehensible.
The parameter at nk.Render only switches the antialiasing on(1) or off(0).
So it is safe to set this parameter to 0.
Again, thanks for finding and solving this.


Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 28th Jan 2021 07:33
Quote: "I changed nkSync as follows and it stops"


forget that fix, I cant make it stop without messing up the draw order,

Quote: "I had to create a dummy object to draw the Nuklear surface."


OK, I was checking, rechecking my code looking for the creation of a rouge cube lol, it seems this object is causing problems with a 3d scene, agk is setting it visible for a couple of frames, maybe a drawcall from the plugin and the cube makes it to the buffer, my fix does not fix it, I'm not sure what happened I was sure it was working.

I will continue testing, this is a great plugin the more I'm looking at here the more I am liking it, I hope we can get this 3D thing sorted
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 28th Jan 2021 12:06 Edited at: 28th Jan 2021 12:12
Quote: "Do you have a concrete example?"


As far as I know, the blackscreen can be created by any code where nk.Render() is called, but not on all computers.
I could not find anything more specific right now, as I do not have a device, that can't render nuklear.
The hardware spectrum of these devices is huge aswell. No chance to pinpoint it on OS or hardware.
There was also no information in nuklerar.log, and only the image from ComboBeginImageLabel was rendered on screen,
like that:

(even though nothing is visible, every button, checkbox and editbox on the screen seems to work)


And this is how it looks on my devices:



I really have no clue why the flag is not affected. Maybe because its a prebuffered AppGameKit image?
I will try to run OpenGL diagnosis apps on these devices and compare.
Maybe it's driver related?

MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 28th Jan 2021 13:29 Edited at: 28th Jan 2021 13:32
@PartTimeCoder
The plugin creates a cube of size 2x2x2 and turns off the collision. Then the position of the cube is set to the position of the camera.
With every call of nk.Render the position of the cube is set to the position of the camera again. This is the problem. The position is corrected AFTER the scene is rendered. So the cube is visible as soon as the step size is greater than 2.
I can think of 2 solutions to do first. I set the size of the cube high. Maybe to 20, or I set the cube to transparent.
How this affects the rendering of the UI, I still have to test.

@Jack
This behavior is new to me. Try using nk.Render(0) in the nkSync() function.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 28th Jan 2021 18:47
No changes occured with nk.Render(0). Strange :/

PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 28th Jan 2021 21:26
Quote: "The plugin creates a cube of size 2x2x2 and turns off the collision."


Yes I see, if I set the step size in my zoom function to 1 then I do not see the cube but zooming takes forever, if I set it to 2 and zoom slowly it does not show, skip more than 2 steps in a frame and it shows.

I don't know if setting the size will work, in theory if you make it large enough we will just see through the backfaces which would fix the issue but I seem to be seeing the box at the cameras previous location so it would need to be very big, the faster the camera moves the smaller the cube becomes and the larger it needs to be to see through the back faces.

maybe you could expose a function to get the id of the object and we can set the size as required, a bit of a hack I know but if all else fails it could work.

MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 29th Jan 2021 04:47
@PartTimeCoder
First tests looked good by setting the box to full transparency.
However, what I would also like to do is when the current scene renders 3d objects to automatically hide my box.
I'm not sure, but wasn't there a command in Agk to find out how many objects were rendered?
I just can't find that command anymore.

@JackJack
How do the systems differ in detail?
Possibly a driver problem (update?)
Same AppGameKit version?
This weekend I will release a new update in which also the log will give one/two more information.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 29th Jan 2021 16:33
Quote: "First tests looked good by setting the box to full transparency."


excellent news

Quote: "I just can't find that command anymore."


No, neither can I, but we can get the number of vertices and polygons drawn, the below function seems to work just fine in detecting a 3D scene

PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 29th Jan 2021 21:28
In one of the examples you make a style with

nk.StyleMake("tab_button_active", "<button normal='grey' hover='grey' active='grey' rounding='0'/>")

where is the color value for "grey" defined and is there a list of predefined color values

Edit: Where can I find info on the style xml setup and available tags?

MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 29th Jan 2021 22:05
With StyleMakeItem you can define an color, imge or 9patch-image.
In this case it is this line to define the color
nk.StyleMakeItem("<styleitem name='grey' color='60,60,60'/>")

In the documentation you can find a function overview. (About Styling)
In the download package there is a folder (doc/source) containing a file called default.skin. Here you can see all the possible tags that you can set for each widget.

here in short the xml-file
default.skin
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 29th Jan 2021 23:20
Ah right I get it, thanks
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 30th Jan 2021 07:36
As promised, here is a new update.
You can find the download in the first post.

@Jack
I have changed something in the shaders. Please check if you still have the black screen.
There is more information about the GL renderer in the log that you can also compare, thank you.

[2021-01-30]
- [ADD] LogSetLocation(path) - Sets the location of the log file.
- [ADD] WindowGetFlags() - Get the current flags of current window.
- [ADD] GetAgkRenderSprite - You can get the render sprite. Supported only if FixedVirtualResulotion is set to 1.
- [ADD] GetAgkRenderImage - You can get the render image to do something special . Supported only if FixedVirtualResulotion is set to 1.
- [ADD] HandleInput(x,y) - Offers the possibility to pass own mouse coordinates.
- [ADD] FixedVirtualResulotion(state) if state is set to 1, the UI scales with the AppGameKit window. default is 0 Virtual resolution is set to device size.
- [FIX] Bug with 3d scene display and moving camera. Appearing of a box.
- [FIX] Solve an Input issue. (repeated chars in input box).
- [FIX] UTF-8 support for clipboard (cut/copy/paste).
- [FIX] Overlapping windows where the close buttons are on top of each other are partially closed together.
- [FIX] UI scaled similar to AGK-Window shrinking - growing with left/right or top/bottom border.
- [FIX] Adjusted window behaviour when scaling.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 30th Jan 2021 09:13 Edited at: 4th Feb 2021 20:05
Hi MadBit,
After installing the new version, Windows 10 erases automatically the Nuklear folder of my project (C:\Projects AGK\sprfactory\Plugins\Nuklear).
Do you have any idea if there is a virus threat? If no, can someone give me a tip of how to override this Windows 10 protection?

EDIT: I reinstalled them all (agk2 & plugin) and everything runs OK, except the application with the new version of the plugin
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 30th Jan 2021 13:37 Edited at: 30th Jan 2021 13:43
With the new version the code bellow will not work if the window is closed ( nk.WindowClose(szWindowTitle) ):


The following will work:


BTW: where is the function 'nk.WindowClose' useful?
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 30th Jan 2021 15:54
Quote: "With the new version the code"


I also noticed this behaviour in the old code but I think this is expected, nk.WindowBegin returnd 0 if the window is minimized also, so having nk.WindowEnd inside the if statement and the window is minimized then it gets messed up

I will have to run some tests as I have not used nk.WindowClose yet, but it seems we may have a conflict of usage... I'll check

Quote: "As promised, here is a new update."


Thankyou very much MadBit, that fixed the 3D issue, it now seems to be working perfectly.
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 30th Jan 2021 16:31
@george++

From what I can gather, nk.WindowBegin returns 1 if the window is visible and maximized, 0 if minimized, hidden or closed, there does not appear to be any internal management of the window states, I think we are responsible for keeping track of window states and adjust the code accordingly

Quote: "BTW: where is the function 'nk.WindowClose' useful?"


nk.WindowClose does not seems to set any internal states, if a window is closed on next loop it reads the code and reopens the window in its original location, so as above we need to manage windows states in our own code, I would use nk.WindowClose for example : a title less window that auto closes when the user clicks anywhere outside the window or opening and closing windows from a "View" menu item etc etc, putting a close button the window is good for the user to close the window but sometimes we need to close them programmatically.

I am still getting to grips with this plugin there is a lot to take in
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 30th Jan 2021 18:56 Edited at: 30th Jan 2021 19:05
That is partially correct. With WindowClose a flag is being set internally that the window is not visible. The same as you create a window with the flag NK_WINDOW_CLOSED. The window can be made visible again with WindowShow.

Here is a snippet that may provide a little more clarity. ( I hope so. )
win_state as integer[3]



EDIT:
PartTimeCoder wrote: "I also noticed this behaviour in the old code but I think this is expected, nk.WindowBegin returnd 0 if the window is minimized also, so having nk.WindowEnd inside the if statement and the window is minimized then it gets messed up"

Yes you are right.
It is necessary to execute the command WindowEnd directly after the if / endif.
However, this is only the case with Windows and panels.
For widgets such as chart and combobox, for example, they must be located IN the if Endif statement.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 30th Jan 2021 19:53
Quote: "Here is a snippet that may provide a little more clarity. "


Yes, perfectly clear.

Quote: "For widgets such as chart and combobox, for example, they must be located IN the if Endif statement."


ok, I get it, that makes sense
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 30th Jan 2021 22:04 Edited at: 31st Jan 2021 01:43
Thank you for the update
I will try the opengl related stuff as soon as I can, I will report results



I tried to set a different path with LogSetLocation, but failed miserably, not even "C:\" works for me as path.

I have also found out, that the utf8 example string can't be read from russian clipboard:

Some symbols are missing (I use the segoeui.ttf font and NK_GLYPHRANGE_CYRILLIC)
Looks like special phonetic characters in order to create something like the " ê è é " are missing.
Maybe there are more glythranges realted to cyrillic?


I have also problems to paste long (non ascii) text into the editbox, it just does not paste anything on russian, but english works fine with longer text.
This text cant be pasted into an editbox:



Pasting russian text into an non CYRILLIC font editbox may result in a crash.
Also pasting russian text from an editbox into a texteditor may also result in a crash.
It looks like the crashs are related to the copied string length. Longer strings will always crash.
EDIT:
Copy pasting non cyrillic text from one editbox to another results in a crash.

george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 30th Jan 2021 22:34
Quote: "I think we are responsible for keeping track of window states and adjust the code accordingly"

You are right. I can post some functions that makes my life easier if you want.
My project was crashing until I found that I was calling the function 'nk.WindowEnd()' without prior call of the function 'nk.WindowBegin'
I think I am done with it, but know I am trying to achieve the following:
Create a modal window (this is useful in windows such as Preferences, Exit dialog etc.)
Catch the ENTER event in an edit box
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 1st Feb 2021 06:30
@Jack
Sorry for the inconvenience. I didn't test the changes enough.
I have already found the problem with the crashes. I just passed a wrong pointer to the clipboard.
Theoretically, I have also eliminated the missing characters. But this opens up a new problem.
What was missing were combination characters, i.e. in the utf code two characters are transmitted and should be combined.
For example, 'o' and ''' - Nuklear can't do that. I have already changed the code so that the characters are rendered correctly.
But the string length and output length calculations still need to be adjusted.
I just want to say that I am on it. And working on the solution.

@george++
I don't know if there is a basic function or flag of a modal window.
I think you have to do this yourself by opening the other windows with the flag NK_WINDOW_NOT_INTERACTIVE when you open the window.

To catch the ENTER event you have to open the editbox with the flag NK_EDIT_SIG_ENTER.
Now you get to check the flag NK_EDIT_COMMITED with EditGetLastEvent.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 1st Feb 2021 18:35
@Jack
Please check your email. I have sent you a new version. Please check it and tell me if it works for you according to your wishes.

Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 1st Feb 2021 19:03
Thank you for your efforts!
I have not recieved any sort of mail right now^^ maybe due to provider blocking dlls or exe files.

I have attached you two logs,
one of my machine, and one of a machine where the nuklear does render a black screen.
Both machines have nvidia cards, the not working one is the GTX960
- There are quite some differences in the logs, maybe this may help here.

Attachments

Login to view attachments
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 1st Feb 2021 19:35
May be in a spam folder?
I've zipped the dlls.

the 'not_working' protocol is with an old version of the plugin. Please use the same new version on both systems.
I wanted to see the gl information.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 1st Feb 2021 20:14
Spam is empty aswell

I am sorry, got an older file from the other side that I have not checked, my bad.
We've done another testrun.
The only difference is the driver version:

Working:
gl version: 4.6.0 NVIDIA 461.40

Not Working:
gl version: 4.6.0 NVIDIA 461.09

I don't think this is the reason.
All other chars, beside absolute path, are identical.



MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 1st Feb 2021 20:27
I have sent it to you again and renamed the dll files.

I think the same glsl version will have been initialised.
I'm running out of ideas why it doesn't work on this system.

There is one more thing you can try.
Directly after nkInit(), execute the command nk.FixedVirtualResulotion(1).
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 1st Feb 2021 20:36 Edited at: 1st Feb 2021 20:38
I think my mail provider checks for headers, there is still no mail.
Maybe a short upload will do:
https://filebin.net/

nk.FixedVirtualResolution(1) after nk.init - Made the screen on both machines pitch black, not even the imgslot images are rendered.
At least we made some progress. Both machines have unified output now.

MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 1st Feb 2021 20:47
What about the nuklear demos?
Do they work?

I've sent you a PM now.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 4th Feb 2021 10:56
Ok, here is another update. Since the last one had some serious bugs, this update comes a bit earlier than I wanted.
I hope it works better than the last one.

Now there is a file called 'nk.agc.tag' in the package. You can copy this file into the Agk-Editor folder if you want.
$(AppGameKit2_Folder)/Tier 1/Editor/data/tags)

Then codecompletion will also work for the plugin.
I don't know if it works under Studio.

Further changes can be found in the Changlog.

[2021-02-04]
- [ADD] Style helper function nkStyleSetWindow / nkStyleGetWindow
- [ADD] Style helper function nkStyleSetWindowHeader / nkStyleGetWindowHeader
- [ADD] Style helper function nkStyleSetTab / nkStyleGetTab
- [ADD] Style helper function nkStyleSetProperty / nkStyleGetProperty
- [ADD] Style helper function nkStyleSetScrollbar / nkStyleGetScrollbar
- [ADD] Style helper function nkStyleSetSlider / nkStyleGetSlider
- [ADD] Style helper function nkStyleSetCombo / nkStyleGetCombo
- [ADD] Style helper function nkStyleSetChart / nkStyleGetChart
- [ADD] Style helper function nkStyleSetProgress / nkStyleGetProgress
- [ADD] Style helper function nkStyleSetSelectable / nkStyleGetSelectable
- [ADD] Style helper function nkStyleSetOption / nkStyleGetOption
- [ADD] Style helper function nkStyleSetCheckbox / nkStyleGetCheckbox
- [ADD] Style helper function nkStyleSetButton / nkStyleGetButton
- [ADD] Style helper function nkStyleSetText / nkStyleGetText
- [ADD] Nuklear tags for geany (copy 'nk.agc.tags' file to $(AppGameKit2_Folder)/Tier 1/Editor/data/tags).
- [FIX] Prevents a transparent line from appearing below the title bar when using the NK_WINDOW_DYNAMIC flag.
- [FIX] Drawing correct border color for property-widget.
- [FIX] Typo in LogSetLocation. Now it works correctly.
- [FIX] Linux - fix render position of combined marks.
- [FIX] Copying from one editbox to the next caused the app to crash.
- [FIX] Support for combined marks in utf8 strings.

You can find the download in the first post.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 4th Feb 2021 19:47 Edited at: 4th Feb 2021 19:48
Thank you MadBit for this new update,

Quote: "
To catch the ENTER event you have to open the editbox with the flag NK_EDIT_SIG_ENTER.
Now you get to check the flag NK_EDIT_COMMITED with EditGetLastEvent.
"


Do you mean something like this?


It does not work. If I place a breakpoint in the if block, then the AppGameKit won't trigger it
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 4th Feb 2021 21:01
nk.EditGetLastEvent() returns flags. So you should compare the return value with bitwise AND.

Correct would be

if nk.EditGetLastEvent() && NK_EDIT_COMMITED > 0
// do something
endif
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 8th Feb 2021 09:59 Edited at: 8th Feb 2021 10:01
Quote: "Now there is a file called 'nk.agc.tag' in the package. "


Thats a massive help, thanks

Quote: " I can post some functions that makes my life easier if you want."


Sure I'd be interested to see how you simplified things

Quote: "- [FIX] Prevents a transparent line from appearing below the title bar when using the NK_WINDOW_DYNAMIC flag."




Unfortunately not, with no title bar the line reappears, lol
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 8th Feb 2021 18:38 Edited at: 8th Feb 2021 18:39
Quote: "Unfortunately not, with no title bar the line reappears, lol"

Yes, but I think I have already fixed that (next update).
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 8th Feb 2021 18:39 Edited at: 8th Feb 2021 18:47
Quote: "Sure I'd be interested to see how you simplified things"


Here is what I've coded so far, but take into account that I am still learning...
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 8th Feb 2021 19:11
Quote: "Yes, but I think I have already fixed that (next update)."


Awesome

Quote: "Here is what I've coded so far, but take into account that I am still learning..."


Looking at your code has given me some ideas, thanks

BTW, the forum wont let me open the code box, is it formatted correctly?


The "Copy" button works though, I have never seen this before ,lol
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 9th Feb 2021 11:32 Edited at: 9th Feb 2021 11:33
Quote: "BTW, the forum wont let me open the code box, is it formatted correctly?"

You are right. It should work OK now
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 28th Feb 2021 07:16
Hi ,
I now give you a new update. This time it is more of a style update.
There are now new symbols available, I have also added two new styles. A Dark and a Light style. You activate them with nkInitStyle(x).
x = 1 -> Dark Style, x = 2 -> Light Style, x = 0 -> Default Style
Checkboxes now have a checkmark in EACH style when it is selected.

I hope you like it.


Her some pics.
The new symbols


The new Styles


Here is the change log:
- [ADD] nkInitStyle in Nuklear.agc was added. If you set the flag parameter to 1 - a dark theme is used. Set it to 2 a light theme will be used. If it is set to 0, leave it at the default theme.
- [ADD] nk.Init now accepts an additional flag. If it is set to 1 (dark) or 2 (light), a new colour and symbol design is used.
- [ADD] New Symbols flags to modify the symbols NK_SYMBOL_INVERT, NK_SYMBOL_COMBINE_RECT, NK_SYMBOL_COMBINE_CIRCLE, NK_SYMBOL_COMBINE_FILLED
- [ADD] New Symbols NK_SYMBOL_CHECK_MARK, NK_SYMBOL_CROSS,
NK_SYMBOL_ANGLE_UP, NK_SYMBOL_ANGLE_DOWN, NK_SYMBOL_ANGLE_LEFT, NK_SYMBOL_ANGLE_RIGHT,
NK_SYMBOL_MENU, NK_SYMBOL_POWER,
NK_SYMBOL_ANGLE_DBL_UP, NK_SYMBOL_ANGLE_DBL_DOWN, NK_SYMBOL_ANGLE_DBL_LEFT, NK_SYMBOL_ANGLE_DBL_RIGHT,
NK_SYMBOL_VLINE, NK_SYMBOL_DBL_VLINE, NK_SYMBOL_HLINE, NK_SYMBOL_DBL_HLINE,
NK_SYMBOL_SKIP_LEFT, NK_SYMBOL_SKIP_RIGHT, NK_SYMBOL_SKIP_UP, NK_SYMBOL_SKIP_DOWN,
NK_SYMBOL_LINE_LEFT, NK_SYMBOL_LINE_RIGHT, NK_SYMBOL_LINE_UP, NK_SYMBOL_LINE_DOWN.
- [CHG] Checkbox draw now a check mark.
- [CHG] When drawing the menu, the complete line is coloured in the back colour of the menu button 'normal'.
- [FIX] Correct Slider names in tag def file.
- [FIX] Correct Checkbox names in tag def file.
- [FIX] Solved another case of transparent lines.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 28th Feb 2021 15:10
Thanks for the update and continued work on this plugin.... Awesome stuff.

How are you handling internal error checking specifically with images, I have encountered a few situations where trying to assign an image to a control that does not exist caused IMA and crash (image that does not exist, ya know a typo or wrong constant etc etc), is there an internal catch on null's?
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 28th Feb 2021 16:52
Thanks MadBit.
These days I am little busy with my real work, but I'll check as soon as possible.
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 28th Feb 2021 18:18
@ParTimeCoder
I'm afraid I made a mistake there. I have now fixed it by displaying a red image if the mentioned image is not found.
A suitable message should also appear in the log.
If there are further error-checking problems, please let me know.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 1st Mar 2021 20:02 Edited at: 1st Mar 2021 20:04
Ok, I will keep a log of anything I find but up till now it was only images that seemed to cause a problem, I am going to build a new UI next week so will give it a good test

FYI, if you prefix the function names in the tag file with nk. the autocomplete system works a lot better, I have attached my edit below, also fixed line 91



^^ need to set AC to invoke with 2 chars, not the default 3, I have been doing this for all my plugins.

Attachments

Login to view attachments
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 2nd Mar 2021 12:35
Thank you,

I don't know if I want to restrict the user to the 'nk.' Prefix.
Many don't like such restrictions.
On the other hand, if I were writing a C class with static functions (like agk) the class would also determine the prefix.

Oh, I'm already talking confused.

I think I will take your suggestion. If I may.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 2nd Mar 2021 17:11
Quote: "I don't know if I want to restrict the user to the 'nk.' Prefix."


Well the way I see it is, plugin functions need a prefix and being pedantic about what this prefix is or changing it to something other than what the plugin Dev deemed appropriate is a misnomer, my sql plugin prefixes with sql, draw plugin prefixes with draw etc etc, the convenience of having the AC for these plugins show in an organized manor surly beats the inconvenience of not being able to easy change the prefix, and like you said if this was a C lib the prefix is predefined anyway so.

Quote: "I think I will take your suggestion. If I may. "


lol, yes of course


MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 3rd Mar 2021 05:09
I have tested it out. After typing 'nk' I am offered the completion suggestions.
But filtering out when I continue typing does not work.
For example:
When typing nk.Check these suggestions should be shown to me.
nk.CheckboxFlagsLabel
nk.CheckboxFlagsText
nk.CheckboxLabel
nk.CheckboxText

But unfortunately this is not the case.
If I then write out the function name and enter the opening parenthesis, the parameters should also be shown.
Unfortunately, it does not.

Do I have any settings wrong?
Everything works with my old tag file.

Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 3rd Mar 2021 14:23
Na, my fault I did not check, my plugins only have a handful of functions so they all fit in the list I just scroll to the one I want and TAB it, but your right it drops the AC beyond the '.', soz for the misinformation lol

A sort of fix is to add both prefixed and non prefixed, it seems to work ok I get AC in both cases, I'm changing all my files! lol

Login to post a reply

Server time is: 2024-04-16 16:25:27
Your offset time is: 2024-04-16 16:25:27