windstille-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Windstille-devel] rev 316 - trunk/src


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 316 - trunk/src
Date: Thu, 13 May 2004 20:49:34 +0200

Author: grumbel
Date: 2004-05-13 20:49:34 +0200 (Thu, 13 May 2004)
New Revision: 316

Added:
   trunk/src/flexlay.cxx
   trunk/src/flexlay.hxx
   trunk/src/python_functor.cxx
   trunk/src/python_functor.hxx
Log:
- fixed python support a bit more

Added: trunk/src/flexlay.cxx
===================================================================
--- trunk/src/flexlay.cxx       2004-05-13 18:48:44 UTC (rev 315)
+++ trunk/src/flexlay.cxx       2004-05-13 18:49:34 UTC (rev 316)
@@ -0,0 +1,77 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#include <config.h>
+#include <ClanLib/core.h>
+#include <ClanLib/display.h>
+#include <ClanLib/gl.h>
+#include "globals.hxx"
+#include "flexlay.hxx"
+
+Flexlay flexlay;
+
+Flexlay::Flexlay()
+{
+  screen_width  = 800;
+  screen_height = 600;
+  fullscreen    = false;
+  allow_resize  = true;
+  use_opengl    = true;
+}
+
+void
+Flexlay::init()
+{
+  CL_SetupCore::init();
+#ifdef HAVE_LIBSDL
+  if (use_opengl)
+    CL_SetupGL::init();
+  else
+    CL_SetupSDL::init();
+#else
+  CL_SetupGL::init();
+#endif
+  CL_SetupDisplay::init();
+
+  datadir = "../data/";
+
+  window = new CL_DisplayWindow(PACKAGE_STRING,
+                                screen_width, screen_height, fullscreen, 
allow_resize);
+
+  resources = new CL_ResourceManager();
+}
+
+void
+Flexlay::deinit()
+{
+  CL_SetupDisplay::deinit();
+
+#ifdef HAVE_LIBSDL
+  if (use_opengl)
+    CL_SetupGL::deinit();
+  else
+    CL_SetupSDL::init();
+#else
+  CL_SetupGL::deinit();
+#endif
+
+  CL_SetupCore::deinit();
+}
+
+/* EOF */

Added: trunk/src/flexlay.hxx
===================================================================
--- trunk/src/flexlay.hxx       2004-05-13 18:48:44 UTC (rev 315)
+++ trunk/src/flexlay.hxx       2004-05-13 18:49:34 UTC (rev 316)
@@ -0,0 +1,48 @@
+//  $Id$
+// 
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#ifndef HEADER_FLEXLAY_HXX
+#define HEADER_FLEXLAY_HXX
+
+#include <ClanLib/Display/display_window.h>
+
+class Flexlay
+{
+private:
+  CL_DisplayWindow* window;
+
+public:
+  int  screen_width;
+  int  screen_height;
+  bool fullscreen;
+  bool allow_resize;
+  bool use_opengl;
+
+public:
+  Flexlay();
+
+  void init();
+  void deinit();
+};
+
+extern Flexlay flexlay;
+
+#endif
+
+/* EOF */

Added: trunk/src/python_functor.cxx
===================================================================
--- trunk/src/python_functor.cxx        2004-05-13 18:48:44 UTC (rev 315)
+++ trunk/src/python_functor.cxx        2004-05-13 18:49:34 UTC (rev 316)
@@ -0,0 +1,64 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#include "python_functor.hxx"
+
+PythonFunctor::PythonFunctor()
+  : obj(0)
+{
+}
+
+PythonFunctor::PythonFunctor(PyObject* o)
+{
+  obj = o;
+  Py_XINCREF(obj);
+}
+
+PythonFunctor::PythonFunctor(const PythonFunctor& copy)
+{
+  obj = copy.obj;
+  Py_XINCREF(obj);
+}
+
+PythonFunctor::~PythonFunctor()
+{
+  Py_XDECREF(obj);
+}
+
+PythonFunctor&
+PythonFunctor::operator=(const PythonFunctor& copy)
+{
+  if (this != &copy)
+    {
+      Py_XDECREF(obj);
+      obj = copy.obj;
+      Py_XINCREF(obj);
+    }
+  return *this;  
+}
+
+void
+PythonFunctor::operator()()
+{
+  PyObject* arglist = PyTuple_New(0);
+  PyEval_CallObject(obj,  arglist);
+  Py_DECREF(arglist);
+}
+
+/* EOF */

Added: trunk/src/python_functor.hxx
===================================================================
--- trunk/src/python_functor.hxx        2004-05-13 18:48:44 UTC (rev 315)
+++ trunk/src/python_functor.hxx        2004-05-13 18:49:34 UTC (rev 316)
@@ -0,0 +1,43 @@
+//  $Id$
+// 
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#ifndef HEADER_PYTHON_FUNCTOR_HXX
+#define HEADER_PYTHON_FUNCTOR_HXX
+
+#include "Python.h"
+
+/** */
+class PythonFunctor
+{
+private:
+  PyObject* obj;
+public:
+  PythonFunctor();
+  PythonFunctor(PyObject* o);
+  ~PythonFunctor();
+
+  PythonFunctor(const PythonFunctor& copy);
+  PythonFunctor& operator=(const PythonFunctor& copy);
+
+  void operator()();
+};
+
+#endif
+
+/* EOF */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]