Sha256: 8ae21ca36cec6d7af9589eabf85eb98552af76c8bb44bbc3da44981c9dcb4a2b
Contents?: true
Size: 1.96 KB
Versions: 4
Compression:
Stored size: 1.96 KB
Contents
#include "game_board.h" #include <FL/Fl.H> #include <FL/Fl_Box.H> #include <FL/Fl_Double_Window.H> #include <FL/Fl_Input.H> #include <FL/Fl_Int_Input.H> class PositiveIntInput : public Fl_Int_Input { public: PositiveIntInput(int X, int Y, int W, int H, const char *L = 0) : Fl_Int_Input(X, Y, W, H, L) {} int handle(int event) override { int result = Fl_Int_Input::handle(event); if (event == FL_KEYDOWN || event == FL_KEYUP || event == FL_PASTE) { const char *value = this->value(); if (value[0] == '-') { this->value(""); } } return result; } }; int main(int argc, char **argv) { Fl_Double_Window *window = new Fl_Double_Window(800, 600, "Khet AI"); GameBoard *board = new GameBoard(50, 50, 700, 504); std::vector<std::vector<std::string>> init_board = { {"L2", "--", "--", "--", "A2", "X2", "A2", "P1", "--", "--"}, {"--", "--", "P2", "--", "--", "--", "--", "--", "--", "--"}, {"--", "--", "--", "p3", "--", "--", "--", "--", "--", "--"}, {"P0", "--", "p2", "--", "S2", "S3", "--", "P1", "--", "p3"}, {"P1", "--", "p3", "--", "s1", "s0", "--", "P0", "--", "p2"}, {"--", "--", "--", "--", "--", "--", "P1", "--", "--", "--"}, {"--", "--", "--", "--", "--", "--", "--", "p0", "--", "--"}, {"--", "--", "p3", "a0", "x0", "a0", "--", "--", "--", "l0"}}; board->init(init_board); Fl_Box *max_time_label = new Fl_Box(50, 10, 80, 30, "Max Time:"); PositiveIntInput *max_time_input = new PositiveIntInput(125, 15, 30, 20); max_time_input->value("5"); board->max_time_input = max_time_input; Fl_Box *max_depth_label = new Fl_Box(250, 10, 80, 30, "Max Depth:"); PositiveIntInput *max_depth_input = new PositiveIntInput(325, 15, 30, 20); max_depth_input->value("25"); board->max_depth_input = max_depth_input; window->end(); window->show(argc, argv); return Fl::run(); }
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
khetai-0.3.4 | ext/khetai/dev/fltk-ui/khet.cpp |
khetai-0.3.3 | ext/khetai/dev/fltk-ui/khet.cpp |
khetai-0.3.2 | ext/khetai/dev/fltk-ui/khet.cpp |
khetai-0.3.0 | ext/khetai/dev/fltk-ui/khet.cpp |