What about using the best of both worlds?
int doSomething(int x)
{ int y;
// ... do complex operation
return y;
}
Not Telling
kidman171 hasn't added any contacts yet.
Posted by kidman171
on 16 April 2013 - 05:49 AM
What about using the best of both worlds?
int doSomething(int x)
{ int y;
// ... do complex operation
return y;
}
Posted by kidman171
on 20 March 2013 - 06:27 PM
Posted by kidman171
on 13 February 2013 - 06:52 PM
Posted by kidman171
on 11 February 2013 - 03:33 AM
Try compiling glew with mingw using the makefile that comes with the source. You will need to compile it through MSYS because the makefile is not windows-compliant. Then link to your newly compiled library and that should fix things.
Posted by kidman171
on 31 January 2013 - 10:40 PM
What you should do is keep track of when the key gets pressed and when it gets released. You could have a simple array of bools, one for each key. When you get an SDL_Keydown event, switch the key in your bool array to true. When you get an SDL_Keyup event, switch the key in your bool array to false. Then in your update loop, you can just check your bool array to see if x is pressed and move your sprite accordingly.
Posted by kidman171
on 29 January 2013 - 03:42 PM
Thanks swiftcoder, that solved the problem! I changed the origin to the cameras position and direction to normalize(nearPlane - cameraPosition) and it works like a charm!
Posted by kidman171
on 27 January 2013 - 04:06 PM
Note that opengl32.lib only supports up to opengl 1.1. If you want to use any newer functionality, you need to get that functionality from the graphics card drivers. Your best option is to use a library like glew(http://glew.sourceforge.net/) to load that functionality for you.
Posted by kidman171
on 04 January 2013 - 05:43 PM
vector<vector<string>> room[10];
This code would create an array of 10 vectors of vectors of strings.
I think you want this:
vector<vector<string>> room(10);
This would create an vector of vectors of strings, instantiated with 10 elements.
Posted by kidman171
on 02 January 2013 - 07:08 PM
Posted by kidman171
on 25 December 2012 - 08:29 AM
I wrote a step by step tutorial just for you, I hope it helps.
sfml_codeblocks_setup.pdf 577.71K
47 downloads
Posted by kidman171
on 24 December 2012 - 08:14 AM
Hello, congrats on finishing your first game!
Here are a few things I noticed about your game:
1) The paddle speed is way too slow. If the ball goes on the other half of the screen, I have no chance to save it.
2) The ball start's in the center and goes in a random direction very quickly, sometimes scoring against the AI or myself 3 or 4 times in succession.
Increasing the paddle speed may give a chance to save the ball in this scenario.
3) There are a few things that might make your code cleaner, for example:
</p><div>if ai_pad.points == 11 or my_pad.points == 11:</div> <div>if ai_pad.points == 11:</div> <div>game.winner = "AI"</div> <div>else:</div> <div>game.winner = "Player"</div> <div>game.game_over = 1</div> <div>game.pause = 1if ai_pad.points == 11 or my_pad.points == 11:</div> <div>if ai_pad.points == 11:</div> <div>game.winner = "AI"</div> <div>else:</div> <div>game.winner = "Player"</div> <div>game.game_over = 1</div> <div>game.pause = 1</div> <div>
Posted by kidman171
on 27 November 2012 - 07:21 AM
Posted by kidman171
on 13 November 2012 - 05:24 AM
Posted by kidman171
on 07 November 2012 - 08:33 PM
Posted by kidman171
on 05 November 2012 - 02:17 PM
while( window.pollEvent(event) )
{
switch( event.type )
{
case sf::Event::TextEntered:
if( event.text.unicode < 128 )
{
std::string name = playerName.getString();
if( event.text.unicode == 13 ) // return key
{
// finished entering name
} else if( event.text.unicode == 8 ) { // backspace
if( name.size() > 0 ) name.resize( name.size() - 1 );
} else {
name += static_cast<char>(event.text.unicode);
}
playerName.setString( name );
}
break;
// ... more cases
}
}
Find content