Skip to content
Snippets Groups Projects
Commit 0700a976 authored by Bolla Péter's avatar Bolla Péter
Browse files

Correction in myapp constructor

parent c6c7d2ea
No related branches found
No related tags found
No related merge requests found
......@@ -2,10 +2,11 @@
#include "chess.hpp"
#include "button.hpp"
#include<iostream>
using namespace std;
using namespace genv;
const int WID = 800, HEIG = 800, F_SIZE = HEIG/8;
const int WID = 600, HEIG = 600, F_SIZE = HEIG/8;
class MyApp: public App
{
......@@ -13,19 +14,57 @@ public:
MyApp(int width, int height):
App(width, height)
{
for(int i = 0; chessboard->GetTable().size(); i++)
chessboard = new Chess();
cout<<endl;
for(int i = 0; i<chessboard->GetTable().size(); i++)
{
cout<<i<<". Button\n";
Button* b = new Button(this,
i%8*F_SIZE, HEIG-i/8*F_SIZE,
i%8*F_SIZE, HEIG-(i/8+1)*F_SIZE,
F_SIZE, F_SIZE,
[](){},
chessboard->GetSquare(i));
Field.push_back(b);
/*switch(chessboard->GetPiece(i).type)
{
case Pawn:
{
cout<<'p';
break;
}
case Rook:
{
cout<<'r';
break;
}
case Knight:
{
cout<<'n';
break;
}
case Bishop:
{
cout<<'b';
}
case King:
{
cout<<'k';
}
case Queen:
{
cout<<'q';
}
case Empty:
{
cout<<'*';
break;
}
}
if(i%8 == 7) cout<<endl;*/
}
}
protected:
Chess *chessboard;
vector<Button*> Field;
......@@ -36,7 +75,7 @@ protected:
int main()
{
MyApp myapp(WID, HEIG);
cout<<"second step\n";
myapp.event_loop();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment