Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 14 May 2012
Offline Last Active May 22 2014 06:19 PM

#4998708 Returning multiple values from function C++

Posted by on 07 November 2012 - 08:33 PM

You are probably passing the render window to a function as a copy instead of reference. Render Window inherits NonCopyable so you can't do that.

#4997707 Using sfml2.0 to input a name

Posted by on 05 November 2012 - 02:17 PM

I was actually just working on getting a user's name today. Here is a snippet of the code I used:

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 );
// ... more cases

#4993672 Create a Game Engine

Posted by on 24 October 2012 - 10:30 PM

I'm no expert on game engine programming but I can tell you that your question is way too vague for a topic way too large. If you want good answers you need to ask specific questions. Be specific on what you are confused with.

#4988693 SDL pisses me off

Posted by on 10 October 2012 - 06:34 AM

Also try using
"int main(int argc, char *argv[])" instead of "int main()"... VC was giving me linking errors when using just main()

@OP: I got the same error a few weeks ago and the quoted response solved the problem. You need the arguments to main for SDL to work correctly

#4988688 I'd like to make a C++ game

Posted by on 10 October 2012 - 06:10 AM

Hello people of GameDev.net (This is my first forum thread)

So I'm fairly new to C++ and I've made basic things and I'm working on a Text Adventure right now but once I do make a game, I've hit one bump in the road.
When I code something in C++, it runs it in what looks like Command Prompt.
I'd assume it's because C++ won't come with anything super-fancy and I guess I'm fine with it but my real question is:
How do you turn your C++ .exe file look like a regular old program/game on Windows?
I believe it has something to do with .txt files and collecting files from your computer, but I just need to know HOW to do it.

Thanks in Advance.

Regards, King of the Boneheads.

King of the Boneheads:
When you use a standard library function such as
, your program will output the results to the default standard output which is a console window. If you want to output the results of your program to your own graphical window ( commonly referred to as a gui (pronounced "gooey") ), you need to create one. One option is to use the Win32 API, but it is not that beginner-friendly. What you might want to do is check out some of the great GUI libraries available, such as the ones mentioned above.

#4987392 Basic Requirements

Posted by on 06 October 2012 - 08:07 AM

Lots of time, manpower. programming and art skills, and patience.

#4977919 Need application to graphically plot 2D paths

Posted by on 08 September 2012 - 01:00 AM

I personally don't know any applications that let you do that but I'm sure other folks will provide links to programs that do it for you.
However, it's quite easy to programmatically plot a curve and use interpolation to gather points along the curve. For example, here is a function I use that interpolates a cubic bezier curve:

Vec2 cubicBezierInterpolate(Vec2 P0, Vec2 P1, Vec2 P2, Vec2 P3, float t)
	  float u = 1.0f - t;
	  float tt = t * t;
	  float uu = u * u;
	  float uuu = uu * u;
	  float ttt = tt * t;
	  Vec2 p = P0 * uuu;				 // first term
	  p = p + (P1 * 3.0f * uu * t);	  // second term
	  p = p + (P2 * 3.0f * u * tt);	   // third term
	  p = p + (P3 * ttt);					// fourth term
	  return p;

This function requires that you provide four control points for the curve and an interpolation value between 0 and 1.

If you just want to plot a circle or a simple curve, I recommend you check out this great article on cos and sin: http://www.helixsoft.nl/articles/circle/sincos.htm