When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
4 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
i image i can add something like this:
pieces.h:
TetrisPieces TetrisPiecesByIndex[7];
pieces.cpp:
TetrisPiecesByIndex = {
Pieces.I,
Pieces.O
......
};
but it says:
A type specifier is required for all declarations
ok, so this is the data structure i came up with
(i should not be allowed to code)
pieces.h:
extern struct TetrisPieces {
int I[3][2];
int O[3][2];
int S[3][2];
int Z[3][2];
int L[3][2];
int J[3][2];
int T[3][2];
} Pieces;
extern int PieceArrayList[7][3][2];
pieces.cpp:
#include "pieces.h"
int PieceArrayList[7][3][2] = {
{{0, -1}, {0, 1}, {0, 2}},
{{-1, -1}, {0, -1}, {-1, 0}},
{{1, 0}, {0, 1}, {-1, 1}},
{{-1, 0}, {0, -1}, {1, 1}},
{{0, -1}, {0, 1}, {1, 1}},
{{0, -1}, {0, 1}, {-1, -1}},
{{-1, 0}, {1, 0}, {0, -1}},
};
TetrisPieces Pieces {
**PieceArrayList[0],
**PieceArrayList[1],
**PieceArrayList[2],
**PieceArrayList[3],
**PieceArrayList[4],
**PieceArrayList[5],
**PieceArrayList[6],
};
this allows me to access pieces via index, meaning i can iterate though them, while also i can access data via struct variables / fields, like this Pieces.I
whatever, this works for me, i consider my question solved. if anyone have comments about this feel free to do so