Author Topic: [C++] A little d3d framework that works like tinyptc  (Read 14267 times)

0 Members and 1 Guest are viewing this topic.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
The crinkler stuff is working for me, but I didn't want to confuse us by throwing that into the mix yet.  Maybe I'll post that in another thread.

Jim
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
The handling of the mouse-buttons using "GetAsyncKeyState" is somewhat unstraight.
I'm often running demos in windowed mode (because switching to fullscreen usually fucks-up all window arrangements on my dual-screen) and it shouldn't terminate when I'm clicking anywhere else :)
It'd also be nice to tell which video-mode it'll try to set.
The cherry on the icing would be a checkbox for 2x2 scaling (so smaller resolutions don't look like thumbnails).

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
I should really switch over to using the window messages to get the mouse buttons - one other good reason for that is that it means left handers who've swapped their left and right buttons will get the right outcome.

Do you know why going full screen is messing up your display?  It shouldn't do that with DirectX exclusive mode.  Is it just my lazy coding(!) or do other apps cause you problems too?

I saw the screen res dialog on your revamped barbecue demo.  I liked that and might pinch some of your ideas :)

Jim
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Do you know why going full screen is messing up your display?
Is it just my lazy coding(!) or do other apps cause you problems too?
All fullscreen apps do that. It's moving all windows over to the secondary displays and fails to restore them afterwards. Maybe a driver-feature :)

Quote
I saw the screen res dialog on your revamped barbecue demo.  I liked that and might pinch some of your ideas :)
I can share the source if you like. It's not particularly well optimized, though.
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Thanks, that's very generous!  I'll see where I end up.

Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C++] A little d3d framework that works like tinyptc
« Reply #25 on: October 04, 2010 »
I'd be very interested in the makefile / crinkler stuff in a seperate topic.
I'd love to add aspect ratios, but I have no way of testing it out with my setup.

Cheers!
« Last Edit: October 11, 2010 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C++] A little d3d framework that works like tinyptc
« Reply #26 on: October 23, 2010 »
Here's the latest version of this library.
It includes 3 new functions
ptc_blit(void *buffer, int srcwidth, int srcheight, int dstx, int dsty, int dstwidth, int dstheight, char filtering);
ptc_blitscale(void *buffer, int srcwidth, int srcheight, int dstx, int dsty, float scale, char filtering);
ptc_clear(unsigned int colour);

The two blit functions can be used instead of ptc_update to blit any source graphic to any size and location on the screen.  Very useful for getting round aspect ratio problems.  You can use bilinear filtering or not.
You may need to clear the screen using ptc_clear if you dynamically change the output size.
The sample code shows how to use it.

I have fixed the mouse button code so that it only reads the mouse when it is in the window.

Finally, I have included the ability not to have to use the C runtime library.  Just put the crinkler exe in the folder and call it link.exe, and choose the Release No Runtime configuration to try it out.  The sample exe comes out at 2k, which isn't miniscule but it is fun!

Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C++] A little d3d framework that works like tinyptc
« Reply #27 on: October 24, 2010 »
Magic!!! & Thanks!!
Will have a proper play in ze morning.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won: