I am trying to make array of pannels, like here:
TImage* Board[BoardX][BoardY];
TImage* Tiles[TILES_MAX];
Here are variables that i have declared:
int BoardX = 25;
int TILES_MAX = 7;
int BoardY = 15;
When i try to compile this, i get the following compiler output:
[C++ Error] Game.cpp(14): E2313 Constant expression required
[C++ Error] Game.cpp(14): E2313 Constant expression required
[C++ Error] Game.cpp(15): E2313 Constant expression required
[C++ Error] Game.cpp(17): E2188 Expression syntax
[C++ Error] Game.cpp(24): E2141 Declaration syntax error
[C++ Error] Game.cpp(24): E2190 Unexpected }
[C++ Error] Game.cpp(24): E2190 Unexpected }
[C++ Error] Game.cpp(29): E2378 For statement missing ;
As you see, the tables doesnt want to compile. This is my whole code (currently unfinished):
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Game.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int BoardX = 25;
int TILES_MAX = 7;
int BoardY = 15;
TImage* Board[BoardX][BoardY];
TImage* Tiles[TILES_MAX];
char** tileNames = {
{"assets\stone.bmp"},
{"assets\Ethernite.bmp"},
{"assets\EtherniteBlock.bmp"},
{"assets\frozendirt.bmp"},
{"assets\grassground.bmp"},
{"assets\coalore.bmp"},
{"assets\filling.bmp"}
}
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
for(int i = 0; i < TILES_MAX; i++){
Tiles[i]->Picture->LoadFromFile(tileNames[i]);
}
}
//---------------------------------------------------------------------------
So how to make this work?
Aucun commentaire:
Enregistrer un commentaire