Cower GUI

Community Forums/Showcase/Cower GUI

N(Posted 2004) [#1]
Gonna post work in progress shots of this as I go. Source at one point or another.

Anyhow, first shot (5kb 800x600 PNG- that format is amazing):


No exe's as per Mark's request.


Zenith(Posted 2004) [#2]
Yay, it's all fecky :)


Perturbatio(Posted 2004) [#3]
And it's got a weebl on it, it must be stable.
Cos everybody knows weebl's wobble but they don't fall down :)


N(Posted 2004) [#4]
Probably my two favorite pseudo-words at the moment.


Perturbatio(Posted 2004) [#5]
Have you been watching Father Ted of late?


N(Posted 2004) [#6]
What is 'Father Ted'? Get on IRC you git.


Perturbatio(Posted 2004) [#7]
oh alright then.


Warren(Posted 2004) [#8]
Why can't you post EXE's?


VIP3R(Posted 2004) [#9]
Nice :)

@Warren: I think he's referring to this (on the beta download page):

marksibly
Please do not distribute anything built with these beta versions. There will be no beta demo!



flying willy(Posted 2004) [#10]
Feck originates from father ted afaik, not IRC...


N(Posted 2004) [#11]



N(Posted 2004) [#12]
Slowly.



Skin in that shot is the WinXP skin. There's also a Steam skin (one that mimics the UI in Half-life 2).


okee(Posted 2004) [#13]
"There's also a Steam skin (one that mimics the UI in Half-life 2)."

Does it take 2 1/2 hours to download and then not work when you get it ? :) feckin' steam.


JaviCervera(Posted 2004) [#14]
Why can't you post EXE's?
The Windows and Linux versions of BlitzMax released are in beta stage yet, so you are not allowed to distribute what you do with them. Of course, you will be able to distribute the executables of these versions as soon as they are officialy released, as you can currently do with MacOSX binaries.


N(Posted 2004) [#15]
The Windows and Linux versions of BlitzMax released are in beta stage yet, so you are not allowed to distribute what you do with them.


Correction: You are, by all means, allowed to but it would be rude and impolite to not do the simple thing that Mark asked.

Nothing's stopping people from distributing it (I couldn't even find a license, actually, but I'm not looking very hard).

It's best to respect Mark's request at the moment, since there's something he likely does not want people to do with beta executables. Perhaps they're easily decompiled. Who knows.


Hotcakes(Posted 2004) [#16]
Maybe they are a god awful mess and Mark is ashamed of them =]


N(Posted 2004) [#17]
Wouldn't be hard to believe. Anyways, got the list box in. Picture:



Small graphical problem 'cause I'm running in windowed mode. Seems to go along with that problem with the mouse position in windowed mode- it works fine in fullscreen.


LarsG(Posted 2004) [#18]
it's looking very good there, Noel.. :)


Kanati(Posted 2004) [#19]
Lookin good... Have fun with the text control without a GetKey() command. :)


Robert(Posted 2004) [#20]
Just loop through KeyHit for keycode = 1 to 255 :).


Diordna(Posted 2004) [#21]
Hey Noel, I wrote a small GUI library that had radio buttons, checkboxes, text fields with scroll buttons, list boxes, and text labels. Want the source to add into yours? It's not really messed up or anything. It's pretty straightforward.


N(Posted 2004) [#22]
I already wrote a GetKey() (technically it's cGetKey() and returns the character as a string, but it's private so outside of the GUI module it's inaccessible) function.

Robert: It's not that simple. BlitzMax does use ASCII codes for KeyDown now (compare the values of its key codes to those of ASCII values and you'll see what I mean), but it's a bit more problematic than that 'cause I need all the 'other' characters as well (e.g., Shift+8 = *). So, now I have a function with two very large Select..End Select constructs.

Diordna: Thanks but no thanks, last thing I need is to have the trouble of mixing two different coding styles. Anyhow, I've got all but one of those gadgets in now (that would be labels, since I figure it can wait, being a relatively simple gadget).


Perturbatio(Posted 2004) [#23]
Noel doesn't like using other people's code :)

It's looking good btw Noel, a lot better than mine is/did :)


N(Posted 2004) [#24]
Anyone wants to fiddle with the GUI, source so far.

Download

Technical crap

If you want to add gadgets, you do so by extending the CGadget type and you implement the Draw(), Update(), and ToString() (in the case of CButton, returns "Button") methods. Create:CYourGadget() should be a static method that creates the gadget. At the end of Draw you call DrawChildren() and at the end of Update() you call UpdateChidlren(). This is done because any gadget- besides windows, and they could be extended to include this- can be parented to any other gadget.

There are still no 'FreeGadget' or 'Dispose' methods as I'm not quite sure exactly how BlitzMax handles stuff like that- I have no idea if the Delete method does anything or if Release frees the integer handle or all the resources used by an object (not any objects it has references to though).


Perturbatio(Posted 2004) [#25]
found a bug: if you switch between the two example windows several times, the one with the list stops functioning (it cannot be dragged and does not respond to any input).


N(Posted 2004) [#26]
Yeah, I've noticed that.. thought I'd fixed that...


Perturbatio(Posted 2004) [#27]
it seems to be that last window created that remains functional. (tested by creating more than two).

*EDIT*
it seems to be that each of them will accept movement (or focus) twice, then all but the last stop responding.




Perturbatio(Posted 2004) [#28]
And for even more weirdness, it seems to only happen when ALL of them have moved or received focus at least twice, otherwise you can move them about as many times as you want.


N(Posted 2004) [#29]
Huh.. you're right. I bet this one'll end up giving me a headache until I find out it's some stupid mistake (can't be a typo though, thank god).


N(Posted 2004) [#30]
Nope, forgot to reassign the link member.

New version with the fix uploaded. Uses your test code, by the way, since I overwrote the test file with it.


Perturbatio(Posted 2004) [#31]
Noel, you can stop chewing the pills now, I deleted the original mod folder completely, replaced it with the new and rebuilt the module, it works now.

However, another bug:

the window does not gain focus if you click near the bottom (the no-click zone is same height as the title bar).


Perturbatio(Posted 2004) [#32]
a fix for the bug:

in CWindow.Update():
		Local HeightOffset, YOffset:Int
		
		If (Flags&CW_TITLEBAR) Then 
			HeightOffset = 24 
			YOffset = -24
		Else 
			HeightOffset = 0
			YOffset = 0
		EndIf
		
		Over = MouseOver(X, Y+YOffset, Width, Height+HeightOffset)



Perturbatio(Posted 2004) [#33]
it's been bothering me, but there's also a bug where if a title bar is behind the bottom of a window, it brings that window forwards.

solved it almost:

add the following to type CWindow
	Method MouseIn()
		If Hidden Then Return False
		
		Local HeightOffset, YOffset, mOver:Int
		
		If (Flags&CW_TITLEBAR) Then 
			HeightOffset = 24 
			YOffset = -24
		Else 
			HeightOffset = 0
			YOffset = 0
		EndIf
		
		mOver = MouseOver(X, Y+YOffset, Width, Height+HeightOffset)
		Return mOver
	End Method


And the in CWindow.Update() change:
If Self <> CGUI.ActiveWindow And IsVisible() And MH And Over 

		If Self <> CGUI.ActiveWindow And IsVisible() And MH And Over And Not ( CWindow(CGUI.ActiveWindow).MouseIn() )



Grisu(Posted 2004) [#34]
Good job Noel!

Is the source downloadable somewhere?
Can I be beta tester?


Perturbatio(Posted 2004) [#35]
look halfway up this thread for the download link.


N(Posted 2004) [#36]
Dang, Pert, hyperactive today, are we? ;)

I'll add your changes and update the archive.


Diordna(Posted 2004) [#37]
Are you sure you don't want my code that divides a long string up into individual spots in an array for use in drawing text boxes? It's easily pluggable, just swap some array names.


N(Posted 2004) [#38]
No, thanks.

Anyhow, picture using the current WinXP skin.



Obviously I'm porting the Eniretu skin as well for use in this.


ashmantle(Posted 2004) [#39]
looking good :) *thumbs up*


Diordna(Posted 2004) [#40]
We gonna get an os x skin?


N(Posted 2004) [#41]
Working on it, slightly difficult seeing as how I don't own a Mac or OS X though.

If there are any other skins you'd like for it, best to get the requests in now.


N(Posted 2004) [#42]
Added close/minimize buttons, image boxes, rollouts, inlets (beveled areas), labels, and a new procedure for tiling image segments horizontally without seams (and with fractional segments). Gonna work on adding the scrollbars next, as I need them for a great deal of gadgets.




Hotcakes(Posted 2004) [#43]
I would like to see classic 4/16 colour AmiOS skins ;]


N(Posted 2004) [#44]
If you can get me a picture of one, that'd help.

Just post it here or e-mail it to me- whatever works- if you find one.


Perturbatio(Posted 2004) [#45]
4 colour amigaOS


Perturbatio(Posted 2004) [#46]
High Colour


Hotcakes(Posted 2004) [#47]
Those images are horrible =] One is scaled down and the other is infested with nasty nasty scanlines...


AntonyWells(Posted 2004) [#48]
Yep, sounds like an amiga alright. (Salutes the sky.)


flying willy(Posted 2004) [#49]
You've SEEN the sky?


AntonyWells(Posted 2004) [#50]
Contrary to popular American belief, us Brits have lived above ground for a while now.


Perturbatio(Posted 2004) [#51]
What's a sky?

One is scaled down and the other is infested with nasty nasty scanlines...


scaled down? nothing has been altered, they are unadulterated screenshots.


Diordna(Posted 2004) [#52]





I couldn't get the scroll arrows to show on the text boxes, but you can take them from the list box.


VIP3R(Posted 2004) [#53]
Looking good so far Noel :)

I really like the look of the OS X skin, it would be sweet if you could add something like that ^^^


N(Posted 2004) [#54]
Thanks, Diordna. If you can get pictures of the buttons being pressed and while the mouse is over them (the highlight mode) that'd help.

Edit: Oh yeah, added tab pages, regions, and progress bars.

Scroll bars and slider next.


Kanati(Posted 2004) [#55]
That blue one in the tab part is mostly what they look like when you hover over them or click them.


Hotcakes(Posted 2004) [#56]
scaled down? nothing has been altered, they are unadulterated screenshots.

Have you even looked at them? =]


Diordna(Posted 2004) [#57]
There are no mouse-overs. The blue halo is the active control which is chosen by keyboard selection or by clicking on the control. As for the down position graphics, just darken them a bit.

Whoops, looks like there are no scrollbars in that screenshot!




Perturbatio(Posted 2004) [#58]
Have you even looked at them? =]


No, I took screenshots of them, ran photoshop, pasted them in, flattened the layers and saved then uploaded them without opening my eyes.


Warren(Posted 2004) [#59]
Apparently.


N(Posted 2004) [#60]
Thanks, Diordna.

I've uploaded the latest source code, this includes the new tab strip/page control and progress bar, along with an Xml module (ported from old code of Blitztastic's that I butchered).

Edit: New picture:



Diordna(Posted 2004) [#61]
Wow you work fast.


N(Posted 2004) [#62]
Well I've had a week (well, a week starting tomorrow), so that's quite a bit of time to work on this.

Anyhow, decided to try this on IRC:
<NoelCower> "Wow you work fast." should i take that as a compliment, insult, or advisory to seek psychological help?
<EarthQuake> =P
<Mojo> all of the above
<flaagan> A & C


Had a lot of other.. er.. unrelated responses. But, anyways, gotta love IRC. And no, I wasn't serious about taking it as an insult ;)

Edit: Oh, and to clear up any confusion: Yes, I am hyper-active.


Hotcakes(Posted 2004) [#63]
Those windows really need rounded edges, by the way =]

Oh and my apologies to Perts. Was a case of IE being screwy with the pictures.


N(Posted 2004) [#64]
By the way, Toby, is this what you wanted when you meant an AmiOS skin?


Bot Builder(Posted 2004) [#65]
IE? oh god... oh my holy... cheese... :|

http://www.mozilla.org/products/firefox/

Or

http://www.opera.com/

[Edit] Nice GUI btw, cower


AntonyWells(Posted 2004) [#66]
Looking very nice so far, I want to use it myself, but i'm wondering how you integrate it with the display Noel?
I'm not using any of mark's rendering stuff, only BGLcreatecontext. Should this be compatible?
Also, are there plans for an active texture gadget?(I.e true gl texture) for 3d displays using custom engines(i.e all of them)

Oh one last question(Too many? :) ), open source/commercial/whatever come the finish?


Perturbatio(Posted 2004) [#67]
open source/commercial/whatever come the finish?

See the Mozilla Public License 1.1


Hotcakes(Posted 2004) [#68]
@Weasel:No. OS4 is a travesty =] But that is a nice screenshot. Bit like a simplified MUI.

@BotBuilder:Shutup and go away with your Opera pushing filth! =]


Grisu(Posted 2004) [#69]
Cant get the modules compiling....
is there a way you can include the compiled modules with the zip?

I really like the gui style. :)


FlameDuck(Posted 2004) [#70]
Bit like a simplified MUI.
You left out 'and ugly'.


Diordna(Posted 2004) [#71]
BTW...where is the IRC channel?


N(Posted 2004) [#72]
Diordna: irc.blitzed.org #blitzbasic and #blitzcoder

Grisu: Unfortunately, no, I can't include the compiled modules. It would be a bit problematic and take more time to upload the files including the debug and release builds.

Antony: Yar, too many questions. I'll answer them when I have time.


N(Posted 2004) [#73]


A skin made by Leiden (BlitzCoder goer). He's mostly been relying on me to see what it looks like when on the GUI.

Anyhow, a cheat-sheet (of sorts) for anyone who wants to make skins:



Hotcakes(Posted 2004) [#74]
That's some nice rounded edges ya got happenning there =]


Wiebo(Posted 2005) [#75]
Really nice. But how do you draw a portion of that skin image instead of the whole thing?


N(Posted 2005) [#76]
Cower.Drawing module:
Strict

Module Cower.Drawing

Import BRL.GLMax2D
Import Pub.OpenGL

Function DrawImageBlock(Img:TImage,X#,Y#,Width#,Height#,TX#,TY#,TWidth#,THeight#,Frame%=0)
	Local texEnabled:Int = glIsEnabled(GL_TEXTURE_2D)
	If texEnabled=0 Then glEnable(GL_TEXTURE_2D)
	
	Local onewidth:Float = 1.0/Img.Width
	Local oneheight:Float = 1.0/Img.Height
	
	Local UF:Float = TX * onewidth
	Local VF:Float = TY * oneheight
	Local UT:Float = (TX+TWidth) * onewidth
	Local VT:Float = (TY+THeight) * oneheight
	
	Local frm:TGLImageFrame = TGLImageFrame(Img.frames[frame])
	glBindTexture(GL_TEXTURE_2D,frm.name)
	
	Local r,g,b,a:Float
	' You could set your own colors, but I leave them at 1,1,1,1
	GetColor r,g,b
	SetColor 255,255,255
	a=GetAlpha()
	SetAlpha 1.0
	
	glBegin GL_QUADS
		glTexCoord2f UF,VF
		glVertex2f x,y
		
		glTexCoord2f UT,VF
		glVertex2f x+width,y
		
		glTexCoord2f UT,VT
		glVertex2f x+width,y+height
		
		glTexCoord2f UF,VT
		glVertex2f x,y+height
	glEnd
	
	SetColor r,g,b
	SetAlpha a
	
	If texEnabled=0 Then glDisable(GL_TEXTURE_2D)
End Function



Wiebo(Posted 2005) [#77]
ooh, Open GL, my head hurts... Thanks for the tip though, I will keep it in a safe place until I can do something with it!


N(Posted 2005) [#78]
Revival!

Download



New version includes: Sortof working textbox, 3D viewports, can now be used without calling Graphics() (but you still have to create a context and then tell the GUI the height and width of said context because there's no way in hell it's gonna know)


Picklesworth(Posted 2005) [#79]
Wow I forgot about this one. Nice :)
I really like the cheme in the shot you just posted

This is almost an excuse to buy Blitz Max in fact...

Does the colour scheme go by what the current windows colour scheme is? That information can be accessed via Win32.dll I think...


N(Posted 2005) [#80]
No, the GUI is skin based (three included in the archive- there was a Steam one but I canned it 'cause it just didn't work out).

All gadgets have modifiable color values, so I suppose you could alter the colors by grabbing them via Windows. But this isn't Windows only, so I'm not going to put anything platform dependent in.


Kuron(Posted 2005) [#81]
This is almost an excuse to buy Blitz Max in fact...
I was thinking the same thing ;c)


FBEpyon(Posted 2005) [#82]
Hey are you planning on making a canvas gadget also like they had in Blitz+


N(Posted 2005) [#83]
What the heck is a canvas? I never used BlitzPlus (for good reason.. the thing is a hack).


N(Posted 2005) [#84]
After using Instant Pestering© I have decided that it -could- be possible, but I'm not gonna add it.

The 3D viewport control should be enough to handle drawing- if not, use the ImageBox control.


FBEpyon(Posted 2005) [#85]
How are you going to do imagebox, being that Blitzmax has no setbuffer or anything unless I messed it somewhere in the modules...

The canvas would be faster if done right than having to buffer to a image, unless the imagebox isn't a image... and a 3D Viewport sounds like something from Blitz3D.. anyways just trying ot get more info because i need a GUI for a level im making for my new 2d game


N(Posted 2005) [#86]
How are you going to do imagebox


You mean how am I -doing- the ImageBox control.

I take an image and draw it. Simple as that. You wanna draw to an image, remake the GL texture after drawing to it.


Red Ocktober(Posted 2005) [#87]
well done Noel...

--Mike


Perturbatio(Posted 2005) [#88]
looking very good indeedy :)


N(Posted 2005) [#89]
Latest archive updated. Added a standard blinking caret to the textbox, made the window shade effect slightly cooler, and probably fixed a few bugs that I don't remember.


Russell(Posted 2005) [#90]
Very nice, Noel! Do you have any plans to make it app-able? That is, a true and proper native OS-compliant GUI thingy using native OS gui elements, etc?

Hope so! In the mean time, this will do ;)

Russell


N(Posted 2005) [#91]
No plans to do that any time soon as then I'd be limited to what the OS can handle (and it wouldn't be hardware accelerated, and I know how slow GDI+ is from experience- double buffering is a pain with it too, as for xorg, I have no idea anymore).

In any case, making CGUI work with an operating system or graphics server's window manager would prove to be more difficult than just starting from scratch at this point.


N(Posted 2005) [#92]
New release available, same download.

Fixed some problems with the textbox and made it work a little better, made the window shading animations optional (horizontal and vertical can be toggled now), and the height of title bars is changeable (and the close/minimize buttons scale with it.. not that pretty if you go above 24 though.. should be sorted out when I make skins completely customizeable via XML). Probably some more stuff I forgot about, too, but that's what I remember.


altitudems(Posted 2005) [#93]
Great system so far Noel, keep it up!

Here is a skin I made for it called "Silk" Enjoy!




N(Posted 2005) [#94]
Thanks, altitudems. I'll make sure to include it in future updates (and of course I'll credit you).

Anyhow, this isn't particularly related to CGUI's development, but here's a new skin I made for it:


It'll be included in the next release (I won't say when that'll be, since I don't want to have anyone holding me to it).


altitudems(Posted 2005) [#95]
Interesting skin, Noel. I like it.
Oh and thanks for the credit.


altitudems(Posted 2005) [#96]
Noel,

I think I might have found a simple bug/oversight in your code. The gadgets that use:
glEnable(GL_SCISSOR_TEST)
inside their "Draw" method don't ever call:
glDisable(GL_SCISSOR_TEST)
Unless I'm mistaken that means that any other graphics drawn afterwards, will not show up unless they fall inside the last glScissor boundaries, disable GL_SCISSOR_TEST,or define new glScissor boundaries.

I discovered this issue as was adding gadgets after a ListBox or TextBox gadget. After drawing the list box, some gadgets did not show up. It's an easy fix, you may have already have fixed it. Just thought I'd point it out in case you didn't.
Looking forward to the next release!


N(Posted 2005) [#97]
I'll look at it, thanks, altitudems.


Gavin Beard(Posted 2005) [#98]
hey ya, great lookin gui system, how ever it seems to refuse to compile, i've tried every poss. combi i can think of to get it work, if i do it from the command promt, it returns nothing at all.

just to make sure i am doing this right, i drop the cower.mod folder into my pub.mod folder i try bmk makemods -r cower and no return error or success msg and even bmk makemods -a doesnt find it, however if i run a program i get error E:\blitzmax\bin\ld.exe: cannot find E:/blitzmax/mod/pub.mod/cower.mod/cower.a

what have i done :D


Perturbatio(Posted 2005) [#99]
put the cower.mod folder in the mods folder, not the pub folder, recompile the modules and it should work.


N(Posted 2005) [#100]
Cower.mod is its own module or namespace, wherein it contains its own sub-modules or classes (perhaps). Anyhow, cower.mod goes in the blitzmax/mods/ folder.


GrrBrr(Posted 2005) [#101]
module compiles well, but i when i try the test.bmx:

Building test
Executing:test.debug.exe
Pushing attribs
OpenGL Error 0502

Process complete


GrrBrr(Posted 2005) [#102]
hmmm... there was an older version of your test.bmx on my hardrive, which i hadn't tested yet, and it worked with the newest version of your module..


N(Posted 2005) [#103]
I wouldn't try to use this anymore, BRL pretty much made it so it's impossible to use OpenGL alongside GLMax2D, so it's probably best to just give up any hope of using this.