summaryrefslogtreecommitdiff
path: root/Dalos
diff options
context:
space:
mode:
Diffstat (limited to 'Dalos')
-rw-r--r--Dalos/Dalos.cc115
1 files changed, 115 insertions, 0 deletions
diff --git a/Dalos/Dalos.cc b/Dalos/Dalos.cc
new file mode 100644
index 0000000..c9d8763
--- /dev/null
+++ b/Dalos/Dalos.cc
@@ -0,0 +1,115 @@
+#include <SDL.h>
+#include <Main.h>
+
+#include <engine.h>
+#include <glbase.h>
+#include <glshape.h>
+
+mogltk::widgets::Root * Root;
+mogltk::widgets::Frame * Frame;
+mogltk::widgets::Menu * MainMenu;
+
+CODE_BEGINS
+
+class frame : public mogltk::widget {
+ public:
+ frame(mogltk::shape * sh, mogltk::widget * father) :
+ widget(father, 2, 2, father->GetW() - 4, father->GetH() - 4, 0, "MyFrame", sh) { }
+ protected:
+ virtual void draw() {
+ }
+ virtual bool process_event(int mx, int my, mogltk::event_t event) {
+ return false;
+ }
+};
+
+class timer : public mogltk::widget {
+ public:
+ timer() :
+ widget(Root, 0, 0, 0, 0, 0, "Timer", 0), tick(0)
+ { set_timed_event(100); }
+ protected:
+ virtual bool process_event(int, int, mogltk::event_t event) {
+ if (event == mogltk::E_TIMER) {
+ set_timed_event(100);
+ tick = (tick + 1) % 4;
+ switch (tick) {
+ case 0:
+ MainMenu->SetCaption(0, "/");
+ break;
+ case 1:
+ MainMenu->SetCaption(0, "-");
+ break;
+ case 2:
+ MainMenu->SetCaption(0, "\\");
+ break;
+ case 3:
+ MainMenu->SetCaption(0, "I");
+ break;
+ }
+ return true;
+ }
+ return false;
+ }
+ private:
+ int tick;
+};
+
+class quit : public mogltk::widgets::action {
+ public:
+ virtual void do_action(mogltk::widget * w) {
+ mogltk::engine::quit();
+ }
+} action_quit;
+
+class about : public mogltk::widgets::action {
+ public:
+ virtual void do_action(mogltk::widget * w) {
+ new mogltk::widgets::MsgBox(w->Shaper(), w->Father(), "About...",
+ "Dalos version 0.1 - OpenGL version\n"
+ "Copyright (C) 2004 Nicolas \"Pixel\" Noble\n"
+ "\n"
+ "Thanks and greetings fly to (no particular order)\n"
+ "GreatSkaori, Orphis, Ti Dragon, Yaz0r, S-O-R,\n"
+ "Meradrin, SkeuD, Moogle, InVerse, LavosSpawn\n"
+ "\n"
+ "And to all I forgot!\n"
+ );
+ }
+} about_dialog;
+
+virtual int startup() throw (GeneralException) {
+ mogltk::widgets::ContextMenu * c;
+ mogltk::base * gl = new mogltk::glbase();
+ mogltk::shape * sh = new mogltk::glshape();
+
+ mogltk::engine::setcursorvisible(true);
+ mogltk::engine::setappactive(true);
+
+ Root = new mogltk::widgets::Root(sh);
+ MainMenu = new mogltk::widgets::Menu(sh, Root);
+ Frame = new mogltk::widgets::Frame(sh, Root, 0, MainMenu->GetH(), Root->GetW() - 1, Root->GetH() - MainMenu->GetH() - 1);
+ new frame(sh, Frame);
+
+ MainMenu->addnode("/", 0);
+
+ c = MainMenu->createsub("File");
+ c->addnode("Load", 0);
+ c->addnode("Save", 0);
+ c->addline();
+ c->addnode("Quit", &action_quit);
+
+ c = MainMenu->createsub("Execution");
+ c->addnode("Run", 0);
+
+ c = MainMenu->createsub("Help");
+ c->addnode("About", &about_dialog);
+
+ new timer();
+
+ Root->mainloop();
+
+ return 0;
+}
+
+CODE_ENDS