Posts: 437
Threads: 32
Joined: Mar 2004
Aynone know of any good gui/z windowing tuts? I have my own working ideas for windowing system, but not very efficient ones, or ones that would run into other bugs....
Thanks, jamie.
Posts: 1,813
Threads: 284
Joined: Mar 2003
gee whiz tuts? HUH!?
earn.
Posts: 437
Threads: 32
Joined: Mar 2004
Seph what do you mean by that?
Posts: 1,138
Threads: 211
Joined: Feb 2020
There are loads of GUIs or "Operating systems" in QB/qbasic. There are several listed at
http://www.neozones.com/Gui/, and if you search at ABC archives they have loads listed there too
http://www.allbasiccode.com/newsite/abc.cgi?ACT=DQ. Z!re is also working on Novix
http://www.Novix.tk
EDIT: I also forgot Sepent, which has a good list at
http://www.sepent.com/prog/basic/bguios/ as well as their own GUI.
Posts: 437
Threads: 32
Joined: Mar 2004
yes but I want a tutorial cus I wanna whip the but's(or try to...) of a lot of existing qb gui's.
Posts: 3,522
Threads: 189
Joined: Dec 2003
Rough code:
Code:
dim windowZ(32)
numwindows=10
for b=1 to numwindows
for a=1 to numwindows
If windowZ(a) = b Then
drawwindow a
exit for 'already found the correct window
end if
next
next
Or you could:
Code:
sort_all_windows_depending_on_Z_Value
for a=1 to numwindows
drawwindow a
next
But 9 out of 10 times, the first code is fast enough.
Even with 64 max windows open, it would, in worst case, have to go through 4096 for/next's.
And that is worst case scenario.
To remove a window from the first code you would do::
Code:
window_to_remove=5
numwindows=numwindows-1
if window_to_remove < numwindows Then
WindowZ(window_to_remove) = WindowZ(numwindows)
'swap the last window, with the one being removed, so active
'windows are always in front.
end if
'If it's the last one there is no need to clear it, it will be cleared
'when you add a new window anyways
Very rough code, could use some fixing, and there's prolly some spelling or minor errors in it (btw, you can't use _ in QB, i just used it here to clarify)
Posts: 1,138
Threads: 211
Joined: Feb 2020
Quote:yes but I want a tutorial cus I wanna whip the but's(or try to...) of a lot of existing qb gui's.
Sorry, I missed the tutorial bit in your question. But I've found working examples the best teacher for me. I'm not aware of any good tutorials on the subject qbwise.
Posts: 294
Threads: 9
Joined: Oct 2002
have a look at the source code to X or Gnome for linux, oh wait that'l give you nightmares
.
Posts: 437
Threads: 32
Joined: Mar 2004
Heres an idea I had
Variable_Screencontent(screenx,screeny)
this would say what windows where on top, and these would reshown based on screen content when someone affects the active windows.
All very well but one problem? How do I find out every window that mean't to be below them and refreshing the, too slow. I wold use this if I could find an efficient way of getting which windows are below. Although I've just had an idea.... let me think about it.
Posts: 3,522
Threads: 189
Joined: Dec 2003
You could do it like this..
You draw the front window first, and create a binary image of the windpw in memory
Then you take the next window based on Z value, and draw it, NOT overdrawing the already drawn content, and store it in mem
And you do that for all windows.
Then, if you update a window you simply just use the binary image of that window, edit it, then draw all binary images again, only change in the memory images, then draw them.
That way you could do like this, for example, if the 5th window (z order, from top, where 1 is front/top) change, and there are 10 windows showing, you just update the 5th window, then the 4th, then the 3rd, 2nd then finally the first one, in front.
Could be made pretty fast.
(The technique to draw in memory and only display when done is something that will be used a lot in Novix, for example [spam] )