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