Gui system out of blitz3d graphic window

Blitz3D Forums/Blitz3D Programming/Gui system out of blitz3d graphic window

Hardcoal(Posted 2011) [#1]
Hi
I want to make a GUI system that will work out of the blitz3d.
graphic window.
like winblitz3d does.
any one can guide me to first step on how to do so?
I dont want to use windows system. i want to make my own system from scratch.


Yasha(Posted 2011) [#2]
i want to make my own system from scratch.


Drop this part of the idea right now and you might have some success.

Three points:

1) Libraries are good. Reuse them. Anytime you feel yourself thinking "from scratch", it means you're not taking advantage of available resources. The spirit of programming is all about minimising work (the sole exception to this - which is perfectly legitimate - is if you're making the library for fun).

2) Blitz3D isn't capable of creating such a thing without making calls to the Windows API, because the only thing B3D can create by itself is a single flat DirectX window. So 90% of your task would be to replicate WinBlitz3D anyway, unless you used something like wxWidgets (which would do exactly the same thing but wrap the commands).

3) Blitz3D is not an appropriate language for GUIs of any kind, in or out of the window, because of its lack of support for function pointers. You can get function pointers via a clever hack (using MikhailV's FastPointer library), but it's unsupported, and advanced stuff. It is not easy write nontrivial GUI programs without function pointers, without it turning into an unreadable mess of spaghetti code and duplicated code.

Now, all that harsh, nasty stuff said... good luck. You'll need to look up either the Windows API or a toolkit library like wxWidgets, TK, or something similar. Once you've decided what you want to use we can try to give better help!

Last edited 2011


Rroff(Posted 2011) [#3]
I disagree with the last bit, its perfectly possible to make advanced ingame UIs with native B3D without function pointers and without turning the code into spaghetti - tho you probably need to be a fairly experienced B3D coder*.

I agree with the rest tho best to license one of the already done libraries and use that - I started off writing my own GUI from scratch but it was as much work to maintain and update it as it was working on my main project so ended up licensing a lib - although I've spent almost as much time rewriting large sections of it for performance (runs almost 40x faster than the stock library), fixing bugs and features I needed.



* Its a bit complicated to explain but one of the tricks I use for this is dummy "bookmark" objects to container objects in groups - this is just a sample to show what I mean off the top of my head and is probably not working code:

Type uiButton
	Field bookmark
	Field uiParent
End Type

Type uiWindow
	Field buttons.uiButton
End Type

; create a new UI window

this.uiWindow = New uiWindow




; add a "pointer" into the button collection for child grouping

this\buttons = New uiButton
this\buttons\bookmark = True ; mark this as a "dummy" demarcation object
this\buttons\uiParent = Handle(this) ; 2 way link
Insert this\buttons Before First uiButton ; start a new group of button objects



; add a new button to this window

mybutton.uiButton = New uiButton
mybutton\bookmark = False ; its an actual button
mybutton\uiParent = Handle(this)
Insert mybutton After this\buttons ; place it after our demarcation object



; now delete all buttons on this window as an example of useage

Local button.uibutton
Local tempbutton.uibutton

button.uiButton = After this\buttons

While (button <> Null) ; while we have valid button objects - if we hit another bookmark abort

	If (button\bookmark = True) Then
		Exit
	EndIf

	tempbutton = button
	button = After button
	
	Delete tempbutton

Wend


Objects are incredibly powerful once you go beyond their original intended useage and start using the insert and related commands along with handle/object and can even do full OO along with fastpointer (at a bit of a speed cost).

Last edited 2011


Paul "Taiphoz"(Posted 2011) [#4]
Not sure I agree either, programming is more than just the end result, he might just like the challenge or enjoy the act of programming itself the end result for him could simply be a bonus.


Yasha(Posted 2011) [#5]
Yeah I changed it to "not easy". While I believe it's poor design to try to work without them, it's also highly insulting to a lot of excellent coders to claim they haven't made brilliant interfaces in B3D (albeit with a lot of work). Sorry about that.

@Yavin: totally agree, that's the best reason for doing anything!


Rroff(Posted 2011) [#6]
I've redited my post to show one of the many tricks I use - anyone whos familiar with but not gone into advanced useage of types might find it interesting useage.


Hardcoal(Posted 2011) [#7]
i have allready made GUI systems and used it.
all i want now is to make a gui that will work lets say
with fastimage lib.
so the making of a gui is not the problem for me
just how to make it free of blitz3d graphic window.

any way i can also make it in blitzmax so im not bound to blitz3d
althow im much better in blitz3d then blitzmax which im new at.


Rroff(Posted 2011) [#8]
AFAIK theres no way to compile a B3D proggie as a DLL so no you can't really use it externally via API calls in another language (and without being able to inject its rendering calls into your target application its a non starter anyhow).

Last edited 2011


Hardcoal(Posted 2011) [#9]
ok so ill go for blitzmax and then make a wrapper for blitz3d?
what do you say..


Adam Novagen(Posted 2011) [#10]
I say C++. XD