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.

Dark GDK / Image size

Author
Message
Sparky Coldfire
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location:
Posted: 8th Jan 2008 03:22 Edited at: 8th Jan 2008 06:01
Hi All,

Just getting started with Dark GDK, and I'm building a Poker game. I have some png images of cards that I want use, but when I load them as images and then either dbPasteImage() or dbSprite() them, they end up being larger (pixel wise) than intended. The cards are 71x96 in my paint program, but on-screen they are 89x122 (about 30% larger). Enclosed is a screen shot of the game next to the paint program. Can anyone please explain why this is?

- Sparky -

Attachments

Login to view attachments
Sparky Coldfire
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location:
Posted: 8th Jan 2008 06:45
Hi All,

Just getting started with Dark GDK, and I'm building a Poker game. I have some png images of cards that I want use, but when I load them as images and then either dbPasteImage() or dbSprite() them, they end up being larger (pixel wise) than intended. The cards are 71x96 in my paint program, but on-screen they are 89x122 (about 30% larger). Enclosed is a screen shot of the game next to the paint program. Can anyone please explain why this is?

- Sparky -

Attachments

Login to view attachments
Pharoseer
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: Right behind you
Posted: 8th Jan 2008 08:54
Hey Sparky,

Can you post a sample of the code that you're using? It'll help us to determine what's going on. Are you setting the display mode or using the default resolution?

Also, careful of double-posting. If you're new on the forums it can take a few hours for your posts to appear. It takes some time before your posts will instantly appear.

-Frank
Sparky Coldfire
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location:
Posted: 8th Jan 2008 15:13
Sorry about the double post. I had inadvertenly left out the attachment the first time, and when I remembered and added it, the interface to this forum looked like it had deleted my post (probably the spam filter this thing uses). So I posted again.

Not changing the display resolution. My desktop is set for 1024x768x32. I am trying to use a window so that I can do things like the screen shot to help debug. Ultimately, I would like to go full screen though.

After poking around with this for several more hours, I determined that it has to do with setting the window size. If I leave the window at the the detfaut resolution (640x480), the cards appear correctly, but I want the window to be 800x600 so I call dbSetWindowOn() and then call dbSetWindowSize (800,600). Apparently it doesn't work in the reverse order. This has the effect of growing the card graphics (actually the whole window contents) proportionately.

I'm suspecting that since the 2d stuff is really using all the 3D stuff to implement, that there is a projection matrix being set up somewhere that I need to somehow refresh after I change the window size. Shouldn't have to worry about this in 2D obviously, but then again, I haven't seen any really good info that says when setting up a 2D Windowed app, do this first, then do that.

Here is a code snippet
dbSyncOn ( );
dbSyncRate ( 60 );

dbSetWindowPosition (112,84);
dbSetWindowOn();
dbSetWindowSize (800,600);

dbSetWindowTitle("Home Poker");

dbRandomize ( dbTimer ( ) );

// make a green background
dbBackdropOn();
dbColorBackdrop(dbRGB(0,150,0));
dbSync();

Then I start blasting stuff to the window.

- Sparky -
Sparky Coldfire
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location:
Posted: 9th Jan 2008 07:11
Ok, I figured it out. For those who run into this same issue, the solution is that you also have to call dbSetDiplayMode(). So in my case my desktop is running at 1024x768x32 and I wanted to bring up a window that was 800x600. I never would have guessed that I need to call dbSetDiplayMode(800,600,32). You would think that would set the display to 800x600x32 wouldn't you? But it doesn't. My desktop stayed at 1024x768 and witout any apparent change to the actual display, it scaled the images and sprites correctly within my already sized 800x600 window. I've only been playing with this for a few days and I'm starting to think this GDK was not worth the price (free). I'll keep at it though and see if the whole thing is this wacky or if this was just an isolated incident.

- Sparky -
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 12th Jan 2008 22:53
Quote: " I never would have guessed that I need to call dbSetDiplayMode(800,600,32)"


Well, yes, the window size is not the same as the "render target" size. That allows you to do various effect which you wouldn't be able to do if that was bounded.

Quote: "You would think that would set the display to 800x600x32 wouldn't you? But it doesn't. My desktop stayed at 1024x768 and witout any apparent change to the actual display, it scaled the images and sprites correctly within my already sized 800x600 window."


Sure because you have to set your window size and display mode to be 1:1 at size. That does make sense, doesn't it? Once you make your application fullscreen, then changing the "display mode" will also change the actual video resolution. But - yes - I admit that the name could be more precise, that's for sure.

Quote: "I've only been playing with this for a few days and I'm starting to think this GDK was not worth the price (free). I'll keep at it though and see if the whole thing is this wacky or if this was just an isolated incident."


Hehe, welcome to my club Although what you are describing actually makes sense to me, I wouldn't blame it for that.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 14th Jan 2008 05:44
Set the mode then dbSetWindowOff() - and you got it.

DarkGDKL is Quirky - but its FAST.... Faster than DBPro!

I like it - and like DBPro - I'm getting the quirks down a little - and so far its been alright! FRustrating at times - but that's par for the course with programming.

tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 14th Jan 2008 10:44
Quote: "Set the mode then dbSetWindowOff() - and you got it."


That's likely be used in release version only, and even there it's not always wanted to go fullscreen, especially for a Poker game
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 14th Jan 2008 11:02
I use Full Screen Whenever I want the extra speed - ... Like I personally try to make my game run decent in 60fps "Environment" but when I want to see it in all its glory I go fullscreen.

Now - Not Wanting to GO fullscreen brings us to the Desktop. I don't know of a way to get faster then the Windows XP "Monitor Refresh Rate" ... makes sense too - because other apps are sharing the "vsync" and ultimately the same 2d surface.

Now to speed the Game up in that scenario - Multi-threading seems the Cure, but also seems hodge podge as this is a whole new (mostly unexplored to my knowledge) gambit for DarkGDK users. This May be when you want Raw DirectX - then you can have thread safe stuff going on with "graphic related" stuff the various threads are sharing etc.

tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 14th Jan 2008 11:36
Quote: "I use Full Screen Whenever I want the extra speed - ... Like I personally try to make my game run decent in 60fps "Environment" but when I want to see it in all its glory I go fullscreen."


Yes, but that's because of GDK. If you consider a real game, the windowed/exclusive mode choice depends on the game type, not on the speed you want to squeeze out of it

Quote: "Now - Not Wanting to GO fullscreen brings us to the Desktop. I don't know of a way to get faster then the Windows XP "Monitor Refresh Rate" ... "


Well, it's simple - you just create the Direct3DDevice with appropriate flag. Unfortunately, with GDK it's likely not possible

Login to post a reply

Server time is: 2024-10-08 16:02:57
Your offset time is: 2024-10-08 16:02:57