# Aerodactyl55

Member

74

153 Neutral

• Rank
Member

• Interests
Audio
Programming

• Steam
tomberry64
1. ## C++ Bit manipulation returning wrong data

It's not clear how you get mouse input, but if you use the windows mouse messages (WM_MOUSEMOVE, etc) then the values received there are (signed) 16bit as Mk_ stated. If bit manipulation is giving you trouble, then you can use unions as an alternative.
2. ## C++ Bit manipulation returning wrong data

I believe "long int" is still 32bits in Windows. Try using "long long" or (u)int64_t
3. ## C++ Writing char arrays (binary)

I made a mistake, it should have been char* not myType*. I don't see a structure in your post but usually a vector struct is a POD. You can read the vector array in a single call as well. Krohm already posted the problems you may face.
4. ## C++ Writing char arrays (binary)

I believe, for a POD struct, you can just call write( (myType*)myArray, sizeof (myType) * SizeOfArray(myArray)). You can read the data back in a similar way.
5. ## Precision Problems with bouding sphere

I think you need to compute the amount of intersection between the spheres and use that to push either one sphere or both of them away from each other so they stop intersecting.
6. ## Resources to get good at math?

A matrix is not the only way to solve it, you can solve for one variable and then solve for the other like this: h = 24/w ; h = 10 -w 24/w = 10 - w; -> 24 = 10w - w^2; w^2 -10w + 24 = 0; Then solving this quadratic equation we get: w = 6 or w = 4; then: h = 4 or h = 6; I skipped some steps for the sake of brevity. Now to solve it using a matrix would probably involve using Cramer's Rule.
7. ## 3D IDirect3DSurface9 flickers seriously

Where are all these functions that you mention? If you show your code, there is a good chance someone will be able to help you.
8. ## tic-tac-toe review request

You say the AI is primitive but it is impossible to beat. Is that intentional? Maybe you can add a small chance for the AI to make a mistake, as an 'improvement'.
9. ## DX11 Member function as callback

As far as I know there is no way to assign a member function to lpfnWndProc. The author of the book assigned a proxy function to lpfnWndProc, and that function calls the member function MsgProc. Static member functions, as you said, can't be virtual but you can design it so that it calls virtual member functions for each message type (OnCreate, OnPaint, OnDestroy, etc).
10. ## Help with Missile Command

If it's not related to the current topic then it may be better to open a new topic.
11. ## Polyominoes

Hello everyone, I decided to share a game I just completed to get some feedback. The game is Polyominoes, and you can find the files attached. The objective is to pack the pieces (polyominoes) inside a rectangle. Controls: Left Mouse Button: Pick (and then drag with the mouse); Right Mouse Button: Remove polyominoes from the rectangle; <Q>, <E> Keys: Rotate the picked polyomino; <W> Key: Mirror the picked polyomino; Enjoy! Polyominoes.7z
12. ## Help with Missile Command

The sign of the z-component (for 2D games) of that perpendicular vector will tell you the direction (left/right) to rotate.
13. ## Help with Missile Command

I believe you need two vectors for this type of targeting system: The first, from the center of your cannon to the mouse hotspot position; and the second is the current orientation of the cannon. Then you can use the dot product to find the angle between these two vectors and then use the cross product to find the direction to rotate.
14. ## IDXGIFactory::MakeWindowAssociation has no effect

I believe you are looking for the DXGI_MWA_NO_ALT_ENTER flag.
15. ## DirectX 9 Sprite Wont Display? See Code...

ID3DXSprite::Begin()/ID3DXSprite::Draw()/ID3DXSprite::End must be called inside a IDirect3DDevice9::Begin()/IDirect3DDevice9::End() Block.