widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #01067
[Merge] lp:~qcumber-some/widelands/make_opengl_glew_gettext_mandatory into lp:widelands
Jens Beyer (Qcumber-some) has proposed merging lp:~qcumber-some/widelands/make_opengl_glew_gettext_mandatory into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1159000 in widelands: "Building WL should check whether gettext is installed"
https://bugs.launchpad.net/widelands/+bug/1159000
For more details, see:
https://code.launchpad.net/~qcumber-some/widelands/make_opengl_glew_gettext_mandatory/+merge/156258
As discussed in the bug, made opengl, glew and gettext required. I also got rid of the now superfluous definition of USE_OPENGL throughout the code.
--
https://code.launchpad.net/~qcumber-some/widelands/make_opengl_glew_gettext_mandatory/+merge/156258
Your team Widelands Developers is requested to review the proposed merge of lp:~qcumber-some/widelands/make_opengl_glew_gettext_mandatory into lp:widelands.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2013-03-17 20:34:53 +0000
+++ CMakeLists.txt 2013-03-30 12:50:30 +0000
@@ -304,19 +304,10 @@
# Check for opengl
# TODO Check for SDL_opengl.h and add to include path
-find_package(OpenGL)
-if (OPENGL_FOUND)
- # OpenGL Headers are not needed directly. Instead SDL_opengl.h should be searched
- add_definitions("-DUSE_OPENGL")
- find_package(GLEW)
- if (GLEW_FOUND)
- add_definitions(${GLEW_EXTRA_DEFINITIONS})
- else (GLEW FOUND)
- message (STATUS "GLEW library not found, check your libraries path and installed packages!")
- endif (GLEW_FOUND)
-else (OPENGL_FOUND)
- message (STATUS "OpenGL support disabled, check your libraries path and installed packages!")
-endif (OPENGL_FOUND)
+find_package(OpenGL REQUIRED)
+# OpenGL Headers are not needed directly. Instead SDL_opengl.h should be searched
+find_package(GLEW REQUIRED)
+add_definitions(${GLEW_EXTRA_DEFINITIONS})
# ...but using MAJOR, MINOR and PATCH
if (DEFINED WL_VERSION_MAJOR)
@@ -421,6 +412,10 @@
include_directories(${INTL_INCLUDE_DIR})
endif (APPLE OR WIN32 OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+# Gettext is required, but it does not provide GETTEXT_INCLUDE_DIR or
+# GETTEXT_LIBRARY as "usual" libraries do
+find_package(Gettext REQUIRED)
+
find_package(SDL REQUIRED)
include_directories(${SDL_INCLUDE_DIR})
=== modified file 'doc/sphinx/source/compiling.rst'
--- doc/sphinx/source/compiling.rst 2012-06-15 20:29:49 +0000
+++ doc/sphinx/source/compiling.rst 2013-03-30 12:50:30 +0000
@@ -17,12 +17,13 @@
- SDL_net
- SDL_ttf >= 2.0.0
- SDL_gfx
-- GLEW, when compiling with OpenGL support
+- GLEW
+- OpenGL
- boost >= 1.35
- lua >= 5.1
- gettext (look at FAQ if you have problems with -lintl)
- libpng
-- zlib
+- zlib (including minizip library if available for your system)
- libiconv (only needed under win32)
- libintl (only needed under win32)
=== modified file 'src/graphic/graphic.cc'
--- src/graphic/graphic.cc 2013-03-09 14:41:03 +0000
+++ src/graphic/graphic.cc 2013-03-30 12:50:30 +0000
@@ -89,23 +89,17 @@
SDL_WM_SetIcon(s, 0);
SDL_FreeSurface(s);
-#ifndef USE_OPENGL
- assert(not opengl);
-#endif
-
// Set video mode using SDL. First collect the flags
int32_t flags = 0;
g_opengl = false;
SDL_Surface * sdlsurface = 0;
-#ifdef USE_OPENGL
if (opengl) {
log("Graphics: Trying opengl\n");
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
flags |= SDL_OPENGL;
}
-#endif
if (fullscreen) {
flags |= SDL_FULLSCREEN;
@@ -116,7 +110,6 @@
// Here we actually set the video mode
sdlsurface = SDL_SetVideoMode(w, h, bpp, flags);
-#ifdef USE_OPENGL
// If we tried opengl and it was not successful try without opengl
if (!sdlsurface and opengl)
{
@@ -124,7 +117,6 @@
flags &= ~SDL_OPENGL;
sdlsurface = SDL_SetVideoMode(w, h, bpp, flags);
}
-#endif
if (!sdlsurface)
{
@@ -148,7 +140,6 @@
if (0 != (sdlsurface->flags & SDL_FULLSCREEN))
log("Graphics: FULLSCREEN ENABLED\n");
-#ifdef USE_OPENGL
if (0 != (sdlsurface->flags & SDL_OPENGL)) {
// We have successful opened an opengl screen. Print some information
// about opengl and set the rendering capabilities.
@@ -213,7 +204,6 @@
m_caps.gl.blendequation = GLEW_VERSION_1_4 || GLEW_ARB_imaging;
GCC_DIAG_ON ("-Wold-style-cast")
}
-#endif
/* Information about the video capabilities. */
const SDL_VideoInfo* info = SDL_GetVideoInfo();
@@ -259,7 +249,6 @@
(("Widelands " + build_id() + '(' + build_type() + ')').c_str(),
"Widelands");
-#if USE_OPENGL
if (g_opengl) {
glViewport(0, 0, w, h);
@@ -296,7 +285,6 @@
screen_.reset(new GLSurfaceScreen(w, h));
}
else
-#endif
{
screen_.reset(new SDLSurface(sdlsurface));
}
@@ -321,10 +309,8 @@
flush_animations();
-#if USE_OPENGL
if (g_opengl)
GLSurfaceTexture::Cleanup();
-#endif
}
/**
@@ -409,14 +395,12 @@
*/
void Graphic::refresh(bool force)
{
-#ifdef USE_OPENGL
if (g_opengl) {
SDL_GL_SwapBuffers();
m_update_fullscreen = false;
m_nr_update_rects = 0;
return;
}
-#endif
if (force or m_update_fullscreen) {
//flip defaults to SDL_UpdateRect(m_surface, 0, 0, 0, 0);
=== modified file 'src/graphic/render/gamerenderer_gl.cc'
--- src/graphic/render/gamerenderer_gl.cc 2013-02-19 13:16:49 +0000
+++ src/graphic/render/gamerenderer_gl.cc 2013-03-30 12:50:30 +0000
@@ -17,7 +17,6 @@
*
*/
-#ifdef USE_OPENGL
#include "gamerenderer_gl.h"
#include "gl_surface.h"
@@ -670,4 +669,3 @@
glDisableClientState(GL_COLOR_ARRAY);
}
-#endif // USE_OPENGL
=== modified file 'src/graphic/render/gamerenderer_gl.h'
--- src/graphic/render/gamerenderer_gl.h 2013-02-09 12:22:53 +0000
+++ src/graphic/render/gamerenderer_gl.h 2013-03-30 12:50:30 +0000
@@ -17,7 +17,6 @@
*
*/
-#ifdef USE_OPENGL
#ifndef WIDELANDS_GAMERENDERER_GL_H
#define WIDELANDS_GAMERENDERER_GL_H
@@ -129,4 +128,3 @@
};
#endif // WIDELANDS_GAMERENDERER_GL_H
-#endif // USE_OPENGL
=== modified file 'src/graphic/surface.cc'
--- src/graphic/surface.cc 2013-02-10 13:44:17 +0000
+++ src/graphic/surface.cc 2013-03-30 12:50:30 +0000
@@ -28,22 +28,18 @@
extern bool g_opengl;
Surface* Surface::create(SDL_Surface* surf) {
-#ifdef USE_OPENGL
if (g_opengl) {
return new GLSurfaceTexture(surf);
}
-#endif
SDL_Surface * surface = SDL_DisplayFormatAlpha(surf);
SDL_FreeSurface(surf);
return new SDLSurface(surface);
}
Surface* Surface::create(uint16_t w, uint16_t h) {
-#ifdef USE_OPENGL
if (g_opengl) {
return new GLSurfaceTexture(w, h);
} else
-#endif
{
SDL_Surface* tsurf = empty_sdl_surface(w, h);
SDL_Surface* surf = SDL_DisplayFormatAlpha(tsurf);
=== modified file 'src/graphic/texture.cc'
--- src/graphic/texture.cc 2013-03-04 18:03:05 +0000
+++ src/graphic/texture.cc 2013-03-30 12:50:30 +0000
@@ -101,7 +101,6 @@
break;
}
-#ifdef USE_OPENGL
if (g_opengl) {
// Note: we except the constructor to free the SDL surface
GLSurfaceTexture* surface = new GLSurfaceTexture(surf);
@@ -137,7 +136,6 @@
++m_nrframes;
continue;
}
-#endif
// Determine color map if it's the first frame
if (!m_nrframes) {
@@ -234,10 +232,8 @@
{
m_frame_num = (time / m_frametime) % m_nrframes;
-#ifdef USE_OPENGL
if (g_opengl)
return;
-#endif
uint8_t * const lastframe = m_curframe;
=== modified file 'src/graphic/texture.h'
--- src/graphic/texture.h 2013-03-03 13:14:21 +0000
+++ src/graphic/texture.h 2013-03-30 12:50:30 +0000
@@ -53,10 +53,8 @@
void animate(uint32_t time);
void reset_was_animated() {m_was_animated = false;}
bool was_animated() const throw () {return m_was_animated;}
-#ifdef USE_OPENGL
uint32_t getTexture() const
{return m_glFrames.at(m_frame_num)->get_gl_texture();}
-#endif
private:
Colormap * m_colormap;
@@ -69,9 +67,7 @@
uint32_t m_frametime;
bool is_32bit;
bool m_was_animated;
-#ifdef USE_OPENGL
std::vector<GLSurfaceTexture*> m_glFrames;
-#endif
};
#endif
=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc 2013-02-21 19:02:21 +0000
+++ src/ui_fsmenu/options.cc 2013-03-30 12:50:30 +0000
@@ -531,9 +531,6 @@
m_remove_syncstreams .set_state(opt.remove_syncstreams);
m_label_opengl .set_textstyle(ts_small());
m_opengl .set_state(opt.opengl);
-#ifndef USE_OPENGL
- m_opengl .set_enabled(false);
-#endif
m_label_transparent_chat.set_textstyle(ts_small());
m_transparent_chat .set_state(opt.transparent_chat);
m_sb_speed .set_textstyle(ts_small());
@@ -618,11 +615,7 @@
os.panel_snap_distance = m_sb_dis_panel.getValue();
os.border_snap_distance = m_sb_dis_border.getValue();
os.remove_syncstreams = m_remove_syncstreams.get_state();
-#ifdef USE_OPENGL
os.opengl = m_opengl.get_state();
-#else
- os.opengl = false;
-#endif
os.transparent_chat = m_transparent_chat.get_state();
return os;
}
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2013-03-08 14:17:14 +0000
+++ src/wlapplication.cc 2013-03-30 12:50:30 +0000
@@ -840,11 +840,7 @@
s.get_int("yres", YRES),
s.get_int("depth", 16),
s.get_bool("fullscreen", false),
-#if USE_OPENGL
s.get_bool("opengl", true));
-#else
- false);
-#endif
}
/**
@@ -869,9 +865,7 @@
m_gfx_fullscreen = s.get_bool("fullscreen", false);
-#if USE_OPENGL
m_gfx_opengl = s.get_bool("opengl", true);
-#endif
// KLUDGE!
// Without this the following config options get dropped by check_used().
@@ -1203,7 +1197,6 @@
}
if (m_commandline.count("opengl")) {
-#ifdef USE_OPENGL
if (m_commandline["opengl"].compare("0") == 0) {
g_options.pull_section("global").create_val("opengl", "false");
} else if (m_commandline["opengl"].compare("1") == 0) {
@@ -1211,9 +1204,6 @@
} else {
log ("Invalid option opengl=[0|1]\n");
}
-#else
- log("WARNIG: This version was compiled without support for OpenGL\n");
-#endif
m_commandline.erase("opengl");
}
@@ -1419,12 +1409,10 @@
" --depth=[16|32] Color depth in number of bits per pixel.\n"
" --xres=[...] Width of the window in pixel.\n"
" --yres=[...] Height of the window in pixel.\n")
-#if USE_OPENGL
<<
_
(" --opengl=[0|1]\n"
" Enables OpenGL rendering\n")
-#endif
<<
_
("\n"
=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc 2013-02-10 19:36:24 +0000
+++ src/wui/mapview.cc 2013-03-30 12:50:30 +0000
@@ -99,11 +99,9 @@
egbase.map().overlay_manager().load_graphics();
if (!m_renderer) {
-#ifdef USE_OPENGL
if (g_opengl) {
m_renderer.reset(new GameRendererGL());
} else
-#endif
{
m_renderer.reset(new GameRendererSDL());
}
=== modified file 'tribes/barbarians/gamekeeper/conf'
--- tribes/barbarians/gamekeeper/conf 2010-08-01 14:35:38 +0000
+++ tribes/barbarians/gamekeeper/conf 2013-03-30 12:50:30 +0000
@@ -1,9 +1,17 @@
help=_The Gamekeeper makes sure that the natural population of animals never drops too low.
+program=hunt
program=release
[buildcost]
carrier=1
+[hunt]
+0=findobject type:bob radius:13 attrib:eatable # this whole program is copied from the hunter, but the animation should not include killing the animal ;-)
+1=walk object
+2=animation idle 1000 # Play a hunting animation
+3=object remove
+4=return
+
[release]
0=setbobdescription tribe:wildboar tribe:deer sheep
1=findspace size:any radius:3
=== modified file 'tribes/barbarians/gamekeepers_hut/conf'
--- tribes/barbarians/gamekeepers_hut/conf 2011-09-12 17:29:32 +0000
+++ tribes/barbarians/gamekeepers_hut/conf 2013-03-30 12:50:30 +0000
@@ -12,11 +12,24 @@
renews_map_resource=meat
[programs]
+release=_Release
+huntrelease=_Gather animal for breeding
work=_Work
+[huntrelease]
+worker=hunt
+call=release
+call=release
+return=skipped
+
+[release]
+worker=release
+return=skipped
+
[work]
sleep=52500
-worker=release
+call=huntrelease
+call=release
[idle]
pics=gamekeeper_i_??.png
Follow ups