1 /***************************************************************************
2  *   Copyright (C) 2005-2019 by the FIFE team                              *
3  *   http://www.fifengine.net                                              *
4  *   This file is part of FIFE.                                            *
5  *                                                                         *
6  *   FIFE is free software; you can redistribute it and/or                 *
7  *   modify it under the terms of the GNU Lesser General Public            *
8  *   License as published by the Free Software Foundation; either          *
9  *   version 2.1 of the License, or (at your option) any later version.    *
10  *                                                                         *
11  *   This library is distributed in the hope that it will be useful,       *
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
14  *   Lesser General Public License for more details.                       *
15  *                                                                         *
16  *   You should have received a copy of the GNU Lesser General Public      *
17  *   License along with this library; if not, write to the                 *
18  *   Free Software Foundation, Inc.,                                       *
19  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
20  ***************************************************************************/
21 %module fife
22 %{
23 #include "controller/engine.h"
24 %}
25 
26 
27 namespace FIFE {
28 
29 	class SoundManager;
30 	class EventManager;
31 	class TimeManager;
32 	class IGUIManager;
33 	class RenderBackend;
34 	class Model;
35 	class LogManager;
36 	class GuiFont;
37 	class VFS;
38 	class Cursor;
39 	class RendererBase;
40 	class DeviceCaps;
41 	class ScreenMode;
42 	class Image;
43 	class ImageManager;
44 	class AnimationManager;
45 	class SoundClipManager;
46 	class OffRenderer;
47 	class TargetRenderer;
48 
49 	class EngineSettings {
50 	public:
51 		~EngineSettings();
52 		void setBitsPerPixel(uint8_t bitsperpixel);
53 		uint8_t getBitsPerPixel() const;
54 		std::vector<uint8_t> getPossibleBitsPerPixel() const;
55 		void setFullScreen(bool fullscreen);
56 		bool isFullScreen() const;
57 		void setRefreshRate(uint16_t rate);
58 		uint16_t getRefreshRate() const;
59 		void setDisplay(uint8_t display);
60 		uint8_t getDisplay() const;
61 		void setVSync(bool vsync);
62 		bool isVSync() const;
63 		void setSDLDriver(const std::string& driver);
64 		const std::string& getSDLDriver() const;
65 		void setInitialVolume(float volume);
66 		float getInitialVolume() const;
67 		float getMaxVolume() const;
68 		void setRenderBackend(const std::string& renderbackend);
69 		const std::string& getRenderBackend() const;
70 		std::vector<std::string> getPossibleRenderBackends();
71 		void setSDLRemoveFakeAlpha(bool sdlremovefakealpha);
72 		bool isSDLRemoveFakeAlpha() const;
73 		void setGLCompressImages(bool oglcompressimages);
74 		bool isGLCompressImages() const;
75 		void setGLUseFramebuffer(bool ogluseframebuffer);
76 		bool isGLUseFramebuffer() const;
77 		void setGLUseNPOT(bool oglusenpot);
78 		bool isGLUseNPOT() const;
79 		void setGLTextureFiltering(FIFE::TextureFiltering filter);
80 		FIFE::TextureFiltering getGLTextureFiltering() const;
81 		void setGLUseMipmapping(bool mipmapping);
82 		bool isGLUseMipmapping() const;
83 		void setGLUseMonochrome(bool monochrome);
84 		bool isGLUseMonochrome() const;
85 		void setGLUseDepthBuffer(bool buffer);
86 		bool isGLUseDepthBuffer() const;
87 		void setGLAlphaTestValue(float alpha);
88 		float getGLAlphaTestValue() const;
89 		void setScreenWidth(uint16_t screenwidth);
90 		uint16_t getScreenWidth() const;
91 		void setScreenHeight(uint16_t screenheight);
92 		uint16_t getScreenHeight() const;
93 		void setDefaultFontPath(const std::string& defaultfontpath);
94 		const std::string& getDefaultFontPath() const;
95 		void setDefaultFontSize(uint16_t defaultfontsize);
96 		uint16_t getDefaultFontSize() const;
97 		void setDefaultFontGlyphs(const std::string& defaultfontglyphs);
98 		const std::string& getDefaultFontGlyphs() const;
99 		void setWindowTitle(const std::string& title);
100 		const std::string& getWindowTitle() const;
101 		void setWindowIcon(const std::string& icon);
102 		const std::string& getWindowIcon() const;
103 		void setColorKeyEnabled(bool colorkeyenable);
104 		bool isColorKeyEnabled() const;
105 		void setColorKey(uint8_t r, uint8_t g, uint8_t b);
106 		const SDL_Color& getColorKey() const;
107 		void setVideoDriver(const std::string& driver);
108 		const std::string& getVideoDriver() const;
109 		void setLightingModel(uint32_t lighting);
110 		uint32_t getLightingModel() const;
111 		void setFrameLimitEnabled(bool limited);
112 		bool isFrameLimitEnabled() const;
113 		void setFrameLimit(uint16_t framelimit);
114 		uint16_t getFrameLimit() const;
115 		void setMouseSensitivity(float sens);
116 		float getMouseSensitivity() const;
117 		void setMouseAccelerationEnabled(bool acceleration);
118 		bool isMouseAccelerationEnabled() const;
119 		void setNativeImageCursorEnabled(bool nativeimagecursor);
120 		bool isNativeImageCursorEnabled() const;
121 		void setJoystickSupport(bool support);
122 		bool isJoystickSupport() const;
123 
124 	private:
125 		EngineSettings();
126 	};
127 
128 	%feature("director") IEngineChangeListener;
129 	class IEngineChangeListener {
130 	public:
~IEngineChangeListener()131 		virtual ~IEngineChangeListener() {}
132 		virtual void onScreenModeChanged(const ScreenMode& newmode) = 0;
133 	};
134 
135 	class Engine {
136 	public:
137 		Engine();
138 		virtual ~Engine();
139 		void initializePumping();
140 		void finalizePumping();
141 		void pump();
142 
143 		EngineSettings& getSettings();
144 		const DeviceCaps& getDeviceCaps() const;
145 
146 		void changeScreenMode(const ScreenMode& mode);
147 
148 		void init();
149 		void destroy();
150 
151 		SoundManager* getSoundManager();
152 		EventManager* getEventManager();
153 		TimeManager* getTimeManager();
154 		void setGuiManager(IGUIManager* guimanager);
155 		IGUIManager* getGuiManager();
156 		ImageManager* getImageManager();
157 		AnimationManager* getAnimationManager();
158 		SoundClipManager* getSoundClipManager();
159 		RenderBackend* getRenderBackend();
160 		Model* getModel();
161 		LogManager* getLogManager();
162 		VFS* getVFS();
163 		Cursor* getCursor();
164 		OffRenderer* getOffRenderer();
165 		TargetRenderer* getTargetRenderer();
166 
167 		void addChangeListener(IEngineChangeListener* listener);
168 		void removeChangeListener(IEngineChangeListener* listener);
169 	};
170 }
171