vrshoot

annotate src/screen.cc @ 1:e7ca128b8713

looks nice :)
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 00:35:22 +0200
parents
children
rev   line source
nuclear@0 1 #include <vector>
nuclear@0 2 #include "opengl.h"
nuclear@0 3 #include "screen.h"
nuclear@0 4 #include "logger.h"
nuclear@0 5 #include "unistate.h"
nuclear@0 6
nuclear@0 7 static std::vector<Screen*> scrstack;
nuclear@0 8
nuclear@0 9 void push_screen(Screen *screen)
nuclear@0 10 {
nuclear@0 11 Screen *prev = current_screen();
nuclear@0 12 if(prev) {
nuclear@0 13 prev->stop();
nuclear@0 14 }
nuclear@0 15
nuclear@0 16 scrstack.push_back(screen);
nuclear@0 17 screen->start();
nuclear@0 18 }
nuclear@0 19
nuclear@0 20 Screen *pop_screen()
nuclear@0 21 {
nuclear@0 22 if(scrstack.empty()) {
nuclear@0 23 error_log("trying to pop a screen, but the stack is empty!\n");
nuclear@0 24 return 0;
nuclear@0 25 }
nuclear@0 26 Screen *res = scrstack.back();
nuclear@0 27 scrstack.pop_back();
nuclear@0 28
nuclear@0 29 res->stop();
nuclear@0 30
nuclear@0 31 Screen *next = current_screen();
nuclear@0 32 if(next) {
nuclear@0 33 next->start();
nuclear@0 34 }
nuclear@0 35 return res;
nuclear@0 36 }
nuclear@0 37
nuclear@0 38 Screen *current_screen()
nuclear@0 39 {
nuclear@0 40 if(scrstack.empty()) {
nuclear@0 41 return 0;
nuclear@0 42 }
nuclear@0 43 return scrstack.back();
nuclear@0 44 }
nuclear@0 45
nuclear@0 46 Screen *previous_screen()
nuclear@0 47 {
nuclear@0 48 int sz = scrstack.size();
nuclear@0 49 if(sz < 2) {
nuclear@0 50 return 0;
nuclear@0 51 }
nuclear@0 52 return scrstack[sz - 2];
nuclear@0 53 }
nuclear@0 54
nuclear@0 55 Screen::~Screen()
nuclear@0 56 {
nuclear@0 57 }
nuclear@0 58
nuclear@0 59 const char *Screen::get_name() const
nuclear@0 60 {
nuclear@0 61 return "Screen";
nuclear@0 62 }
nuclear@0 63
nuclear@0 64 bool Screen::init()
nuclear@0 65 {
nuclear@0 66 return true;
nuclear@0 67 }
nuclear@0 68
nuclear@0 69 void Screen::cleanup()
nuclear@0 70 {
nuclear@0 71 }
nuclear@0 72
nuclear@0 73 void Screen::start()
nuclear@0 74 {
nuclear@0 75 }
nuclear@0 76
nuclear@0 77 void Screen::stop()
nuclear@0 78 {
nuclear@0 79 }
nuclear@0 80
nuclear@0 81 long Screen::redisplay_interval() const
nuclear@0 82 {
nuclear@0 83 return 0; // don't redisplay implicitly by default
nuclear@0 84 }
nuclear@0 85
nuclear@0 86 void Screen::update(unsigned long tmsec)
nuclear@0 87 {
nuclear@0 88 }
nuclear@0 89
nuclear@0 90 void Screen::pre_draw() const
nuclear@0 91 {
nuclear@0 92 }
nuclear@0 93
nuclear@0 94 void Screen::display() const
nuclear@0 95 {
nuclear@0 96 }
nuclear@0 97
nuclear@0 98 void Screen::post_draw() const
nuclear@0 99 {
nuclear@0 100 }
nuclear@0 101
nuclear@0 102 void Screen::keyboard(int key, bool pressed)
nuclear@0 103 {
nuclear@0 104 }
nuclear@0 105
nuclear@0 106 void Screen::motion(int x, int y, bool pressed)
nuclear@0 107 {
nuclear@0 108 }
nuclear@0 109
nuclear@0 110 void Screen::button(int bn, bool pressed, int x, int y)
nuclear@0 111 {
nuclear@0 112 }
nuclear@0 113
nuclear@0 114 void Screen::reshape(int x, int y)
nuclear@0 115 {
nuclear@0 116 }