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 / image problem

Author
Message
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 9th Mar 2009 05:59 Edited at: 9th Mar 2009 06:04
ok well i was workng on my form functions and realized that the way i'm doing it i would need about 300 or 400 images/sprites.

i know theres a better way i just don't know how :/ any suggestions


write now i have a seperate form image for each(wich has the text printed on it already) and 2 images per button i allow for 50 buttons 50 forms ad hopefully later many things this would mean for hundreds and hundreds and hundreds of sprites/images for scrollers, text boxes, minimize buttons, exc...exc..... i don't want this plus this would probly bog down the app alot :/ not a very helpful function set then now is it? lol


heres the code



ok i know i might need to redo my hole code i have thought about it. i have the window drawing code write there. witch was annoying and the other stuff i understand so it shouldn't be to hard now that i know but i need some oppinions first


priority is "working" exept when you click on a window it goes to the front but you don't see the buttons trying to fix that now.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 9th Mar 2009 08:36 Edited at: 9th Mar 2009 09:17
Well, when I was working on my form designer for a DBC challenge, I created a series of controls that I could combine however I wanted. There was a button, a text box, a list box, a blank form, a message box, a border, a frame, a check box, and a number box. There may have been 1 or 2 others. Basically, they could all be combined in different ways to make whatever kind of form I wanted.

The idea was to have the basic components that could be combined to design your window(s) how you need them. Once an entire form is designed, it can be saved as an image. If there are multiple forms on the screen, save a snapshot of the entire screen. Only paste the screen as you need to redraw it. If you have to edit a form like in a text box, or clicking on a button, use the default screen, or repaste the full image of the form and then just update the control on the form.

Understand what I mean? The idea is to never redraw more than you need. And if you have a full screen capture and the screen isn't changing, there's no reason to redraw or repaste individual items until they need to be updated (moved, clicked on, etc)

I've attached a few screenies of an app in development that uses only about 7 different controls to make up the different forms, buttons, decorations, and selection controls. The whole screen is saved as a bitmap and copied over to bitmap zero only when soething changes. Some forms are predrawn and saved as images, others are drawn on the spot or only their controls are redrawn to accept input:

Enjoy your day.

Attachments

Login to view attachments
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 9th Mar 2009 15:29
Off topic:

Nice forms latch!
I prefer The classic windows blue though lol

On Topic:

Hmmm so are you suggesting images instead of sprites? right now i'm using sprites now. although with images you don't need the title with the image cuz you can just use text. hm i was thinking a sprite with a high number so nothing would show over it what do you think? sprites or images?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 9th Mar 2009 19:00
If you use Sprites, you'll be running into the issues you've been posting about priority. One of the advantages of Sprites in a GAME is the simple collision detection. Another great feature of sprites is you can use them to block out any 3d or 2d that is not a Sprite. In a gui, these advantages may not be as useful. If, for example, you wanted to resize a window, you wouldn't want to change the sprite size or stretch it because that would skew any text and graphics. Instead you'd have to change the image then call Sprite. Though Sprites don't have to be updated unless you turn off the redraw... though performance is reduced.

In my opinion, using images and offscreen bitmaps would be the way to go. Most controls can be drawn using the built in DBC commands. Icons, or images for different purposes (maybe dials, background images, an image on a toolbar, etc) can be loaded and stored as needed.

Another alternative or addition, is to use 3d plains as sprites. The performance would be better, and you'd have more flexibility. Though it can be a bit tricky to implement.

Overall, do what works for you. Unless you are under a time constraint (or a motivation constraint ) try out different things. See what works best for your goals. I prefer using images, drawing, and offscreen bitmaps with pasting and drawing only as needed - doesn't mean it's the best way - and if it's combined with 3d, as soon as I SYNC, the 2d disappears so I'm forced to redraw or paste everything - that doesn't happen with sprites.

Enjoy your day.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 9th Mar 2009 22:53 Edited at: 10th Mar 2009 16:53
ok i see. i got the impretion from the forums that sprites are better



Edit:


Ok Well i tried using one image but for the forms how is that going to work? because of the different sizes of then i have on form that is the size of the screen but no way to scale it? what do you think about using one form image for each form then using the same buttons and other stuff over and over?

Login to post a reply

Server time is: 2025-05-16 12:18:10
Your offset time is: 2025-05-16 12:18:10