Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Feb 2002
Offline Last Active Today, 12:28 AM

#5232533 should WndProc process WM_QUIT?

Posted by Endurion on 03 June 2015 - 01:40 AM

Little note on WM_QUIT: If you have more than one message pumps going (different threads); or nested pumps (modal windows for example), you may have to repost the WM_QUIT message if you receive it in one of the inner loops.


Mr. Chen says this: http://blogs.msdn.com/b/oldnewthing/archive/2005/02/22/378018.aspx

#5230785 Platformer movement and collision

Posted by Endurion on 25 May 2015 - 02:16 AM

The code snippet is completely missing the jumping part, so we are bound to guess.


My 8ball suggests a common mistake: Turn gravity off when jumping.



Or post at least the jump code and any code that controls both jumping and falling.

#5226908 DirectInput vs Windows API input

Posted by Endurion on 02 May 2015 - 10:52 PM

Be aware though, some parts of DirectInput are NOT available otherwise: Named controller parts (Axis, buttons, etc.) and calibration data.


Unfortunately I can't find the site anymore where they (not MS) explained how to use Raw Input generally but fetch the calibration and controller part info from DirectInput's registry entries.


My current library uses Raw Input to fetch HID data plus DirectInput data (not the library itself though) to interpret data. It's nicer for the player to select a named device than "some gamepad at USB port 17".

#5226646 How to store the file's messages?

Posted by Endurion on 30 April 2015 - 10:53 PM

Store it so that it's optimal to use during playing.


Since a song goes from start to step strictly forward a System.Collections.Generic.List<struct/class> might be your best bet.


You already have a enum, so convert from string to enum during the load phase. Put all data in a struct/class, Add the instance to your container and you're set.

#5221534 Issues with IDE Linker? Why is this happening, and how do i fix it?

Posted by Endurion on 05 April 2015 - 05:37 PM

Your BaseItem.h and Inventory.h have the same include guards. So Inventory.h including BaseItem.h will actually never include the content of BaseItem.h.

Just rename the include guard to BASEITEM_H.

#5221405 C\C++ - win32: how create regions by images?

Posted by Endurion on 04 April 2015 - 05:47 PM

This is a interesting read on WS_EX_TRANSPARENT. It might not do what you think it does:


#5220065 C#: How to best track in-game "states" of things (i.e. using bitwise...

Posted by Endurion on 29 March 2015 - 07:40 PM

You could for example use an enum, set the values to the various bits and annotate it with [Flags].
It's a C++-ism, and not that common, but it nevertheless works:
enum RenderType
  None = 0x0,
  DataUri = 0x1,
  GZip = 0x2,
  ContentPage = 0x4,
  ViewPage = 0x8,
  HomePage = 0x10 // Next two values could be 0x20, 0x40
You can use it like a normal type, but will have to cast to uint for storing/restoring.

RenderType renderFlags = RenderType.GZip | RenderType.HomePage;

#5215371 Returning a true in a function that has a bool return type

Posted by Endurion on 09 March 2015 - 12:48 AM

Sounds suspiciously what might happen if you write out of bounds somewhere (and probably somewhere else).


Are the convertedCoords always in bounds of _board?

#5210931 Disassociate mouse with its position

Posted by Endurion on 16 February 2015 - 01:51 AM

DirectInput is officially deprecated for keyboard and mouse.


Unfortunately it has one nifty advantage: All the possible buttons/axis/etc. of a gamepad/joystick get human readable names assigned, and you get calibration info; something I haven't gotten from RawInput.


In my engine I use RawInput plus DirectInput to match up controller info.

#5210799 Problem with D3DXMatrixOrthoLH, graphic glitch.

Posted by Endurion on 15 February 2015 - 05:23 AM

This looks rather like either a texel/pixel mapping problem or a texture sizing problem.


How did you load the texture? D3DXLoadTexture might have re-scaled your texture to a power of 2 width/height.

#5209829 How to make a 2d camera in DX?

Posted by Endurion on 10 February 2015 - 11:19 AM

It's also available in DX9: https://msdn.microsoft.com/en-us/library/windows/desktop/bb205346(v=vs.85).aspx

#5201715 When you realize how dumb a bug is...

Posted by Endurion on 04 January 2015 - 05:40 AM

You aren't a real programmer if you didn't have the AH! effect a few times.


It's once you find that nasty bug that has always eluded you.


In an older company I wrote a small tool that sat in the notification area. Once clicked it squealed like a pig and increased your personal score. It's quite relieving to hear a few squeaks every now and then :)

#5193389 Funniest line of code ever ?

Posted by Endurion on 18 November 2014 - 12:38 AM

Found this on TIGSource, and yes, it compiles and works as intended:


    case(0): if(test(a, b))
    case(1):     result = foo(a, b);
    case(2):     result = bar(a, b);

#5190517 How to Create a Folder Name using variable Components

Posted by Endurion on 01 November 2014 - 12:42 AM

Since you're obviously using C++, why on earth are you using char pointers as strings? Don't do that. Use std::string. Also, you can't concatenate char pointers like that. You are adding the char value of your Zone ID to your pointer, offsetting it into some undefined territory.


How about this?


std::ostringstream folderName;
folderName << "World" << WorldID;
mkdir( forderName.str().c_str() );

#5188364 IButton interface & other control

Posted by Endurion on 21 October 2014 - 01:03 PM

In this case System.Windows.Forms.ButtonRenderer might be what you're after.


Here is a sample at MSDN (http://msdn.microsoft.com/de-de/library/f0ys5025(v=vs.80).aspx)