From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: [PATCH] Add MARS shooter. Date: Fri, 18 Sep 2015 21:25:00 +0200 Message-ID: <8761377ct3.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zd1HU-0007s7-Pp for guix-devel@gnu.org; Fri, 18 Sep 2015 15:25:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zd1HR-00027Q-JI for guix-devel@gnu.org; Fri, 18 Sep 2015 15:25:12 -0400 Received: from sender163-mail.zoho.com ([74.201.84.163]:25335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zd1HR-00022q-Be for guix-devel@gnu.org; Fri, 18 Sep 2015 15:25:09 -0400 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Guix, attached is a patch to add MARS. This is really a fun game and you can play it with a friend on the same machine. I could not get sound to work, unfortunately, because /dev/dsp does not exist on my machine. It’s not a problem with the package, but maybe someone could give me a hint about what kernel module to load to get this device. The game is more fun with sound :) ~~ Ricardo --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-gnu-Add-MARS.patch Content-Transfer-Encoding: 8bit >From 75019485e0090a9c4169a55005232689efa70c2f Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 31 Aug 2015 10:09:40 +0200 Subject: [PATCH] gnu: Add MARS. * gnu/packages/games.scm (mars): New variable. * gnu/packages/patches/mars-install.patch: New file. * gnu/packages/patches/mars-sfml-2.3.patch: New file. * gnu-system.am (dist_patch_DATA): Add them. --- gnu-system.am | 2 + gnu/packages/games.scm | 54 +++++++++++ gnu/packages/patches/mars-install.patch | 17 ++++ gnu/packages/patches/mars-sfml-2.3.patch | 151 +++++++++++++++++++++++++++++++ 4 files changed, 224 insertions(+) create mode 100644 gnu/packages/patches/mars-install.patch create mode 100644 gnu/packages/patches/mars-sfml-2.3.patch diff --git a/gnu-system.am b/gnu-system.am index d3c63ca..9f878bd 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -558,6 +558,8 @@ dist_patch_DATA = \ gnu/packages/patches/luit-posix.patch \ gnu/packages/patches/m4-gets-undeclared.patch \ gnu/packages/patches/make-impure-dirs.patch \ + gnu/packages/patches/mars-install.patch \ + gnu/packages/patches/mars-sfml-2.3.patch \ gnu/packages/patches/maxima-defsystem-mkdir.patch \ gnu/packages/patches/mc-fix-ncurses-build.patch \ gnu/packages/patches/mcron-install.patch \ diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index 7eb65bb..3d5e4f9 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2015 Andreas Enge ;;; Copyright © 2015 David Hashe ;;; Copyright © 2015 Christopher Allan Webber +;;; Copyright © 2015 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; @@ -31,11 +32,14 @@ #:use-module (guix utils) #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix git-download) #:use-module (gnu packages) #:use-module (gnu packages base) #:use-module (gnu packages admin) #:use-module (gnu packages audio) #:use-module (gnu packages boost) + #:use-module (gnu packages fribidi) + #:use-module (gnu packages game-development) #:use-module (gnu packages gettext) #:use-module (gnu packages gl) #:use-module (gnu packages glib) @@ -44,6 +48,7 @@ #:use-module (gnu packages guile) #:use-module (gnu packages libcanberra) #:use-module (gnu packages libunwind) + #:use-module (gnu packages mp3) #:use-module (gnu packages image) #:use-module (gnu packages ncurses) #:use-module (gnu packages python) @@ -573,6 +578,55 @@ for common mesh file formats, and collision detection.") (home-page "http://irrlicht.sourceforge.net/") (license license:zlib))) +(define-public mars + ;; The latest release on SourceForge relies on an unreleased version of SFML + ;; with a different API, so we take the latest version from the official + ;; repository on Github. + (let ((commit "c855d04409")) + (package + (name "mars") + (version (string-append "0.7.5-c" commit )) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/thelaui/M.A.R.S..git") + (commit commit))) + (sha256 + (base32 + "1r4c5gap1z2zsv4yjd34qriqkxaq4lb4rykapyzkkdf4g36lc3nh")) + (patches (list (search-patch "mars-sfml-2.3.patch") + (search-patch "mars-install.patch"))))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ; There are no tests + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-install-path + (lambda _ + (substitute* "src/CMakeLists.txt" + (("\\$\\{CMAKE_INSTALL_PREFIX\\}/games") + "${CMAKE_INSTALL_PREFIX}/bin")))) + (add-after 'unpack 'fix-data-path + (lambda* (#:key outputs #:allow-other-keys) + (substitute* "src/System/settings.cpp" + (("C_dataPath = \"./data/\";") + (string-append "C_dataPath = \"" + (assoc-ref outputs "out") + "/share/games/marsshooter/\";"))) + #t))))) + (inputs + `(("mesa" ,mesa) + ("fribidi" ,fribidi) + ("taglib" ,taglib) + ("sfml" ,sfml))) + (home-page "http://marsshooter.org") + (synopsis "2D space shooter") + (description + "M.A.R.S. is a 2D space shooter with awesome visual effects and +attractive physics. Players can battle each other or computer controlled +enemies in exciting game modes.") + (license license:gpl3+)))) + (define minetest-data (package (name "minetest-data") diff --git a/gnu/packages/patches/mars-install.patch b/gnu/packages/patches/mars-install.patch new file mode 100644 index 0000000..1e3964c --- /dev/null +++ b/gnu/packages/patches/mars-install.patch @@ -0,0 +1,17 @@ +Remove install target for non-existant directory. + +--- a/src/CMakeLists.txt 2015-09-13 20:52:28.517344327 +0200 ++++ b/src/CMakeLists.txt 2015-09-13 20:53:04.842453987 +0200 +@@ -122,12 +122,6 @@ + DESTINATION + ${CMAKE_INSTALL_PREFIX}/share/applications + ) +- install( +- FILES +- ${MARS_SOURCE_DIR}/resources/mars +- DESTINATION +- ${CMAKE_INSTALL_PREFIX}/share/menu +- ) + + else(UNIX) + # executable diff --git a/gnu/packages/patches/mars-sfml-2.3.patch b/gnu/packages/patches/mars-sfml-2.3.patch new file mode 100644 index 0000000..01ec05f --- /dev/null +++ b/gnu/packages/patches/mars-sfml-2.3.patch @@ -0,0 +1,151 @@ +This is a concatenation of the following two patches: + + https://github.com/jcowgill/M.A.R.S./commit/33d5affabf8ff84f2c028b9303c6a9e83cc824ad.patch + https://patch-diff.githubusercontent.com/raw/thelaui/M.A.R.S./pull/2.patch + +Their purpose is to allow Mars to be built against the latest version of SFML. + +From 33d5affabf8ff84f2c028b9303c6a9e83cc824ad Mon Sep 17 00:00:00 2001 +From: James Cowgill +Date: Sat, 9 May 2015 01:54:14 +0100 +Subject: [PATCH] Remove dependency on GLU - fixes build with SFML 2.3 + +--- + premake4.lua | 8 ++++---- + src/Shaders/postFX.cpp | 2 +- + src/System/window.cpp | 12 ++++++------ + 3 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/premake4.lua b/premake4.lua +index 023dddd..5af4495 100755 +--- a/premake4.lua ++++ b/premake4.lua +@@ -11,11 +11,11 @@ project "mars" + defines { "NDEBUG" } + flags { "Optimize" } + if os.get() == "windows" then +- links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "glu32", "opengl32", "fribidi-0", "tag" } ++ links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "opengl32", "fribidi-0", "tag" } + elseif os.get() == "macosx" then + links { "sfml-graphics.framework", "sfml-audio.framework", "sfml-system.framework", "sfml-window.framework", "opengl.framework", "fribidi", "tag" } + else +- links { "GLU", "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" } ++ links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" } + libdirs { "/usr/lib", "/usr/local/lib" } + end + +@@ -23,10 +23,10 @@ project "mars" + defines { "_DEBUG", "DEBUG" } + flags { "Symbols" } + if os.get() == "windows" then +- links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "glu32", "opengl32", "fribidi-0", "tag" } ++ links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "opengl32", "fribidi-0", "tag" } + elseif os.get() == "macosx" then + links { "sfml-graphics.framework", "sfml-audio.framework", "sfml-system.framework", "sfml-window.framework", "opengl.framework", "fribidi", "tag" } + else +- links { "GLU", "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" } ++ links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" } + libdirs { "/usr/lib", "/usr/local/lib" } + end +diff --git a/src/Shaders/postFX.cpp b/src/Shaders/postFX.cpp +index 987f411..f767a47 100644 +--- a/src/Shaders/postFX.cpp ++++ b/src/Shaders/postFX.cpp +@@ -78,7 +78,7 @@ namespace postFX { + postFX_.loadFromFile(settings::C_dataPath + "shaders/bump.frag", sf::Shader::Fragment); + bumpMap_.create(SPACE_X_RESOLUTION*0.5f, SPACE_Y_RESOLUTION*0.5f); + glViewport(0,0,SPACE_X_RESOLUTION*0.5f,SPACE_Y_RESOLUTION*0.5f); +- gluOrtho2D(0, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0); ++ glOrtho(0, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0, -1, 1); + glEnable(GL_BLEND); + glMatrixMode(GL_MODELVIEW); + postFX_.setParameter("BumpMap", bumpMap_.getTexture()); +diff --git a/src/System/window.cpp b/src/System/window.cpp +index e9a099a..8e12dcc 100644 +--- a/src/System/window.cpp ++++ b/src/System/window.cpp +@@ -222,7 +222,7 @@ namespace window { + glLoadIdentity(); + + // Setup translation (according to left-upper corner) +- gluOrtho2D(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f); ++ glOrtho(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f, -1, 1); + + // probably improves performance... + glDisable(GL_LIGHTING); +@@ -247,7 +247,7 @@ namespace window { + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); +- gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f); ++ glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + +@@ -255,7 +255,7 @@ namespace window { + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); +- gluOrtho2D(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f); ++ glOrtho(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f, -1, 1); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + } +@@ -270,7 +270,7 @@ namespace window { + glLoadIdentity(); + setViewPort(); + +- gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f); ++ glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +@@ -284,7 +284,7 @@ namespace window { + glLoadIdentity(); + setViewPort(); + +- gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f); ++ glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +@@ -294,7 +294,7 @@ namespace window { + else { + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); +- gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f); ++ glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + } + +From a97d0d6a19b5b43e3c53081e36f1f1747b6674e6 Mon Sep 17 00:00:00 2001 +From: Sylvain BOILARD +Date: Wed, 23 Jan 2013 02:02:47 +0100 +Subject: [PATCH] Use sf::Shader::Bind() correctly after latest update of the + SFML's API. + +--- + src/System/window.cpp | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/src/System/window.cpp b/src/System/window.cpp +index e9a099a..3ffcf65 100644 +--- a/src/System/window.cpp ++++ b/src/System/window.cpp +@@ -307,13 +307,11 @@ namespace window { + window_.setActive(true); + glEnable(GL_TEXTURE_2D); + +- if (shader) +- shader->bind(); ++ sf::Shader::bind(shader); + + window_.draw(toBeDrawn, states); + +- if (shader) +- shader->unbind(); ++ sf::Shader::bind(NULL); + + window_.popGLStates(); + glPopMatrix(); -- 2.5.0 --=-=-=--