aboutsummaryrefslogtreecommitdiff
path: root/src/client/renderingengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/renderingengine.cpp')
-rw-r--r--src/client/renderingengine.cpp67
1 files changed, 31 insertions, 36 deletions
diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp
index 1534289d4..0b7a242fa 100644
--- a/src/client/renderingengine.cpp
+++ b/src/client/renderingengine.cpp
@@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gettext.h"
#include "../gui/guiSkin.h"
-#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__) && \
+#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__) && \
!defined(SERVER) && !defined(__HAIKU__)
#define XORG_USED
#endif
@@ -58,7 +58,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
RenderingEngine *RenderingEngine::s_singleton = nullptr;
-
static gui::GUISkin *createSkin(gui::IGUIEnvironment *environment,
gui::EGUI_SKIN_TYPE type, video::IVideoDriver *driver)
{
@@ -67,7 +66,7 @@ static gui::GUISkin *createSkin(gui::IGUIEnvironment *environment,
gui::IGUIFont *builtinfont = environment->getBuiltInFont();
gui::IGUIFontBitmap *bitfont = nullptr;
if (builtinfont && builtinfont->getType() == gui::EGFT_BITMAP)
- bitfont = (gui::IGUIFontBitmap*)builtinfont;
+ bitfont = (gui::IGUIFontBitmap *)builtinfont;
gui::IGUISpriteBank *bank = 0;
skin->setFont(builtinfont);
@@ -80,7 +79,6 @@ static gui::GUISkin *createSkin(gui::IGUIEnvironment *environment,
return skin;
}
-
RenderingEngine::RenderingEngine(IEventReceiver *receiver)
{
sanity_check(!s_singleton);
@@ -106,7 +104,7 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
u32 i;
for (i = 0; i != drivers.size(); i++) {
if (!strcasecmp(driverstring.c_str(),
- RenderingEngine::getVideoDriverName(drivers[i]))) {
+ RenderingEngine::getVideoDriverName(drivers[i]))) {
driverType = drivers[i];
break;
}
@@ -134,9 +132,10 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
#endif
#if ENABLE_GLES
// there is no standardized path for these on desktop
- std::string rel_path = std::string("client") + DIR_DELIM
- + "shaders" + DIR_DELIM + "Irrlicht";
- params.OGLES2ShaderPath = (porting::path_share + DIR_DELIM + rel_path + DIR_DELIM).c_str();
+ std::string rel_path = std::string("client") + DIR_DELIM + "shaders" + DIR_DELIM +
+ "Irrlicht";
+ params.OGLES2ShaderPath =
+ (porting::path_share + DIR_DELIM + rel_path + DIR_DELIM).c_str();
#endif
m_device = createDeviceEx(params);
@@ -144,8 +143,8 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
s_singleton = this;
- auto skin = createSkin(m_device->getGUIEnvironment(),
- gui::EGST_WINDOWS_METALLIC, driver);
+ auto skin = createSkin(m_device->getGUIEnvironment(), gui::EGST_WINDOWS_METALLIC,
+ driver);
m_device->getGUIEnvironment()->setSkin(skin);
skin->drop();
}
@@ -234,8 +233,7 @@ bool RenderingEngine::setupTopLevelWindow(const std::string &name)
/* Setting general properties for the top level window */
verbosestream << "Client: Configuring general top level"
- << " window properties"
- << std::endl;
+ << " window properties" << std::endl;
bool result = setWindowIcon();
return result;
@@ -246,17 +244,16 @@ void RenderingEngine::setupTopLevelXorgWindow(const std::string &name)
#ifdef XORG_USED
const video::SExposedVideoData exposedData = driver->getExposedVideoData();
- Display *x11_dpl = reinterpret_cast<Display *>(exposedData.OpenGLLinux.X11Display);
+ Display *x11_dpl =
+ reinterpret_cast<Display *>(exposedData.OpenGLLinux.X11Display);
if (x11_dpl == NULL) {
warningstream << "Client: Could not find X11 Display in ExposedVideoData"
- << std::endl;
+ << std::endl;
return;
}
verbosestream << "Client: Configuring X11-specific top level"
- << " window properties"
- << std::endl;
-
+ << " window properties" << std::endl;
Window x11_win = reinterpret_cast<Window>(exposedData.OpenGLLinux.X11Window);
@@ -284,38 +281,35 @@ void RenderingEngine::setupTopLevelXorgWindow(const std::string &name)
// more, using gtk/gdk as the model it would seem that not using a FQDN is
// not an issue for modern Xorg window managers.
- verbosestream << "Client: Setting Xorg window manager Properties"
- << std::endl;
+ verbosestream << "Client: Setting Xorg window manager Properties" << std::endl;
- XSetWMProperties (x11_dpl, x11_win, NULL, NULL, NULL, 0, NULL, NULL, NULL);
+ XSetWMProperties(x11_dpl, x11_win, NULL, NULL, NULL, 0, NULL, NULL, NULL);
// Set the _NET_WM_PID window property according to the EWMH spec. _NET_WM_PID
// (in conjunction with WM_CLIENT_MACHINE) can be used by window managers to
// force a shutdown of an application if it doesn't respond to the destroy
// window message.
- verbosestream << "Client: Setting Xorg _NET_WM_PID extened window manager property"
- << std::endl;
+ verbosestream << "Client: Setting Xorg _NET_WM_PID extened window manager "
+ "property"
+ << std::endl;
Atom NET_WM_PID = XInternAtom(x11_dpl, "_NET_WM_PID", false);
pid_t pid = getpid();
- XChangeProperty(x11_dpl, x11_win, NET_WM_PID,
- XA_CARDINAL, 32, PropModeReplace,
- reinterpret_cast<unsigned char *>(&pid),1);
+ XChangeProperty(x11_dpl, x11_win, NET_WM_PID, XA_CARDINAL, 32, PropModeReplace,
+ reinterpret_cast<unsigned char *>(&pid), 1);
// Set the WM_CLIENT_LEADER window property here. Minetest has only one
// window and that window will always be the leader.
- verbosestream << "Client: Setting Xorg WM_CLIENT_LEADER property"
- << std::endl;
+ verbosestream << "Client: Setting Xorg WM_CLIENT_LEADER property" << std::endl;
Atom WM_CLIENT_LEADER = XInternAtom(x11_dpl, "WM_CLIENT_LEADER", false);
- XChangeProperty (x11_dpl, x11_win, WM_CLIENT_LEADER,
- XA_WINDOW, 32, PropModeReplace,
- reinterpret_cast<unsigned char *>(&x11_win), 1);
+ XChangeProperty(x11_dpl, x11_win, WM_CLIENT_LEADER, XA_WINDOW, 32,
+ PropModeReplace, reinterpret_cast<unsigned char *>(&x11_win), 1);
#endif
}
@@ -543,8 +537,8 @@ void RenderingEngine::_draw_load_screen(const std::wstring &text,
/*
Draws the menu scene including (optional) cloud background.
*/
-void RenderingEngine::_draw_menu_scene(gui::IGUIEnvironment *guienv,
- float dtime, bool clouds)
+void RenderingEngine::_draw_menu_scene(
+ gui::IGUIEnvironment *guienv, float dtime, bool clouds)
{
bool cloud_menu_background = clouds && g_settings->getBool("menu_clouds");
if (cloud_menu_background) {
@@ -604,9 +598,11 @@ void RenderingEngine::_finalize()
}
void RenderingEngine::_draw_scene(video::SColor skycolor, bool show_hud,
- bool show_minimap, bool draw_wield_tool, bool draw_crosshair, bool draw_tracers, bool draw_esp)
+ bool show_minimap, bool draw_wield_tool, bool draw_crosshair,
+ bool draw_tracers, bool draw_esp)
{
- core->draw(skycolor, show_hud, show_minimap, draw_wield_tool, draw_crosshair, draw_tracers, draw_esp);
+ core->draw(skycolor, show_hud, show_minimap, draw_wield_tool, draw_crosshair,
+ draw_tracers, draw_esp);
}
const char *RenderingEngine::getVideoDriverName(irr::video::E_DRIVER_TYPE type)
@@ -679,7 +675,6 @@ float RenderingEngine::getDisplayDensity()
#elif defined(_WIN32)
-
static float calcDisplayDensity(irr::video::IVideoDriver *driver)
{
HWND hWnd;
@@ -725,7 +720,7 @@ v2u32 RenderingEngine::getDisplaySize()
return deskres;
}
-#else // __ANDROID__
+#else // __ANDROID__
float RenderingEngine::getDisplayDensity()
{
return porting::getDisplayDensity();