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 Professional Discussion / Suggestion on Building GUI Framework in DBpro.

Author
Message
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 3rd Apr 2003 21:36
Hi, building GUI elements in a game is quite a fundamental thing. These GUI elements are like window, button, menu, message box, dialog, etc.

I would like to hear any comments on creating a good GUI framework in DBpro. I know I can do this by creating these elements as images and take care of those mouse click and user interaction manually, but I can imagine that it will be VERY messy.

Is there any libraries out there? Or any good suggestion on this?
Thanks a lot!
Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 3rd Apr 2003 21:54
Surely the interface to your game is what makes your game unique.

If we wanted all games to look the same we could use windows GUI features and write minesweeper retro remix...

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 3rd Apr 2003 22:33
Well, I don't know if this will work but here's a simple Windows GUI that I wrote:



Functions:

Group(x,y,x2,y2,text$) (similar to VB's Frame)
LineBox(x,y,x2,y2) (needed internally)
Checkbox(x,y,text$,value) - Draws a checkbox depending on input (see below)
ChkCheckbox(x,y,text$,value) - Will perform check on checkbox (changes value depending on clicking)
Button(x,y,width,height,text$,Value,Tooltip$) - Will draw a button
Label(x,y,text$) - draws a label

Usage:
From my own program



General guide:

Buttonname = button(10,10,20,20,"Caption",Buttonname,"Tooltiptext"

I'll probable release this when finished.

You are the th person to view this signature.
Programmers don't die, they just Gosub without return....
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 4th Apr 2003 00:44
I think that what people really mean is proper WINDOWS API controls.

I am working on a menus DLL atm. currently you pass it the title of your DBP App's Window and it creates a menu and adds items as you specify. The difficult bit is finding out when a GUI item has been interacted with. Somehow I have to process a WM_COMMAND message, but doing this for a remote Window is prooving pretty tough for me.

Current Project: Retro Compo. Entry.
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 4th Apr 2003 05:50
No Rob, I don't want Windows Control. What I am looking for is something like the one suggested by David89. It looks very straightforward to me.

Any more inputs?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Galiem
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United States
Posted: 5th Apr 2003 01:36
I was asking about this recently too.

Main reason I wanted to know, is I have an idea which will allow me to create a world editor that will have ALOT of power, but won't have the performance issues some editors that are this powerful have.

DBPro cannot access the API at the moment, I was told, even through DLL due to callbacks.

Basically, your program can talk to the DLL, telling it what to draw when a menu is clicked, for example, but the DLL cannot talk to your program to find out what to draw when that menu vanishes. What you end up with is a drop down menu, for example, that won't go away.

To solve this, I am mimicking the Windows GUI in the main loop of my program by having it watch the mouse cursor position with each pass. When the cursor is within a certain range, and the user clicks, program flow is passed to a function containing the instructions to draw the menu.

A snapshot is taken of the piece of screen the menu will cover before the menu is drawn, then as soon as the menu closes, the snapshot is glued back onto the screen where it belongs.

Works seamlessly for me 8) Wish I had a code sample with me here at work

Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 5th Apr 2003 02:25
well you can use the Windows APi through DLLs if you setup the environment pointers right ... call back and overlay the controls sending data in/out using the DLL commands.

however if you're willing to goto the trouble of setting up the DLL in the first place then you'll find its actually simply just to use DirectX with the full range of the APi at your disposal in the first place.

Bullseye, i'd suggest a good understanding of the types and arrays with buffering arrays (setup your own form of semi-auto management) - its the best way to get certain effects done... place within a memblock the number of the arrayed index and then the number of the array - you'll find you can trawl the memory better that way allowing for alot of leverage and access speed for data needed.

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Sean
23
Years of Service
User Offline
Joined: 31st Jan 2003
Location:
Posted: 5th Apr 2003 04:27
If you are interested in using the windows api/controls etc. I posted a small sample to use a DLL created with purebasic in the code snippets forum. It shows how to get all of the windows messages also.
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 5th Apr 2003 04:49
Actually, I don't even need Windows API. I don't want my game to looks like a Windows application. What I would like to heard is inputs from various developer here how do they code their GUI elements in their game. Like what David89 suggested is one way.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/

Login to post a reply

Server time is: 2026-07-11 12:03:06
Your offset time is: 2026-07-11 12:03:06