Alan Kemp

Member

713

772 Good

• Rank
GDNet+

• Interests
Programming
1. Jumping Physics

You don't need to multiply -300 by deltaT.asSeconds().  You want the jump velocity to be a constant (-300) and then use delta time to update it (as you are).   You are seeing the effect of slightly different frame times which is making the velocity start at different values.
2. SDL_Surface 0xC0000005: Access violation reading location 0x00000000.

SDL_Init returns a status code, 0 for success, or -1 for failure. You should check this before calling any other SDL functions.
3. [web] [PHP] rand with percentage

If you have a list of the percentage chance you want for each tile type you could pick a random percentage (from 0-100) and go along your chances array adding up the values until you got to the slot that represents the chance you randomly selected. Maybe something like this (my php is rusty, so the syntax might be off): $tile_chances = array( 50, 30, 20 );$tile_types = array( 1, 2, 3 ); $chosen_value = rand( 0, 100 );$current_percent = 0; for ( $i = 0;$i < 3; $i++ ) {$current_percent = $current_percent +$tile_chances[ $i ]; if ($current_percent >= $chosen_value ) { // use tile from$tile_types[ \$i ] } } Alan
4. Win32 EditBox

You can create a button the same way you created the text box (passing "BUTTON" as the classname). When the button is pressed you will recieve a BN_CLICKED message. Then send a message to the text box to retrieve the text the user entered.
5. [web] Free Flash authoring software?

Have you tried Flash Develop?
6. atoi & co

You could use strtol(..). It can return (via the second paramater) a pointer to where ever it stopped parsing. You can use that to check the entire input string was converted. Alan
7. can't make this work

const DWORD Vertex::FVF = D3DFVF_XYZ; Your FVF is just positions, no colour/texture coordinates/etc. What were you expecting it to draw? Try adding a color component to your vertex structure and adding D3DFVF_DIFFUSE to your FVF. struct Vertex { Vertex(){} Vertex(float x, float y, float z, DWORD color) { _x=x; _y=y; _z=z; _color=color; } float _x, _y, _z; DWORD _color; static const DWORD FVF; }; const DWORD Vertex::FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE; The format for the color is AARRGGBB (alpha, red, green, blue). Try 0xffffffff for white for now: vertices[0] = Vertex(-10.0f, 0.0f, 1.0f, 0xffffffff); vertices[1] = Vertex( 0.0f, 10.0f, 1.0f, 0xffffffff); vertices[2] = Vertex( 10.0f, 0.0f, 1.0f, 0xffffffff); Alan
8. Help with D3DXComputeTangent() please.

const DWORD* pCharBuffer( new DWORD[3 * pMesh->GetNumFaces()] ); Did you mean pMesh here? Or NewMesh? They probably give the same value anyway. Have you turned the DirectX debug info level up to max? That often outputs additional information from inside the D3DX functions when something goes wrong. You can do that from the DirectX control panel widget. If you don't see it in control panel, you can run it directly from ..Microsoft DirectX SDK (March 2009)\Utilities\bin\x86\dxcpl.exe. Turn debug level up to the max and make sure you are using the debug runtimes.
9. Getting Texture coordinates.

The phrase you need to search for is "barycentric coordinates".
10. Can someone tell me what I've done wrong?

Static member variables of classes need to be declared outside of the class (as well as the definition you already have in the class). Add this to your cpp file (after the include): imageMap ImageCache::_images; Alan
11. Games Libraries for the Web

You could try Unity3d.
12. Function calls work but declaration doesn't?? (C++ Class)

Dmdsq worldArray(8); The round brackets (instead of square []) are making this line be interpretted as a function definition, not an array definition. Alan

Are you sure you mean "anywhere on the computer"? This MSDN Article describes the way the OS searches for DLL's at load time. Presumably your "anywhere" location is one of those?
14. Ctrl+PrtScn doesn't work fullscreen mode? (C++ / OpenGL)

This is my understanding of the way this works: When you draw to a win32 window, you are actually drawing to an offscreen surface that windows then draws to the client area of your window. When you hit print-screen it dumps the offscreen surface to the clipboard. When you are in full screen mode, windows doesn't bother with the offscreen surface + copy, you have total control over the graphics device, the pixels go straight to the screen. When you hit print-screen it dumps the offscreen surface to the clipboard. And thats the problem. Your program never draws to the offscreen surface. Its relatively simple to write your own screenshot function for GL, this thread talks about it.
15. MSVC Weird Problem

Quote:i know for a fact my code is the exact same. Maybe your code is the same, what about the various project settings? 3rd party libraries? New versions of any SDK? When it crashes in debug, even if you didn't start it from VS, you should get an option to debug it if it detects you have VS installed. Alan