Debian Codegraph @

tests/swig_tests/swig_test_utils.py

raw
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 # ####################################################################
5 # Copyright (C) 2005-2019 by the FIFE team
6 # http://www.fifengine.net
7 # This file is part of FIFE.
8 #
9 # FIFE is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
13 #
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
18 #
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the
21 # Free Software Foundation, Inc.,
22 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 # ####################################################################
24
25 import os, sys, unittest
26
27 fife_path = os.path.join('..','..','engine','python')
28 if os.path.isdir(fife_path) and fife_path not in sys.path:
29 sys.path.insert(0,fife_path)
30
31 from fife import fife
32 print("Using the FIFE python module found here: ", os.path.dirname(fife.__file__))
33
34 from fife.extensions import fifelog
35
36 def getEngine(minimized=False):
37 e = fife.Engine()
38 log = fifelog.LogManager(e, promptlog=False, filelog=True)
39 log.setVisibleModules('all')
40 s = e.getSettings()
41 s.setRenderBackend('OpenGL')
42 s.setDefaultFontPath('../data/FreeMono.ttf')
43 s.setDefaultFontGlyphs(" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +
44 ".,!?-+/:();%`'*#=[]")
45 if minimized:
46 s.setScreenWidth(1)
47 s.setScreenHeight(1)
48 s.setDefaultFontSize(12)
49 e.init()
50 return e
51
52 __all__ = []
53 __all__.append('unittest')
54 __all__.append('fife')
55 __all__.append('fifelog')
56 __all__.append('getEngine')