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.

DarkBASIC Discussion / Windowed GUI

Author
Message
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 26th Jul 2007 11:43 Edited at: 7th Aug 2007 17:31
I've started making a window-based GUI, initially this is for a hacking game I've started making but of course it will be useful for many things.
Here's my code so far, if anyone has any tips or suggestions for features I'd be grateful, I've never tried something like this before so I'd be interested to hear from others who have tried.
thanks in advance

[EDIT]
I had an empty variable in the bind window function, fixed now.



Click the title bar to move the window, the small square to resize and the "-" to close (click in the same spot to get it back).

Here are my designs for other things I want to create.
This game will be very similar to Uplink so if you have a look at that you'll see what I'm trying to do.
http://www.introversion.co.uk/uplink/

The world map is the only external media!!


[EDIT]
20 views and no posts? I will add more detail.

Console
I want to make a DOS style console for the game to access virtual files and manipulate them, this provides an alternative way of hacking in the game.

Text Window
I want the text window to wordwrap and have a scroll bar.

Cascading Windows
Display multiple windows at once in order.

[UPDATE]


I've added a colour gradient! wooow
It absoloutly kills the FPS though anyone have any tips on how to speed this up?


Your signature has been erased by a mod because it was rubbish.
Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 27th Jul 2007 23:03
You are good with your 'basic' programming. Windows, fake 3D...

I never tell the truth.
That ain't a paradox.
I always tell lies is though.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 28th Jul 2007 02:57 Edited at: 28th Jul 2007 02:58
Thanks!
I'm giving up on the 3D thing for now, it's really difficult to work out and TDK made it sound impossible lol.
Windows will be really useful if I can get it working in a game
I think I'm gonna have to come up with a different name tho lol.

I am King of the noobs!
Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 28th Jul 2007 04:57
Lookin good.


Learning C++ thanks DGDK
Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 30th Jul 2007 23:49
Quote: "TDK made it sound impossible"

Shame on TDK! 3D's easy...

I never tell the truth.
That ain't a paradox.
I always tell lies is though.
FERSIS
19
Years of Service
User Offline
Joined: 17th May 2006
Location:
Posted: 31st Jul 2007 00:23
wow , i have the same idea for a game
I did a little bit of code on that one , (Visual Basic 6.30)
But lost the code on a fail backup ( i was not in charge of the backup) , in fact i lose like 30.0000 lines of code
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 31st Jul 2007 01:19
Quote: "Shame on TDK! 3D's easy..."


Oh yeah?...

We were talking about creating a 3D effect in 2D - just using the DOT and LINE commands to make a cube and then rotate/scale it, (using mathematical matrices).

So, this means 3D using NONE of DB's 3D commands and if it's that easy, please show us all a code snippet...

TDK_Man

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 31st Jul 2007 01:37
@FERSIS
30.0000? do you mean 30 lines or 30,000 lines? or 300,000 lines!
Either way, that sucks lol.
I think a lot of people are enticed by this sort of game because it looks really simple to make, but you look at Uplink and WOW, that's a complicated game lol. I really like the open-ended play; you just find a mission, agree to terms, and then you are free to go about completing the mission using any method you like. This is a game that judges on results!

@INH
Quote: "You are good with your 'basic' programming. Windows, fake 3D..."

I spose it makes me a bit of a nerd, but I like to try and make programs using as few functions as I can
I even made a line function that works better than the original DB one! It's in the code here, and also the codebase.

And in case anyone was wondering, the world map is an edited version of the map in the date and time property window in windows!
It's only two colours so easy to edit.

I am King of the noobs!
Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 31st Jul 2007 11:51
@TDK-
Quote: "We were talking about creating a 3D effect in 2D - just using the DOT and LINE commands to make a cube and then rotate/scale it, (using mathematical matrices)."

Well I was talking about 3D in general.
@OBese87- It's good to eperiment with new ways of doing things. If you don't know how something works, you'll never beleive it.
Which is weird 'cause I beleive that 2 to the power of 0 is 1...

I never tell the truth.
That ain't a paradox.
I always tell lies is though.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd Aug 2007 20:15
Quote: "Well I was talking about 3D in general."


I know - the point is, we weren't! That's why I was pointing out that your comment "Shame on TDK!" was inappropriate.

You were passing comment on a discussion that you didn't even see and made it look like I had said something I clearly had not.

TDK_Man

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 2nd Aug 2007 22:13
Quote: "Well I was talking about 3D in general."

3D is not easy, DB makes it easy

@TDK
No comment on my windows? Have you done something like this?

Your signature has been erased by a mod because it was rubbish.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 5th Aug 2007 17:07
Bump for UPDATE

Your signature has been erased by a mod because it was rubbish.
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 5th Aug 2007 21:10
It looks kinda cool. How can you make the window have multiple lines of text, though?

Did someone say 3D scanning on my desk, or was that just an AdBot?
What happens when when you mix coke, pop rocks, vinegar, and baking soda?
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 5th Aug 2007 22:43
Quote: "How can you make the window have multiple lines of text, though?"

By breaking up the string and storing the lines in an array.
I think there must be a better way of doing it though.

Your signature has been erased by a mod because it was rubbish.
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 6th Aug 2007 01:27
Obese, what is the "s" parameter supposed to mean in your wire_box function?

Did someone say 3D scanning on my desk, or was that just an AdBot?
What happens when when you mix coke, pop rocks, vinegar, and baking soda?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 6th Aug 2007 07:48
Quote: "I've added a colour gradient! wooow
It absoloutly kills the FPS though anyone have any tips on how to speed this up?"


I didn't look at the code, but I'm guessing you are redrawing the window every time. Instead, draw a screen size gradient of the window background (that's it's maximized state), get this as an image, make a sprite out of the image, hide the sprite, then scale and paste the sprite as the window is resized so you are not redrawing the image every time. The extra details (the side bar and the title text etc.), will have to be redrawn on the pasted image so they do not scale with the sprite window background. Should be a lot faster - also if you don't need it, turn off the sprite transparency and the auto clear and redraw (SET SPRITE <num>,0,0).

Enjoy your day.
Nack
21
Years of Service
User Offline
Joined: 29th Jul 2003
Location:
Posted: 6th Aug 2007 08:43
I havnt read the entire thread. I attempted something like this awhile back, and this is what I find works (search dreamcreator if you want to see the gui).
As Latch said, get the image as a sprite. Dont ever redraw window every loop, waste of resource and kills ur fps.

Also, for event handling, you must code it in a way that only the active window will be tested for event handle. If you have like 5 window, and you constantly check if the mouse is on it, it will lag, especailly on DBC. Only check for event handling (buttons, checkbox etc) if the window is the current selected one. After all, the mouse can only be at one point at a time

My 2 cents
Nack


Nream is DONE! 3D Adventure Maker
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 6th Aug 2007 17:06
@Latch and Nack
Thanks guys, the sprite scaling is a great idea I'm guessing if I use PASTE SPRITE I can just draw over the top of it like before?
As for the active window thing I will implement this when I have made multiple windows, there is a window order value in the win array so I'll just make the program only check the top/active window.

@Sinani
The S variable is passed on to the dline function, it determines whether the line is solid(1) or dotted(2).

Your signature has been erased by a mod because it was rubbish.
Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 6th Aug 2007 19:06
Quote: "I know - the point is, we weren't! That's why I was pointing out that your comment "Shame on TDK!" was inappropriate.

You were passing comment on a discussion that you didn't even see and made it look like I had said something I clearly had not.

TDK_Man
"

Sorry TDK. I wasn't paying enough attention, and my comment was therefore incorrect.
Shame on me!

I never tell the truth.
That ain't a paradox.
I always tell lies is though.
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 7th Aug 2007 01:57
@Obese
Thanks for the tip. Now I can start working on putting text boxes in the window! BTW, I actually like the plain blue better than the gradient .

Did someone say 3D scanning on my desk, or was that just an AdBot?
What happens when when you mix coke, pop rocks, vinegar, and baking soda?
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 7th Aug 2007 06:35
Here's what I have for a user name & password login screen. But for some reason it's not taking input when you click on the "User Name" box like it's supposed to do.



Did someone say 3D scanning on my desk, or was that just an AdBot?
What happens when when you mix coke, pop rocks, vinegar, and baking soda?
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 7th Aug 2007 16:49 Edited at: 7th Aug 2007 17:31
@sinani
Quote: "But for some reason it's not taking input when you click on the "User Name" box like it's supposed to do."

Your selection area wasn't right. I removed it and put that bit of code back to how it was (why did you change it?)
I've also added a function to display an "entry box" like you were trying to do.
See if you can get the selection area right on this one (maybe you could write me a functions to detect selection areas!



Your signature has been erased by a mod because it was rubbish.
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 8th Aug 2007 05:20
What did I change that was bad? Also, I know a good way to make password boxes (stars instead of letters). So for now I'll try to get the area right...

Did someone say 3D scanning on my desk, or was that just an AdBot?
What happens when when you mix coke, pop rocks, vinegar, and baking soda?
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 8th Aug 2007 12:27
Try writing it in a function

Your signature has been erased by a mod because it was rubbish.
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 10th Aug 2007 04:16 Edited at: 10th Aug 2007 04:17
Quote: "Try writing it in a function "


Try writing what in a function?

anyways, I did some editing and got the same problem as last time - it doesn't do anything.
Hopefully it doesn't have to do with region

EDIT: oopsies, forgot the code!



Did someone say 3D scanning on my desk, or was that just an AdBot?
What happens when when you mix coke, pop rocks, vinegar, and baking soda?
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 11th Aug 2007 02:20
write the area checking thing in a function.
I'll check it tomorow going to bed.

Your signature has been erased by a mod because it was rubbish.
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 14th Aug 2007 23:50
Cool looking game

The problem with the gaming community is people think that the resolution of a game defines how good it is. I am not afraid to make a game where the main character is 50x50.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 15th Aug 2007 01:30
Thanks
I've stopped working on this for now because I'm concentrating on my 2D Articulated Skeleton project. Feel free to make suggestions though as I will be coming back to this later.

Your signature has been erased by a mod because it was rubbish.
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 18th Aug 2007 22:09 Edited at: 18th Aug 2007 22:13
I'm working on many add-ons like desktops, User select (with log-in that I'm still bug-fixing), window toggling, and applications.

Did someone say 3D scanning on my desk, or was that just an AdBot?
What happens when when you mix coke, pop rocks, vinegar, and baking soda?
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 18th Aug 2007 22:51
Quote: "User select (with log-in that I'm still bug-fixing)"

Why are you doing that?

Your signature has been erased by a mod because it was rubbish.
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 19th Aug 2007 02:36
It'll be kind of like a mini-operating system!

Did someone say 3D scanning on my desk, or was that just an AdBot?
What happens when when you mix coke, pop rocks, vinegar, and baking soda?
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 19th Aug 2007 02:51 Edited at: 19th Aug 2007 02:53
don't make the user thing it's pointless, I am in full support of the rest of your ideas
Quote: "applications"

ummm... ok? How you gonna do that?

Your signature has been erased by a mod because it was rubbish.
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 19th Aug 2007 07:13
I'll figure out something eventually...

Did someone say 3D scanning on my desk, or was that just an AdBot?
What happens when when you mix coke, pop rocks, vinegar, and baking soda?
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 20th Aug 2007 08:26
You should get the offeset of the top corner of the menu in relation to the mouse position so when you are moving the window it looks nicer. It seems strange that it just jerks to the corner of the menu when you try to move it.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 20th Aug 2007 12:01
OK I'll bear that in mind

Your signature has been erased by a mod because it was rubbish.
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 21st Aug 2007 18:22
Quote: "It'll be kind of like a mini-operating system!"


Actually it could be one if you restart your computer but instead of loading windows, have it run an exe of the program from a disk. And there is your operating system. Just make it be able to run applications and it will be fully functional.

(Y=M*X+B)=(X=(Y-B)/M)=(B=Y-M*X)=(M=Y-B/X)
and if you can figure out what it means i will give you a cookie.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Aug 2007 19:10
Pixelator is right, to be an operating system it has to actually OPERATE something

Your signature has been erased by a mod because it was rubbish.
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 21st Aug 2007 19:57
I think i will ditch Microbial Madness and work on an operating system!!!

(Y=M*X+B)=(X=(Y-B)/M)=(B=Y-M*X)=(M=Y-B/X)
and if you can figure out what it means i will give you a cookie.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Aug 2007 20:00 Edited at: 21st Aug 2007 20:02
I might try it too it sounds fun
watch you don't bust your computer though
I'm going to make a fake PC structure for the hacking game (that's what the console is for) and then use some commands to alter the data in the fake drives.

Your signature has been erased by a mod because it was rubbish.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 21st Aug 2007 20:15
Out of interest, I've been experimenting with a Drag 'n Drop GUI designer. Not quite the same as you are talking about here, but similar.

The idea was that you start off with a form and you drop components onto it and link them together.

With it, you would be able to create custom components like dialog boxes, fileselectors and alerts - but not windows as such.

What it would do is create functions that you #Include rather than use a DLL making it usable in all versions of DBC.

At the moment, I'm not sure if it's even possible to do what I have in mind, but it's interesting finding out.

TDK_Man

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Aug 2007 20:22
@TDK
just get Delphi

I can't see why you couldn't do that.
To enable the customizability (OMG that is actually a word)
I would make all the components independent and then store which window they are associated with, that would give you their visibility and their screen offset position (from the window's position).
That way you could have as many dialog boxes or scroll bars as you like on one window.

Your signature has been erased by a mod because it was rubbish.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 21st Aug 2007 20:37 Edited at: 21st Aug 2007 20:38
Quote: "just get Delphi"


Lol!

I don't need to - I've been a Pascal/Delphi programmer for over twenty years!

Actually, the Delphi interface is what I've based my GUI Designer on:



Essentially, users could create their own components in the form of functions and just call them from their own programs.

TDK_Man

Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 21st Aug 2007 20:47 Edited at: 21st Aug 2007 20:51
Quote: "watch you don't bust your computer though "


I will try it on my laptop that i have been experimenting with lunix on(installed it all by myself!!!) so that i wont lose everything.

[edit]
@tdk
Where can i get this and is it free?

(Y=M*X+B)=(X=(Y-B)/M)=(B=Y-M*X)=(M=Y-B/X)
and if you can figure out what it means i will give you a cookie.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 21st Aug 2007 20:50
Quote: "With it, you would be able to create custom components like dialog boxes, fileselectors and alerts - but not windows as such"


Interesting. Some ideas popped in to my head. The engine could run on the idea of an identity array. It would store some of the common components of all the gadgets: maybe upper left corner (for screen position) active,inactive, function number... The function number could be sent to a select case that runs the individual function for each type of gadget. The select case is housed in a function so that it can be edited by the main program and included with updates later. The gadget functions should all have as many common parameters as possible, so there is a consistancy in how to call each one. If a parameter isn't available for a particular function, it's default could be -1 or something.

If the desire to create a new gadget exists, the user selects a series of the common parameters that they want available in the gadget. Once the gadget has been built, a function is created with a name and common parameters and written to the include file.

Enjoy your day.
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 21st Aug 2007 20:53
Quote: "Out of interest, I've been experimenting with a Drag 'n Drop GUI designer. Not quite the same as you are talking about here, but similar."


lol, I was trying to do the same thing! However it is going to be like the original design OBese87 design (without gradient, because the other one actually looks better!)

Did someone say 3D scanning on my desk, or was that just an AdBot?
What happens when when you mix coke, pop rocks, vinegar, and baking soda?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 21st Aug 2007 21:02
Quote: "If a parameter isn't available for a particular function, it's default could be -1 or something."


ATM, when you select a component, only the properties which apply to that component appear in the Object Inspector panel.

This isn't my thread and I don't want to hijack it, so we shouldn't discuss it here. If/when it works enough to make a demo, I'll create a WIP post for it.

TDK_Man

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Aug 2007 21:20 Edited at: 21st Aug 2007 21:22
@TDK
Hey you ARE hijacking my thread!
I don't mind.
You sure like making editors

It does look a lot like delphi

I think Latch kind of said the same thing as me, I still think it would be best to store which panel/window the components belong to, it cuts out visibility variables and there's no need to change the component's position as it will move with its parent panel.

I'm happy for this thread to turn into a GUI showroom, I'm not working on this project at the moment so I'll just make a new thread when I am

How many smilies?

Your signature has been erased by a mod because it was rubbish.
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 21st Aug 2007 21:48 Edited at: 21st Aug 2007 21:52
six

A^2+b^2=c^2, but D^2-A^2/g^2*t-r-o-u-b-l-e = w+i+t+h / a*(c*a/p^i+t+o+l)/T+rhyming+with/P+f/o*r^(p-o-o/l)

That equation has a quote from a movie in it. Find it for a cookie
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 21st Aug 2007 22:24 Edited at: 21st Aug 2007 22:27
Quote: "watch you don't bust your computer though "

I was thinking about that, and if you could ever get back to windows!

If you really want to make it run the application, go to start>run>msconfig, and it's there somewhere, though I'm afraid to do it... because if it doesn't work... well... nothing will!!!! MUHAHAHAHAHA!
LOL I just had to say that

Did someone say 3D scanning on my desk, or was that just an AdBot?
What happens when when you mix coke, pop rocks, vinegar, and baking soda?
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Aug 2007 22:30
Quote: "and if you could ever get back to windows!"

Do it like pixel said: test it out and when you are ready make an EXE file and save it to a floppy, then reboot your PC with the floppy in. If you really get stuck you can always just reboot again without the floppy and windows will come back
DB is pretty safe, I don't think you'd get stuck in it unless you disabled the escape key and didn't give an alternative escape.

I just had a (not very) funny idea, how about a prison break game, but you can just press ESC and you win! lol, frustrating.

Your signature has been erased by a mod because it was rubbish.

Login to post a reply

Server time is: 2025-05-31 21:07:30
Your offset time is: 2025-05-31 21:07:30