Select Git revision
main.cpp 1.62 KiB
#include "graphics.hpp"
#include "application.hpp"
#include "widget.hpp"
#include "field.hpp"
#include "gamemaster.hpp"
#include <vector>
#define sorszam_i 9*j+i
using namespace std;
class MyApp : public Application
{
public:
MyApp(int szel, int mag) : Application(szel,mag)
{
game = new GameMaster(this,"megoldas.txt","feladat.txt");
vector<int> game_feladat = game->get_feladat();
vector<int> game_save = game->get_save();
for (int j=0; j<9; j++) // sor
{
for (int i=0; i<9; i++) // oszlop
{
Field *f = new Field(this,i*78,j*78,78,sorszam_i,game_feladat[sorszam_i]);
palya.push_back(f);
if (game_feladat[sorszam_i] == 0)
{
palya[sorszam_i]->set_ertek(game_save[sorszam_i]);
}
}
}
}
void action(std::string id, int sorszam, int ertek) override
{
if (id=="ertek")
{
palya[sorszam]->set_ertek(ertek);
game->save(sorszam,ertek);
}
if (id=="aura")
{
if (ertek==1)
palya[sorszam]->set_aura_true();
else if (ertek==0)
palya[sorszam]->set_aura_false();
}
}
protected:
vector<Field*> palya;
GameMaster* game;
};
int main()
{
MyApp sudoku(702,702);
sudoku.event_loop();
return 0;
}