About Store Forum Documentation Contact



Post Reply 
Problem in Code Editor with Parens
Author Message
runewake2 Offline
Member

Post: #1
Problem in Code Editor with Parens
I am rewriting my old TicTacToe program to be a little nicer (hopefully releasing it as a tutorial eventually). I came across this error when making it:

My original code looks something like this. Note that I seperated some of my math up in the Rect() command to make it easier to understand.

PHP Code:
Button button[3][3];

/******************************************************************************/
void InitPre()
{
   
DataPath("../../../../Data");
   
Paks.add("engine.pak");
   
App.name("Tic Tac Toe - Esenthel"); // App Name
   
D.mode(800600false); // 800x600 Window
}
bool Init()
{
   for(
int xx<3x++)
      for(
int yy<3y++)
         
button[x][y].create(Rect((-0.75)+(.5*x),(-0.75)+(.5*y), 0.50.5), S+(x*y));
   return 
true;
}
void Shut()
{
}
/******************************************************************************/
bool Update()
{
   if(
Kb.bp(KB_ESC))return false;
   return 
true;
}
void Draw()
{
   
D.clear(TURQ);
   
Gui.draw();
}
/******************************************************************************/ 

This is what The Code Editor interpreted it as. Notice the added "::" around the Parens. Is this something you can't do in C++? Or is this just a problem with the Code Editor?

PHP Code:
/******************************************************************************/
#include "stdafx.h"
#include "$$headers.h"
/******************************************************************************/
Button button[3][3];

/******************************************************************************/
void InitPre()
{
   
DataPath(L"../../../../Data");
   
Paks.add(L"engine.pak");
   
App.name(L"Tic Tac Toe - Esenthel"); // App Name
   
D.mode(800600false); // 800x600 Window
}
bool Init()
{
   for(
int xx<3x++)
      for(
int yy<3y++)
         
button[x,y].create(Rect((-0.75)+(::5*x),(-0.75)+(::5*y), 0.50.5), S+(x*y));
   return 
true;
}
void Shut()
{
}
/******************************************************************************/
bool Update()
{
   if(
Kb.bp(KB_ESC))return false;
   return 
true;
}
void Draw()
{
   
D.clear(TURQ);
   
D.text (0,0,L"Welcome to new generation of programming!");
   
Gui.draw();
}
/******************************************************************************/
// CLASS STATIC MEMBERS
/******************************************************************************/
// CLASS METHODS
/******************************************************************************/ 

EDIT: I've gone back in time and tried Chris' old Tic Tac Toe game. It has the same problems. Is their something wrong with multidimensional arrays with the code editor?
(This post was last modified: 08-09-2011 04:52 AM by runewake2.)
08-09-2011 04:33 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: Problem in Code Editor with Parens
0.5

Code Editor allows you to use . instead of :: for namespaces, which is why it's placing a :: instead.
08-09-2011 07:05 AM
Find all posts by this user Quote this message in a reply
runewake2 Offline
Member

Post: #3
RE: Problem in Code Editor with Parens
Ah, that makes sense. I'll try not to forget that in the future.

It would be nice if it could tell what you meant though.
(This post was last modified: 08-09-2011 07:13 AM by runewake2.)
08-09-2011 07:13 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #4
RE: Problem in Code Editor with Parens
Yeah, Esenthel should be able to fix this relatively easily I would imagine.
08-09-2011 07:20 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Problem in Code Editor with Parens
thanks, I'll fix this
08-09-2011 11:19 AM
Find all posts by this user Quote this message in a reply
Post Reply