Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Daniel_RT

Member Since 24 Sep 2011
Offline Last Active Jun 28 2014 11:16 AM

#5026890 Pointer array sizeof question?[Problem Found](Embarrassing problem)

Posted by Daniel_RT on 29 January 2013 - 01:47 PM

Hmm that's weird, only thing different from yours to mine is WORD and that is 2 bytes less than DWORD...

 

unsigned int numIndices = Model.Total.Face* 3
indexBufferDesc.ByteWidth = numIndices * sizeof(WORD);

 

Maybe the number of faces is wrong?




#4990189 If statement weird behavior

Posted by Daniel_RT on 14 October 2012 - 05:37 PM

Hmm maybe an issue with the constant buffer in the c++ code? Also it might be better to have them as a separate effect? So that you don't have an if statement per pixel.


#4945566 Getting mouse and keyoard input

Posted by Daniel_RT on 02 June 2012 - 07:10 AM

Using and handling the windows messages is probably the fastest option as the raw messages are rapid and you get them for free anyway. When I say free, I mean they are sent regardless of other solutions, so you might as well use them. If dealt with in a nice way, then you get very smooth results.

Basically the way I do it is pretty simple:

1) Set up a keyboard class or manager
2) Set up an array of 256 keys, giving them a state of "not pressed"
3) Once a WM_KEYDOWN message is sent, I convert the wParam into my set of key defines "static_cast<EKeyCode>(wParam)" which gets sent into a helper function within the keyboard class to register that key as "pressed", if another message is sent for the same key and that key has a "pressed" state, then that key is set to "held"
4) Then once the WM_KEYUP message is sent for that key, set it's state to "not pressed"

Then in the main game code, it's just a case of simple checks like so:

if ( keyboard.KeyHit( Key_Escape ) ) // kill the program

if ( keyboard.KeyHeld( Key_Space ) ) // accelerate

Mouse clicks can also be used exactly the same using the WM_LBUTTONDOWN, also get access to the mouse's location.

So yeah, my opinion - Raw data is very easy to set up, and is very fast. Once done correctly, it can be very simple, easy to use/read.
Using the raw data, you can also design your own interface, instead of using/learning another like Direct Input.

Personally I wouldn't use Direct Input, it can be slow and implements an unneeded layer between the messages. Also it needs to be set up, and can be messy. For example, you have to check the keyboard hasn't been lost every frame, such as clicking on a different window, means the input needs to be acquired which is annoying.

Yeah

GetAsyncKeyState/GetCursorPos

is very simple to use, but it's limited.


#4871568 Poor performance

Posted by Daniel_RT on 11 October 2011 - 01:44 PM

Implement Frustum Culling to only render what the camera sees :)


#4870473 Learning Java: Where to start?

Posted by Daniel_RT on 08 October 2011 - 06:39 AM

I guess you could start with some simple tutorials just to get a feel for the syntax, even though it is similar to c++.
This is a good website to get your started:
http://www.freejavaguide.com/corejava.htm

If you haven't already, download netbeans. I don't know any others but netbeans is okay, can be annoying if you're use to visual studio though.


PARTNERS