LUI

Started by Dabzy, Oct 19, 2024, 03:38 PM

Previous topic - Next topic

Dabzy

LUI
LUI - Launchpad User Interface (Still not released, needs a bit longer to cook)

This, I've just started really (At the time of posting this thread), so there isn't much implemented. But, LUI is going to be pretty much a light weight basic wrapper of the Win32 API for creating and handling Windows based GUI elements, which was originally to be used alongside LibSGD, but now, it will be more a compliment to the DX9Lib. Though, this should work alongside the original Blitz3D software too, and, probably many other languages which can use DLL's, oh, and I imagine the commands will end up rather verbose (Ohhhhh, looks at me and me posh words), as it is with these things, so it will help having some form of auto-complete! :)

Seriously, it won't be a massive wrapper, a proper one will probably take me donkeys years, but the idea is enough in there to help me or whoever if they are interested to make little tools and such to run alongside DX9Lib, so no one expect a GUI system that they could bang out the equivalent of MS Office with it, or god forbid, expect to be able to knock the next Unity out of it... Cos they'll be bitterly disappointed! :P

Once this has what I need, that will be it... Unless I spot a bug, something quirky or need to add something else, so take it onboard that once I'm done, it's pretty much WYSIWYG, and that is final... There just isnt the time.

Anyhoo, it uses the Blitz3D 'userlibs' system, and with that, it'll have integer based handles to pass to and from a DLL, all the GUI elements will be outside of the main 'DX9Lib' window.



Like I said, I've just started it, loads of work to be done... Perfect little test bed for Launchpad's BUILD_DECLS comment command feature too, that seems to be working lovely mind.

Current LUI commands implemented (Live list showing progress):-

.lib "LUI_DLL.dll"
LUI_AppendGizmoChildNode%(parentNode%,text$,parentTreeview%)
LUI_AppendGizmoItem%(gizmo%,text$)
LUI_AppendSubMenuItem%(subMenu%,userDefinedID%,sText$)
LUI_AppendSubMenuSeperator%(subMenu%)
LUI_AttachGizmoRootNode%(text$,parentTreeview%)
LUI_AttachSubMenu%(windowMenu%,sText$)
LUI_BringWindowForward%(win%)
LUI_ClearAllGizmoNodes%(parentTreeview%)
LUI_ClearGizmoList%(gizmo%)
LUI_CountGizmoNodes%(parentTreeview%)
LUI_CreateBitmapButton%(bmpFilepath$,x%,y%,width%,height%,parentWin%)
LUI_CreateButton%(text$,x%,y%,width%,height%,parentWin%)
LUI_CreateCheckbox%(text$,x%,y%,width%,height%,parentID%)
LUI_CreateComboBox%(x%,y%,width%,height%,parentWin%)
LUI_CreateLabel%(text$,x%,y%,width%,height%,parentWin%)
LUI_CreateListBox%(x%,y%,width%,height%,parentWin%)
LUI_CreateMultiLineTextbox%(text$,x%,y%,width%,height%,parentWin%)
LUI_CreateProgressBar%(x%,y%,width%,height%,parentWin%)
LUI_CreateRadioButton%(text$,x%,y%,width%,height%,parentID%)
LUI_CreateRadioGizmoGroup%(text$,x%,y%,width%,height%,parentID%)
LUI_CreateTextbox%(text$,x%,y%,width%,height%,parentWin%)
LUI_CreateTrackbar%(x%,y%,width%,height%,parentWin%,horizonal%)
LUI_CreateTreeView%(x%,y%,width%,height%,parentWin%)
LUI_CreateWindow%(sTitle$,iWidth%,iHeight%)
LUI_CreateWindowMenu%(win%)
LUI_DeleteSelectedGizmoChildNode%(parentTreeview%)
LUI_GetEventData%()
LUI_GetEventExtra$()
LUI_GetEventID%()
LUI_GetEventMessage%()
LUI_GetEventSource%()
LUI_GetGizmoHeight%(gizmo%)
LUI_GetGizmoItemString$(gizmo%,index%)
LUI_GetGizmoItemsAmount%(gizmo%)
LUI_GetGizmoNodeText$(gizmoNode%,parentTreeview%)
LUI_GetGizmoText$(gizmo%)
LUI_GetGizmoWidth%(gizmo%)
LUI_GetGizmoX%(gizmo%)
LUI_GetGizmoY%(gizmo%)
LUI_GetGroupGizmoChecked%(group%)
LUI_GetMenuItemText$(userDefinedID%)
LUI_GetSelectedGizmoItem%(gizmo%)
LUI_GetWindowText$(win%)
LUI_InitLUI%(LUIFontName$,LUIFontSize%)
LUI_InsertGizmoChildNode%(parentNode%,childNode%,text$,parentTreeview%)
LUI_InsertGizmoItem%(gizmo%,text$,index%)
LUI_IsGizmoChecked%(gizmo%)
LUI_IsGizmoVisible%(gizmo%)
LUI_IsMenuItemChecked%(userDefinedID%)
LUI_IsMenuItemEnabled%(userDefinedID%)
LUI_IsWindowEnabled%(win%)
LUI_IsWindowVisible%(win%)
LUI_OpenColourDialog$(window%)
LUI_OpenFileDialog$(title$,defaultPath$,window%)
LUI_OpenFolderDialog$(title$,defaultPath$,window%)
LUI_PollEvent()
LUI_RemoveGizmoItem%(gizmo%,index%)
LUI_RequestedBlue%()
LUI_RequestedBlueF#()
LUI_RequestedGreen%()
LUI_RequestedGreenF#()
LUI_RequestedRed%()
LUI_RequestedRedF#()
LUI_SaveFileDialog$(title$,defaultPath$,window%)
LUI_SelectGizmoNode%(gizmoNode%,parentTreeview%)
LUI_SelectedGizmoNode%(parentTreeview%)
LUI_SetGizmoChecked%(gizmo%,checked%)
LUI_SetGizmoItemString%(gizmo%,text$,index%)
LUI_SetGizmoLayout%(gizmo%,newX%,newY%,newWidth%,newHeight%)
LUI_SetGizmoNodeText%(gizmoNode%,text$,parentTreeview%)
LUI_SetGizmoText%(gizmo%,text$)
LUI_SetGizmoVisibility%(gizmo%,visible%)
LUI_SetMenuItemChecked%(userDefinedID%,check%)
LUI_SetMenuItemEnabled%(userDefinedID%,enable%)
LUI_SetMenuItemText%(userDefinedID%,text$)
LUI_SetProgressBarGizmoValue%(gizmo%,value%)
LUI_SetSelectedGizmoItem%(gizmo%,index%)
LUI_SetTrackbarRange%(trackbar%,rangeMin%,rangeMax%)
LUI_SetTrackbarValue%(trackbar%,newValue%)
LUI_SetWindowEnabled%(win%,enable%)
LUI_SetWindowText%(win%,text$)
LUI_SetWindowVisibility%(win%,visible%)
LUI_UpdateWindowMenu%(win%)

LUI Command Count: 83

Dabzy
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Dabzy

#1
Little video showing LUI in action, working alongside the DX9Lib library! :)

Going okay so far, little head spinning wrapping up WinAPI buttons of a different "button type", as in you have your usual push button, then tick boxes and radio ones, all working slightly different, and having to code the difference to suit the behaviour of them.

It's been years since I've used WinAPI for GUI, like going down memory lane on a bike, once you start "getting it" again, it becomes easier, doing this in raw arsed C++ to build something is actually a lot easier then wrapping it for something else, that's for sure, and there seems to be tons I've forgot, many many moments where I've been pulling my hair out thinking "I'VE DONE THIS BEFORE!!!", then it comes back like a smack in the chops from a brown trout, and I'm like "Ahhhhh, oh aye! Derrrrr moi", then the cogs stop wobbling for a bit and I'm away! :D lol

Anyway, here's a video:

**Insert newer video**

:)

Not a lot to go on Inspector... But chipping away... Anyway, this will go a long way when working on Wibble! :)

Oh, and you'll probably have noticed I've called the GUI controls "Gizmo's", well, to be fair, every little GUI lib has it's own, some are plain old "Controls", "GCEs" (GUI Control Elements) , some are "Widgets", some are "Gadgets"... So it's only natural I had my own, and, I think "Gizmo" is kinda cute for such a thing, and no one else seems to use it... Mine mine mine! :) hehehe To be honest, when I'm done, I might even change it's name from LUI to Gizmo, because it reminds of this this little fella...



;)

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Dabzy

#2
Well, just updated the list at the top again, so I thought I'd drop some thoughts in how it's going... And, it's going very well. The little exception was tree views, now what I call "funny little buggers" :D

They can get a bit mind bending when shuffling them up for an integer based wrapper... I've never had much to do with them really, but for what I have in mind, thought I'd have a go, and yeah, two rewrites later on the code that surrounds them, and little edit is forthcoming sometime.

You see, I was getting all a bit lost in how they worked which was complicating things when trying to wrap them, my own fault really because I thought it would be a smash and grab like other controls [Gizmos ;)], but, nope!

I started writing the code, and was running into the odd niggle, I was building the tree view okay, but then, for some reason, I was running into issues collecting the events, like, the source event was going missing from the windows procedure to the DLL function LUI_GetEventSource() when double clicking. And even double clicking was hitty missy when trying to figure it out. Then once I could sort of get that through, LUI_EventData() started playing up...

It wasnt returning what I was expecting and not running inline with the creation of nodes. It was all getting a bit messy as I was trying to figure it out, so the whole lot went for a burton and I tried again. Then looking to get it running inline, I discovered I could use a lParam field from TVITEM as a way of keeping the handshakes going inbetween the DLL and Blitz, so, I started surrounding the code with that in mind, and yet, I could not for the life of me get it grafting, basically, me not understanding what was going on, so, I had another go at another angle of the dangle.

Everything I was reading on MSDN, google etc etc was all suggesting that was an angle that could make what I wanted possible, I just didnt feel I had it all knitting right. So, two days... Two bloody days of looking, being more cautious with the code, and then I saw a snippet which included something that hit me in the face like a size 11 foot with the big toe going up me nose for good measure... What was that little snippet... Ahem... This ---> TVIF_PARAM

Yep, once I added that to the nodes item mask, voila... It all worked, because you see dear reader, without that flag set, lParam is ignored, which is why I was getting nothing instead of a value I was expecting... The b[BEEP]d!!! :D

After that, it all settled down a bit, and I was happy tapping away, still, I had to read about somethings, or poke about getting stuff to work as expected, like, just inserting a new node at a position within the tree view isnt just InsertNode(newnode, position), you have to create the node, put it, say, on the end or start of the tree view, then copy it into the new position by specifying an existing node, the copy is superficial, so you have to copy the node items properties such as lParam to the same as the original, then, remove the original node, which in turn, sort out the internal vector element I'm using for some of the handshaking.

It can get all a bit spicy mind! :D

But, I managed to untangle the spaghetti and yeah, finally implemented a decent (I think so anyway) tree view implementation I can use in my little endeavours! :) hehehe

At the moment for sanity sake, you can only have one tree view in the project, but this one is all I want, and I will do an edit to suit, but as I'm sitting here, I can honestly say... I'm fooking sick of tree views! :D lol

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Dabzy

#3
Right, treeviews... [famous last words]... Are done, and multi tree view are working, it all seems to be working, which is nice, proof will be in the pudding when I actually start using them properly, developer bias is the demon of all developers, and it's a guarentee someone else gets a hold of it, and they'll break it in minutes! :D

I've also shuffled a bit here and there too, which was nice, bit of a tidy, but more needs to be done, like, naming the functions maybe a bit better, inline with LibSGD's convention, but, that's syntax decoration, nothing major.

Anyway, I have a few more things to do with LUI, but one thing I did spy was this over on syntaxbomb...

https://www.syntaxbomb.com/showcase/a-small-side-project/msg347063165/#msg347063165

All very "Mmmmmmm", as in, I'm sure I could include something in LUI to help achieve the same, will have a think, but, adding an external 2D based renderer to proceedings which doesn't eat into the LibSGD scene would be a nice thing, I'm just not sure of how nice it will all play together, maybe something GDI+ based or DirectX, obviously it needs to be something that uses the least resources possible.

Food for thought! ;)

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Dabzy

Right, 83 new commands in, and in the most part, it is done! \o/

Well, bit of a tidy like pre-mentioned, but, what I had in my minds eye is there... Now the crap bit... Writing some docs and example for it!!! BOOOOOOOOO!!!! :(

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Baggey

If i can help in anyway? I don't mind doing boring things.

Dabzy

#6
Cheers me dears, and thanks for the offer, not often people want to do the mundane stuff, rarer then hens teeth actually, lol, but, it's one of them process which, you do pick up on bugs, so as I'm chewing, and something isnt right, I can fixxy it uppy there and then! :)

I'm also waiting for the reappearance of Mark as he seems to have disappeared. He's been off the LibSGD forums for over a month now, and there's been no recent commits to the projects GIT repository for the same length of time. Not sure what to make of it, but previously he said he was wasnt very well for a week. I hope everything is alright, but I know meself something can knock you sideways from nowhere, or maybe he just hit the wall with coding.

He was coding like an absolute nutter, and it's unsustainable really, we've all done, excited AF, you just hit that wall, it can make you ill. I wouldn't blame him if that was the case too.

My plan over the Christmas period, as I've given myself three weeks off, was to implement live auto-complete in Launchpad, as in, it will track your variables, objects and their members and pop it all up... All very Visual Stuff, but, on the chance he's dropped the project all together, that might become a false errand.

I've been looking at the 2D renderer side of things I mentioned with LUI, and got a pleasant surprise, I have DirectX 9 code from many many moons ago, 2D of course, why a pleasant surprise? Because I've learnt DirectX12 has mappings for DirectX 9, which means, even though DirectX 9 is ancient, it's still being supported by MS through DirectX12... You don't even need the GFX card to have DirectX 9 support, it'll work as expected, good call by MS really as this will allow games from days gone by to work fine with no DX9 runtimes needing to be installed! \o/

How cool is that! ;)


So yeah, that's what I may be doing instead over the Christmas, then if we hear nothing, well, I'm eyeing up Nim as Launchpads target language:-

https://nim-lang.org/

Not sure how long it will take to implement that due to having to write a wxScinilla lexer for it, then the glue for the DLL...


Update: After thinking about it, in the voice of Baldrick from Blackadder... Ahem... I have a cunning plan which shouldnt require the amount of work involved to jiggle it all! :)

And I'll stop typing now due to it's just never ending! :D lol

Anyhoo, I'm sure all things will end well, and, will see where we are, like I said, I hope everything is okay with Mark, so I'll wait and see how it goes before turning the rudder! ;)

Dabzy
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Baggey

#7
I love the black adder and baldrick.

I loved it when he was looking through the telescope thingy!

Adder say's what do you see!?

I dunno my lord!? But there appears to be a large GINGER hedge coming this way!? LOL

Adder says RUN!

I always wished they did a world war II version

Ive got three weeks as well! hoping to get into my emulators! The SID is coming along nicely!

Dabzy

Blackadder was brill, one of them series that started off a little slow, but when they all got into the swing of it... That was, pure TV gold! :)

You don't get much in the way of TV from days gone by like that now, too many people get offended by the slightest thing, more so, the people who are the butt of jokes that are aimed at tend to love it, it's the ones that get offended because they think others are offended are the issue... You know, the miserable b[WAHOOO]ds out there! :D lol

Anyway, yeah, I've seen the work your doing on your emulator, looks magic mind, I tend not to use emulators much, not that I'm not big on retro, I just like using the proper hardware. I'm an Amstrad CPC man, and I have an Amstrad CPC 6128 on the desk upstairs for them 8-bit micro kicks, also a few consoles of old, the likes of your Megadrive etc etc.

I just prefer gaming on the real gear really.

Anyway... I need to square this site up, now that Mark has passed away, the angle it was aimed at has past with him, if I was to continue on with what was in mind, I'd have to take up LibSGD, and I'll be honest, I don't think the programmer is in me to do that, or at least, the time to learn his code, then expand it with Dawn, which in turn, I'd have to learn that, it's all too much.

He was a skilful programmer, when I've been digging about in some of his sources, there is stuff in there, when I figure what he's done, it's really impressive and another level of what I'm capable of... He was a professional developer, I'm just a hobbyist that stumbles along with it until it works.

Still cannot believe he's gone like, yeah, I never met the man... But to be fair, New Zealand isnt a "pop", but he's always been around making his great wares and I've always been a massive fan of them, granted I've never been a fan of some of his decisions, but they were his to make at the end of the day... I'll have to see whats what, but yeah, end of an era really, which is a sad thought too! :(

Dabz



Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit