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

Posts I've Made

In Topic: stack comprehension question

14 August 2012 - 03:35 PM

Found a link which may have some additional information:


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

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]

In Topic: PHP 'include' a relative file?

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:



In Topic: Need some help on Tic-Tac-Toe player turn

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

In Topic: Detecting mouse in box? In Blitz Plus.

30 July 2012 - 11:44 AM

Here is a way that I use to find where the mouse is located in the grid:

Vector2f getGridLoc(int tileSize)
Vector2f gridLoc;
gridLoc.x = std::floor(mouse.x / tileSize);
gridLoc.y = std::floor(mouse.y / tileSize);
return gridLoc;