Jump to content

  • Log In with Google      Sign In   
  • Create Account

Endurion

Member Since 21 Feb 2002
Offline Last Active Today, 01:32 PM

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

Posted by 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:
 
 
[Flags]
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 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 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 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 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 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 on 18 November 2014 - 12:38 AM

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

 

switch(mode)
{
    case(0): if(test(a, b))
             {
    case(1):     result = foo(a, b);
                 break;
             }
             else
             {
    case(2):     result = bar(a, b);
                 break;
             }
}



#5190517 How to Create a Folder Name using variable Components

Posted by 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;
 
/MAKE NEW DIRECTORY
mkdir( forderName.str().c_str() );



#5188364 IButton interface & other control

Posted by 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)




#5188292 IButton interface & other control

Posted by on 21 October 2014 - 05:54 AM

You need to provide more information.

 

What framework do you use? (Win32? MFC? Windows.Forms? WPF?)

What language?

 

What is this IButton interface? In what context does it exist?




#5187308 Converting project code from VS13 to Code::Blocks, massive amount of errors

Posted by on 15 October 2014 - 11:24 PM

It's not a VS bug, it's a intended (and useful) feature. It's what VS calls an extension. Unfortunately it's non standard.

 

There's a switch in the compiler options to turn any non standard extensions off.




#5182319 Win32 Window gets stuck as the top-most window

Posted by on 22 September 2014 - 11:46 PM

Yeah, I noticed that. DX (at least with 9) adds the WS_EX_TOPMOST style to your window. So whenever I return from fullscreen I remove the style again. Before going fullscreen I store the current window styles (both style and extended style), and restore them afterwards.

 

Use SetWindowLong with GWL_EXSTYLE to do that.




#5180271 Macros doesnt work anymore (visual studio c++)

Posted by on 14 September 2014 - 11:05 AM

You have to add some entries to a few config files. Which depends on the VS version. Looky here (http://visualstudioextensions.vlasovstudio.com/2014/02/13/visual-studio-2010-macros-stop-working-after-february-2014-windows-update/)




#5179908 GET request contains addional non wanted data for XML document

Posted by on 12 September 2014 - 10:40 AM

Since you do a direct socket connection, could it be chunked encoding? (http://en.wikipedia.org/wiki/Chunked_transfer_encoding)




#5176588 Weird rendering issue (rows of pixels are drawn weird)

Posted by on 27 August 2014 - 10:49 PM

This is pretty sure a problem with your backbuffer size not matching the windows' client area size.

 

Do you use AdjustClientRect(Ex) to calculate the required windows size to offset for the border and caption?






PARTNERS