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 / Can someone look at this "Menu" code for me....

Author
Message
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 8th Feb 2018 12:21 Edited at: 8th Feb 2018 12:22
I found this on DarkBasic Code Corner. (http://dbcc.zimnox.com/) in the CodeBase section.

It's pretty perfect for what I need, however...I cannot figure out how to add text to the BODY of the menu as he didn't include that in the example code...I'm not that good with sprites/text/image manipulation.

Here's the code, no DLLS, runs standalone as posted. (I had to tweak it a little to run at 800x600 for me, but I left the original code here which tries to run at 1280x1024)

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 8th Feb 2018 13:39
I tried to run it but there are at least two errors within.








So many games to code.....so little time.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 8th Feb 2018 14:29
Quote: "I tried to run it but there are at least two errors within.
"



Those errors are from having another DLL installed in the plugins user dir, I had the same issue...

I forget if it was Blue or BBB...I think it was Blue, I moved one (or both) from the plugin dir and the code worked.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 8th Feb 2018 14:34 Edited at: 8th Feb 2018 14:35
Just checked, I moved "gui2.dll" (Blues) out of the plugins-user folder and the code worked.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 8th Feb 2018 14:39 Edited at: 8th Feb 2018 14:40
The Windows are pretty slick, and they don't have the DLL overhead. Plus they do Transparency Windows, which I don't think Blue or BBB support.

And they run at a decent frame rate.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 8th Feb 2018 14:44
LBFN,

Haha...I just noticed your sig....is this where the "Gimme the codez" started?

I remember such a post, just don't remember it's origin (here or somewhere else).
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 8th Feb 2018 15:00
Book is stupid. He just wants teh codez.
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 8th Feb 2018 15:06
Quote: "Book is stupid. He just wants teh codez.
"



Come on man...just "Gimme teh codez!!!11!"

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Feb 2018 18:44 Edited at: 8th Feb 2018 18:50
Well the body of the window is a sprite apparently.

In CreateWindow() I set it to return the ID of the window being created, aWin. Then I wrote this function to retrieve the sprite ID of a window body.



You can use that to determine the position of the window's body on screen and overlay whatever you want on top. Use the other attributes to determine if it's hidden or not.


Ok, on second thought, that doesn't work. It appears even though he has flags to track if the window is hidden or minimized, they don't actually get set ever by any event. So they're useless. Looks like this example was written more for show than functionality, I'd just write your own.

If you need help writing a GUI from scratch in DBP, I might know a thing or two.
itunes clone with movable columns
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 8th Feb 2018 22:26
Quote: "Haha...I just noticed your sig....is this where the "Gimme the codez" started?

I remember such a post, just don't remember it's origin (here or somewhere else).
"


It's been a while since I made it, but I did not originate it. I think Ortu is correct.



So many games to code.....so little time.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 8th Feb 2018 22:51
Quote: "If you need help writing a GUI from scratch in DBP, I might know a thing or two.
itunes clone with movable columns"


That iTunes thing looks nice. A bit of overkill for my needs though.

Guess I'll mess with the code I posted, maybe I'll learn something.
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 10th Feb 2018 01:15 Edited at: 10th Feb 2018 01:32
I don't know what you are doing but try this:
https://forum.thegamecreators.com/thread/220759
Nobody said this had to be difficult.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 10th Feb 2018 01:25
Quote: "I don't know what you are doing but try this:
https://forum.thegamecreators.com/thread/220759
"


Looks nice, but I'm trying to stay away from DLLs at the moment. Will give that a try in the future when/if I need it.
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 10th Feb 2018 01:36 Edited at: 10th Feb 2018 01:41
There's no DLL's. Nothing compiled. Just a source code.

You add an include statement at the beginning of your code, a simple function call to start the system.
Then you can just call functions from the source code you attached and they are designed so that you can immediately add buttons, and bitmap text, etc. No limits.
It's a completely pre-built GUI system that you can just drop into your program source code. Not compiled, so you can change anything you want.

Imagine if you made a GUI for a game and you wanted to transfer that GUI to another game. Modular source code.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 10th Feb 2018 02:20
Quote: "There's no DLL's. Nothing compiled. Just a source code."



Ahh! Ok, then! I was just skimming thru the thread and saw you mentioned about turning it into a plug in so I assumed you had.

Login to post a reply

Server time is: 2024-04-20 12:24:47
Your offset time is: 2024-04-20 12:24:47