Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Endurion

Member Since 21 Feb 2002
Online Last Active Today, 01:32 AM

#5051098 What windows messages should a well behaved app support?

Posted by Endurion on 07 April 2013 - 11:12 PM

You can choose to handle all or none.

 

Most important is that you pass ALL of them on to DefWindowProc unless you explicitely handle it and the docs say you can return a specific value from your WndProc.




#5049872 Converting the mouse position to

Posted by Endurion on 04 April 2013 - 03:37 AM

The functions to project/unproject exist (at least up to D3DX9), they're called D3DXVec3Project and D3DXVec3Unproject.




#5048366 Should I Use MSVC For My Release Build?

Posted by Endurion on 30 March 2013 - 01:12 PM

3) Add a version resource to your project. There you can set the wanted fields quite easily.




#5043889 VC++ 2010 crashes on ShowWindow(..)

Posted by Endurion on 16 March 2013 - 11:46 PM

Your registered class and the class passed in CreateWindowEx do not match ("Main Class" vs. "WindowClass")




#5042594 finshed breakout game

Posted by Endurion on 12 March 2013 - 11:25 PM

After all this time you actually completed it, big congrats to you.

 

 

Works fine here, however the key controls have the Input type delay. If you're using WM_KEYDOWN/WM_KEYUP to check for this, try using a bool array to remember if a key is pressed/released. In the main loop only check for the bool array (set pressed=true when WM_KEYDOWN, pressed=false when WM_KEYUP). This should get rid of the delay.




#5041501 Tiled games

Posted by Endurion on 10 March 2013 - 07:35 AM

For tile collision:

 

The usual approach to tile based games is having them in an array (and thus concrete locations). Now you take the location and size of your object and calculate the tiles below the corners. This obviously only works if you have tiles of the same size.

 

Pseudo Code:

 

X1 = object Location x / tile width

X2 = ( object Location x + object width ) / tile width

Y1 = object Location y / tile height

Y2 = ( object Location y + object height ) / tile height

 

Now you only need to loop over X1,Y1 to X2, Y2

 

 

For object collision the quad tree method talked about above is a good solution




#5041416 Background task running in CMD on startup

Posted by Endurion on 10 March 2013 - 12:58 AM

As Khatarr said, HijackThis is good in listing all kind of auto start commands.

 

You could also leave the prompt open and use Process Explorer to find the process. From ist properties you should see the file this has been started from.




#5040729 Passing file name to main with Windows "open with" option

Posted by Endurion on 08 March 2013 - 02:26 AM

Play safe:
 
Use GetModuleFileName to fetch your executable file name.

Remove the file name.

Use the resulting path to create absolute paths for every file access you have.




#5036150 crash on exit, something to do with crtexe.c

Posted by Endurion on 24 February 2013 - 01:11 PM

Usually a exception comes with a bit more of info (show all you've got). Is the debugger stopping in the c runtime? If so, there should be a comment or message near the break location indicating what went wrong.

 

Probably you accessed freed memory or wrote out of bounds somewhere.




#5028550 iterator list corrupted (with alt-F4 only)

Posted by Endurion on 03 February 2013 - 11:50 PM

Should you really be closing an application down with alt-f4 anyway? smile.png

 

If it's only happening from within visual studio then maybe the debugger simply doesn't like to quit by alt-f4? I'd recommend setting up maybe the Esc key to quit so your application can close gracefully.

Not a good idea to ignore the problem. Alt-F4 has the same effect as pressing the X on the top right. i.e. it's sending a WM_CLOSE to your WndProc. A lot of users use those ways to close a program.

Ignoring doesn't make a problem go away.




#5028259 How to avoid slow loading problem in games

Posted by Endurion on 03 February 2013 - 12:45 AM

As Daark hinted at, being nice to all kind of mangled formats/dimensions is useful during production, but once you hit the finish line, store the stuff in the exact format you need in memory.

 

Simple block reading is the best you can do for loading times.

 

Depending on the target system you may have to make compromises though (file size vs. loading speed).




#5025688 win32 Tree View Control - dropping of tree-view items

Posted by Endurion on 26 January 2013 - 01:20 AM

You have to recreate new nodes at the target location. You cannot re-seat a HTREEITEM.




#5022973 Game directory, alternative to Program Files (in Windows)

Posted by Endurion on 18 January 2013 - 01:56 PM

The proper way is Program Files (the localized name of it must be retrieved). You can only store static data there, only the setup is supposed to use the admin user. The dynamic data should be written to the users appdata or own files folder. This way your game can run cleanly under a normal user.




#5019781 return to breakout

Posted by Endurion on 10 January 2013 - 12:03 AM

You already have an array with a bool inside that tells if a brick is active or not. You only do the collision check if the brick is still active.


#5018470 drawing triangle using dx9

Posted by Endurion on 07 January 2013 - 12:15 AM

Just few tips, a triangle has 3 vertices a square has 4 at least (you may need more).

Find where you declare vertices,

 

You will need a switch to check if you are in square mode or triangle mode, and to a way to change that switch at runtime. (By switch I mean a Bool variable, True, False)

There is no square mode.

 

A square is simply a list of two triangles instead of 1. The simplest way would be to add the 3 vertices of the second triangle to your vertex array , change the "3*" in the CreateVertexBuffer call to "6*" and change the "1" in the DrawPrimitive call to "2".

Get that working first, don't bother with the other primitive types yet.






PARTNERS