Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 06 Jun 2003
Offline Last Active Jan 07 2013 03:00 PM

#4967059 how is stuff done correctly in the C++ World (headers, #include,namespaces)?

Posted by on 07 August 2012 - 10:48 AM

edited post because I mainly use pointers and then I realized it doesnt work on non-pointers.

this is the error you will get:

In file included from main.cpp:10:0:
Observer.h:16:10: error: field 'myMessage' has incomplete type

[source lang="cpp"]class Message;class Observer { Message myMessage; void accessMessage();}[/source]

so actually this gives no error:

[source lang="cpp"]class Message;class Observer { Message* myMessage; void accessMessage();}[/source]

this actually doesn't give an error message either:

[source lang="cpp"]class Message;class Observer { Message* myMessage; void accessMessage() { myMessage->someFunc(); }}[/source]

But trying to access Observer::accessMessage without including the Message header will give an error:

In file included from main.cpp:10:0:
Observer.h:17:49: error: invalid use of incomplete type 'class Message'
Observer.h:11:7: error: forward declaration of 'class Message'

[source lang="cpp"]#include "Observer.h"int main(int argc, char** argv) { Observer myObserver; myObserver.accessMessage(); // error return 0;}[/source]

To fix the error you will need to include the actual header of Message so it knows about the actual functions.

This is the way I usually set up my files:

[source lang="cpp"]// .h fileclass Message;class Observer { Message* myMessage; void accessMessage();}// .cpp file#include "observer.h"#include "message.h"void Observer::accessMessage() { myMessage->someFunc();}[/source]

And without pointers:

[source lang="cpp"]// .h fileclass Observer { Message myMessage; void accessMessage();}// .cpp file#include "message.h"#include "observer.h"void Observer::accessMessage() { myMessage.someFunc();}[/source]

#4965726 PHP 'include' a relative file?

Posted by on 02 August 2012 - 08:47 PM

I found this link which may be of some help


I think you need to put <?php header("Content-type: text/css; charset: UTF-8"); ?> in your .php file.

Found a couple more links:



#4964570 Need some help on Tic-Tac-Toe player turn

Posted by on 30 July 2012 - 12:20 PM

From what I can see it looks like your switching the colors based on the current player and not based on the player that did the selection.
This means that when it's player 1's turn everything (X's and O's) will draw blue and when it's player 2's turn everything will draw red.

You could try something like this:

struct Holder


	float xPos;

	float yPos;

	float width;

	float height;

	bool isVacant;

	bool isX;


// set color to draw

if (holders[n].isVacant == true) {

    glColor4ub(0,0,0,255); // black


else if (holders[n].isX) {

	glColor4ub(0,0,255,255); // blue


else {

	glColor4ub(255,0,0,255); // red


// draw rectangle

#4962342 Easy programming language

Posted by on 23 July 2012 - 01:54 PM

You may want to investigate Alice.


Alice is an innovative 3D programming environment that makes it easy to create an animation for telling a story, playing an interactive game, or a video to share on the web. Alice is a freely available teaching tool designed to be a student's first exposure to object-oriented programming. It allows students to learn fundamental programming concepts in the context of creating animated movies and simple video games. In Alice, 3-D objects (e.g., people, animals, and vehicles) populate a virtual world and students create a program to animate the objects.

In Alice's interactive interface, students drag and drop graphic tiles to create a program, where the instructions correspond to standard statements in a production oriented programming language, such as Java, C++, and C#. Alice allows students to immediately see how their animation programs run, enabling them to easily understand the relationship between the programming statements and the behavior of objects in their animation. By manipulating the objects in their virtual world, students gain experience with all the programming constructs typically taught in an introductory programming course.

#4959003 If you are going to sell your game on steam do you need to create a login for...

Posted by on 13 July 2012 - 11:35 PM

You use the Steam SDK: https://partner.steamgames.com/

Steamworks FAQ

1. How do I get access to Steamworks?
To get access to the Steamworks SDK, you still need to submit a demo of your game. All of our publicly available information is located here. If you have further questions you can contact steamworks@valvesoftware.com.

2. My game is in early development stages, don't I need to plan for the SDK integration now?
The Steamworks SDK is easy to integrate, so you can wait until your game is further along in the development cycle before worrying about it.

#4958119 Trouble Smoothly Moving Player Sprite

Posted by on 11 July 2012 - 12:24 PM

You could try separating the movement from the key listener:

[source lang="cpp"] // key event stuff addKeyListener(new KeyAdapter(){ public void keyPressed(KeyEvent ke){ if(ke.getKeyCode() == KeyEvent.VK_W){ bMoveUp = true; } if(ke.getKeyCode() == KeyEvent.VK_S){ bMoveDown = true; } if(ke.getKeyCode() == KeyEvent.VK_A){ bMoveLeft = true; } if(ke.getKeyCode() == KeyEvent.VK_D){ bMoveRight = true; } } public void keyReleased(KeyEvent ke){ if(ke.getKeyCode() == KeyEvent.VK_W){ bMoveUp = false; } if(ke.getKeyCode() == KeyEvent.VK_S){ bMoveDown = false; } if(ke.getKeyCode() == KeyEvent.VK_A){ bMoveLeft = false; } if(ke.getKeyCode() == KeyEvent.VK_D){ bMoveRight = false; } } public void keyTyped(KeyEvent ke){ } });[/source]

[source lang="cpp"] // check if player is moving and set direction if (bMoveUp) setYDir(-1);[color=#000000] else if (bMoveDown) setYDir(1);[/color][color=#000000] else setYDir(0);[/color][color=#000000][font=Consolas,] if (bMoveLeft) setXDir(-1);[/font][/color][color=#000000][font=Consolas,] else if (bMoveRight) setXDir(1);[/font][/color][color=#000000] else setXDir(0);[/color][/source]

#4955731 Efficient GUI rendering

Posted by on 04 July 2012 - 02:37 PM

Have you come across GWEN? Its a GUI system aimed at games.

It comes with renderers for GDI, Allegro, OpenGL, Direct2D, DirectX and SFML.

I've used it with SFML. I had to modify the SFML renderer slightly to suit my needs and because it's open source it was easy to do.

Heres the link:

From the website:


  • Coded in C++
  • Fully Namespaced
  • All standard window controls
  • Behaves like you'd expect
  • Lightweight
    • No XML readers, no font loaders/renderers, no texture loaders - your engine should be doing all this stuff!
  • Easy to integrate (comes with renderers for Windows GDI, Allegro, OpenGL, Direct2D, DirectX and SFML)
  • Totally portable & cross platform
  • Doesn't need RTTI
Released under a "do whatever you want" MIT license.

#4955143 Should I learn .NET for making design tools?

Posted by on 02 July 2012 - 08:26 PM

You could use C++/CLI and Visual Studio Express.

Visual Studio has a Windows Form editor so you can drag and drop and visually create the window itself and then just program the underlying functionality in C++.

From my experience C++/CLI is basically C++ except it runs on .NET and includes a garbage collector.

Normally you would do this:
MyClass* myClass = new MyClass();
delete myClass;

In C++/CLI you would do this:
MyClass^ myClass = gcnew MyClass();
// no delete since GC cleans it up for you

Alternatively you could look into Qt SDK and the Qt Creator.

The Qt Creator allows you to visually drag and drop and create the window just like in Visual Studio and then you just program it in normal C++.

#4954670 Can't type "}" in Visual C++ 2010

Posted by on 01 July 2012 - 04:37 PM

I did a quick Google search and came up with this:


maybe it will help.

#4951573 Talk to me about java in gaming

Posted by on 21 June 2012 - 07:52 PM

I just came across a posting for a Sr. Java Engineer at Nintendo.

Nintendo of America Inc.
Job Posting:Jun 4, 2012
Engineer, Software or Engineer, Software, Sr (Java Application Development) (1200000028)
  • Software development and support using Java toolsets.
  • Knowledge of application server development and frameworks such as Spring, Struts, iBatis, and Hibernate
  • Experience with web service development using JAX-WS and JAX-RS is a plus
  • Ability to write and understand complex SQL; Oracle PL/SQL experience is a plus

Also not sure if you've seen it but there is a Java game engine:

jMonkeyEngine 3.0 | Java OpenGL Game Engine