Mondschein Engine  0.3.0
engine.cpp
1 /* Mondschein Engine is a fast, powerful, and easy-to-use 3D realtime rendering engine.
2  *
3  * Copyright (C) 2009-2013 by Andreas Amereller
4  * E-Mail: andreas.amereller.dev@googlemail.com
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation; either version 3 of the License, or (at your option)
9  * any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #include "types.h"
22 #include "core/context.h"
23 #include "core/visual.h"
24 
25 using namespace mondschein;
26 
27 Engine::Engine() {}
28 Engine::~Engine() {}
29 boost::weak_ptr<display::Visual> Engine::current_visual;
30 boost::weak_ptr<renderer::Context> Engine::current_context;
31 
32 void Engine::init(display::Visual_p _v)
33 {
34  current_visual=_v;
35  return;
36 }
37 
38 void Engine::init(renderer::Context_p _c)
39 {
40  current_context=_c;
41  return;
42 }
43 
44 void Engine::make_current(display::Visual_p _v,renderer::Context_p _c)
45 {
46  _v->make_current();
47  current_visual=_v;
48  _c->make_current();
49  current_context=_c;
50  return;
51 }
52 
53 bool Engine::is_current(display::Visual_p _v)
54 {
55  if (current_visual.lock().get() == _v.get()) return true;
56  return false;
57 }
58 
59 bool Engine::is_current(renderer::Context_p _c)
60 {
61  if (current_context.lock().get() == _c.get()) return true;
62  return false;
63 }