rayzor

annotate src/scrman.cc @ 14:a9a948809c6f

starting the renderer screen, plus misc stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 13 Apr 2014 08:06:21 +0300
parents
children
rev   line source
nuclear@9 1 #include <string.h>
nuclear@9 2 #include "vector.h"
nuclear@9 3 #include "scrman.h"
nuclear@9 4
nuclear@9 5 static vector<Screen*> screens;
nuclear@9 6 static vector<Screen*> active;
nuclear@9 7
nuclear@9 8 void add_screen(Screen *s)
nuclear@9 9 {
nuclear@9 10 screens.push_back(s);
nuclear@9 11 }
nuclear@9 12
nuclear@9 13 Screen *get_screen(const char *name)
nuclear@9 14 {
nuclear@9 15 for(size_t i=0; i<screens.size(); i++) {
nuclear@9 16 if(strcmp(screens[i]->get_name(), name) == 0) {
nuclear@9 17 return screens[i];
nuclear@9 18 }
nuclear@9 19 }
nuclear@9 20 return 0;
nuclear@9 21 }
nuclear@9 22
nuclear@9 23 void destroy_screens()
nuclear@9 24 {
nuclear@9 25 for(size_t i=0; i<screens.size(); i++) {
nuclear@9 26 screens[i]->shutdown();
nuclear@9 27 delete screens[i];
nuclear@9 28 }
nuclear@9 29 screens.clear();
nuclear@9 30 active.clear();
nuclear@9 31 }
nuclear@9 32
nuclear@9 33 void activate_screen(Screen *s)
nuclear@9 34 {
nuclear@9 35 active.push_back(s);
nuclear@9 36 }
nuclear@9 37
nuclear@9 38 Screen *deactivate_screen()
nuclear@9 39 {
nuclear@9 40 Screen *s = active_screen();
nuclear@9 41 if(!s) return 0;
nuclear@9 42
nuclear@9 43 active.pop_back();
nuclear@9 44 return s;
nuclear@9 45 }
nuclear@9 46
nuclear@9 47 Screen *active_screen()
nuclear@9 48 {
nuclear@9 49 return active.empty() ? 0 : active.back();
nuclear@9 50 }