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 / Bluegui unknown type error

Author
Message
aerostudios
17
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 10th Jun 2014 03:02
I was having a real timing issue with DBPro using sprites for my air traffic simulator. So, I elected to try Bluegui and a window with a canvas instead. I worked all day long, it was working really good, so I introduced the code into my DBPro app, and included the "gui.dba" file as required. Now, I cannot compile the program without the error "unknown type"

Here is the code I added:

Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 10th Jun 2014 03:43
I use BBB GUI. Suprisingly no reply to that thread since July last year which is why it is so far down the WIP list.

If this is the BlueGUI from way back; you need to call the Start Blue GUI command first, if I remember correctly.

aerostudios
17
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 10th Jun 2014 03:56
Thanks Chris,

Actually, I did have the older version, and just today updated to the new re-invention of it. So, the Start Blue Gui command is no longer needed. But, the code above was working just fine by itself. It's acting as if the DLL cannot be found or something.

I was trying to find BBB GUI earlier and wasn't sure where to find it exactly. I may need to consider using it instead. Thanks.
aerostudios
17
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 11th Jun 2014 03:44
Chris,

Okay, here are my requirements; do you think BBB GUI can do all of this?

1. Must create a borderless form, canvas, or whatever.
2. Must be able to set the background image to a single image, or multiple images overlaid on a background image.
3. Must be able to load a custom font.
4. Must be able to print using the custom font with a transparent background, foreground color.
5. Must be able to update this form without inteferring with the DBPro frame rate.
6. Must be able to set the transparency of the form on the fly.

Right now, I am using sprites.

1. I first load the bitmap background #1
2. I then load the display overlay bitmap #2
3. I then set my custom font and use the TEXT command to place the aircraft on the BITMAP.
4. I then copy the overlay bitmap #2 over the first. It is a PNG with transparency.
5. I then GET IMAGE of the bitmap.
6. I then create a SPRITE of the image and position it in the upper right of the screen.

Updating the image of the sprite causing a halt of the main game loop until it is done. It is very annoying.

Any ideas?
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 11th Jun 2014 13:16
Quote: "5. I then GET IMAGE of the bitmap."

This will be slow, might it not be possible to instead render to the sprite's image using another camera?
I'm not sure if that may not catch the text however. A workaround in case it doesn't is to just write the text on top of the sprite when rendering it to the screen.

As for your problems with BlueGUI, what line does it report the error at?
I believe that some new function has been added in later updates to DBPro that breaks the COMMAND constant in gui.dba. If you rename it it should work, as far as I recall.


"Why do programmers get Halloween and Christmas mixed up?"
aerostudios
17
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 11th Jun 2014 13:49
I'm not sure I understand the part about using another camera. The background image is a 2d graphic of an airport. The text I am printing is a font that displays aircraft for letters. I am using the TEXT command to print the text to the image/bitmap. I am pretty sure that is the command that is causing the hesitation.

I have recieved the error about the COMMAND constant when using Bluegui. The Bluegui code I put together to replace the stuttering problem in my program, works fine when I run it alone. But, when I added it to my really LARGE program, that's when I get the "unknown type" error.

That error is reported at the first line of code that uses any command from Bluegui. It first reported it when I used "CREATE FONT" command. So I commented out that line of code, and the next line of code used the "CREATE WINDOW" command, and the error was reported there, and so on.
aerostudios
17
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 11th Jun 2014 13:53 Edited at: 11th Jun 2014 14:00
Here is the sequence of images used for my ASDE-X display.

Image #1 - the map


Image #2 - the overlay


Image #3 - The finished sprite after plotting aircraft positions


I also tried creating a sprite sheet of the aircraft symbols and using it to create individual sprites of each aircraft. I then just updated their positions, relative to the map. This eliminated using the TEXT command, but it still caused a momentary pause of the gameloop.
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 11th Jun 2014 20:56
Quote: "It first reported it when I used "CREATE FONT" command. So I commented out that line of code, and the next line of code used the "CREATE WINDOW""

If those are the BlueGUI functions there are no spaces in them.
Try using createFont and createWindow instead. If you just wrote them like that here and not in your source I would hazard a guess you have declared CREATE as a function / constant / variable / label somewhere and that's what it's complaining about.


"Why do programmers get Halloween and Christmas mixed up?"
aerostudios
17
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 11th Jun 2014 21:40 Edited at: 11th Jun 2014 21:41
Rudolpho, as I stated, the code that creates that HUD works fine until I add it to my main program. Yes, I am formatting the commands properly, there are no spaces. I was just explaining the problem, not sharing the exact code. But, if you look at my original post in this thread, the actual is there and it works just fine when I run it standalone. So, I have no idea what would cause it to fail when I add it to my very large DBPRO application.

And also assume that #include "gui.dba" is in my source file, even though I do not show it in my code sample.
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 12th Jun 2014 00:45 Edited at: 12th Jun 2014 00:53
Quote: "Chris,

Okay, here are my requirements; do you think BBB GUI can do all of this?

1. Must create a borderless form, canvas, or whatever.
"

It should. I say should because it deals with low level windows messages, but I do not use windows forms much.
* BBB Window_Make has two style parameters
* Style parameter is supposed to control the look of the form
* The BBB GUI constant WS_BORDER sets the border as active, therefore it must be possible for it to be borderless
* Even if this failed; BBB GUI has a skins system, but you need to create a windows theme for the application using form resources; not my best topic


Quote: "2. Must be able to set the background image to a single image, or multiple images overlaid on a background image."


The BBB GUI can make image controls. An image control can be used as a form background. BBB GUI can also draw using graphic functions.

Quote: "3. Must be able to load a custom font."


This is trivial for BBB GUI. It can even format the font.

Quote: "4. Must be able to print using the custom font with a transparent background, foreground color."


Do you mean print on paper? I cannot remember how to print a form to a printer; I only know how to do that with WPF.

If you mean display text on your game window to appear as regular text with no background; this is possible but I do not know if it will be double buffered so that it does not flicker all of the time.

I am not sure why you would want to do that since regular text commands would be easier to use.

Quote: "5. Must be able to update this form without inteferring with the DBPro frame rate."


Trivial, DBPro draws onto a form anyway, any updating of an additional form is mostly handled by the operating system.

There is one thing to watch out for and that is the dragging of the form around; I am 100% sure that it will either flicker or temporarily pause your program. This is even the case to a degree with Microsoft's latest window drawing technology, although it is more forgiving.

Unparenting the form may fix the problem, but that is a wild guess.

6. Must be able to set the transparency of the form on the fly.
This tecnically posible, but not briliant with the old forms. You might suffer with flickering, but I could be wrong; the last time I tested this was when I had XP; I think Windows Vista or above are more forgiving with form transparency; note that a forms window is different to a WPF window.

One of the beauties of the old original Blue GUI was its ability to draw DBPro images onto its forms, thus alowing you to make viewports. That is likely not possible with BBB GUI, or at best difficult to hack.

Quote: "Right now, I am using sprites.

1. I first load the bitmap background #1
2. I then load the display overlay bitmap #2
3. I then set my custom font and use the TEXT command to place the aircraft on the BITMAP.
4. I then copy the overlay bitmap #2 over the first. It is a PNG with transparency.
5. I then GET IMAGE of the bitmap.
6. I then create a SPRITE of the image and position it in the upper right of the screen.

Updating the image of the sprite causing a halt of the main game loop until it is done. It is very annoying.

Any ideas? "


Yes, drop bitmaps for render targets. Install Matrix1 utilities and use Draw To Image, followed by Draw To Camera/Bitmap/Target to restore drawing to the screen. Paste the UI image to the screen before the sync call; this is much faster; you can even add some interesting effects to UI using the ImageKit to create fast rendering drop shadows and whatnot using shaders. Less complicated than it sounds.

TopGUI is not a bad user interface system for DBPro, it adds 7,000 lines of code to your project, but provides you with a great deal of control.

aerostudios
17
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 12th Jun 2014 02:04
Chris,

Thanks for all your great tips. I did overcome the problem using animated sprites. I created a sprite sheet of the aircraft symbols (0 - 360 degrees step 10 degrees)

I then created 42 sprites for the maximum of 42 aircraft. During the aircraft model movement update, I simply update the sprites to match the 3d models x/y coordinates. Its now working without hesitation. I just created a backdrop of the ASDE-X map, and positioned the SPRITES over it. Its an illusion that will work fine, and is not impacting the frame rate at all.

But I am still going to explore the other GUI tools you have identified. I do have a need for normal windowed functions that are not native to DBPro.

Login to post a reply

Server time is: 2026-07-07 04:09:27
Your offset time is: 2026-07-07 04:09:27