Permalink
Browse files

Merged with shua

  • Loading branch information...
2 parents 98205ae + 518cd64 commit 2a539160305f2db8bbe0a7c7a9ced5808c6542fe @svenstaro committed May 9, 2010
Showing with 2,033 additions and 7,059 deletions.
  1. +9 −2 INSTALL
  2. +1 −1 data/scripts/root.xml
  3. +1 −1 src/game/level.cpp
  4. +0 −1 src/game/trigger.hpp
  5. +15 −11 src/gfx/root.cpp
  6. +0 −242 src/gui/brush.cpp
  7. +0 −99 src/gui/brush.hpp
  8. +0 −70 src/gui/button.cpp
  9. +0 −64 src/gui/button.hpp
  10. +0 −64 src/gui/check_box.cpp
  11. +0 −45 src/gui/check_box.hpp
  12. +0 −148 src/gui/console.cpp
  13. +0 −58 src/gui/console.hpp
  14. +0 −109 src/gui/drop_down_menu.cpp
  15. +0 −71 src/gui/drop_down_menu.hpp
  16. +0 −215 src/gui/file_dialog.cpp
  17. +0 −72 src/gui/file_dialog.hpp
  18. +29 −72 src/gui/gui_disp.cpp
  19. +11 −10 src/gui/gui_disp.hpp
  20. +0 −140 src/gui/layout.cpp
  21. +0 −185 src/gui/layout.hpp
  22. +0 −45 src/gui/mouse.cpp
  23. +0 −44 src/gui/mouse.hpp
  24. +0 −32 src/gui/mouse_button.hpp
  25. +0 −250 src/gui/panel.cpp
  26. +0 −67 src/gui/panel.hpp
  27. +0 −176 src/gui/scrollable_panel.cpp
  28. +0 −61 src/gui/scrollable_panel.hpp
  29. +0 −100 src/gui/scrollbar.cpp
  30. +0 −70 src/gui/scrollbar.hpp
  31. +0 −262 src/gui/sheet.cpp
  32. +0 −193 src/gui/sheet.hpp
  33. +0 −112 src/gui/skin.cpp
  34. +0 −66 src/gui/skin.hpp
  35. +0 −37 src/gui/skin_pre.hpp
  36. +0 −313 src/gui/text.cpp
  37. +0 −133 src/gui/text.hpp
  38. +0 −167 src/gui/text_box.cpp
  39. +0 −55 src/gui/text_box.hpp
  40. +0 −521 src/gui/widget.cpp
  41. +0 −498 src/gui/widget.hpp
  42. +0 −32 src/gui/widget_types.hpp
  43. +0 −134 src/gui/window.cpp
  44. +0 −76 src/gui/window.hpp
  45. +2 −2 src/main.cpp
  46. +1 −1 src/script/bindings.cpp
  47. +2 −2 src/script/bindings_editor.cpp
  48. +1 −1 src/script/bindings_game.cpp
  49. +9 −7 src/script/bindings_gui.cpp
  50. +2 −2 src/script/bindings_play.cpp
  51. +1,135 −1,135 src/states/editor.cpp
  52. +303 −301 src/states/editor.hpp
  53. +36 −10 src/states/main_menu.cpp
  54. +14 −12 src/states/main_menu.hpp
  55. +348 −348 src/states/play.cpp
  56. +114 −114 src/states/play.hpp
View
11 INSTALL
@@ -2,8 +2,15 @@ Pseudoform INSTALL
============================
To install the game, just extract it to somewhere and run
-Linux: ./pseudoform_linux.sh
-Windows: pseudoform_win.bat
+Linux:
+cmake .
+make
+./pseudoform_linux.sh
+
+Windows:
+run cmake in root dir
+run make in root dir
+pseudoform_win.bat
Except for working 3D drivers, no dependencies should be required in either case.
Please excuse the improper installation as of now.
View
@@ -1,5 +1,5 @@
<renderer lib="ogl"
- plugins="/usr/local/lib/OGRE/"
+ plugins="/usr/lib/OGRE/"
width="1024"
height="768"
fullscreen="0"
View
@@ -16,7 +16,7 @@
#include "script/bindings.hpp"
#include "script/script.hpp"
-#include "gui/sheet.hpp"
+//#include "gui/sheet.hpp"
#include "level.hpp"
#include "types.hpp"
View
@@ -11,7 +11,6 @@
#include <list>
-// TODO: include script.hpp
#include "script/script.hpp"
#include "generic_prop.hpp"
View
@@ -25,6 +25,8 @@
#include "log.hpp"
#include "fs_ops.hpp"
+#include <boost/filesystem.hpp>
+
#include "txml/txml.hpp"
namespace engine
@@ -91,22 +93,22 @@ namespace engine
}
else
{
- #ifdef _DEBUG
- _root->loadPlugin(plugins + "RenderSystem_GL_d");
- #else
+ //#ifdef _DEBUG
+ //_root->loadPlugin(plugins + "RenderSystem_GL_d");
+ //#else
_root->loadPlugin(plugins + "RenderSystem_GL");
- #endif
+ //#endif
renderLib = RL_OGL;
}
// Load CG shader manager and particle manager
- #ifdef _DEBUG
- _root->loadPlugin(plugins + "Plugin_CgProgramManager_d");
- _root->loadPlugin(plugins + "Plugin_ParticleFX_d");
- #else
+ //#ifdef _DEBUG
+ //_root->loadPlugin(plugins + "Plugin_CgProgramManager_d");
+ //_root->loadPlugin(plugins + "Plugin_ParticleFX_d");
+ //#else
_root->loadPlugin(plugins + "Plugin_CgProgramManager");
_root->loadPlugin(plugins + "Plugin_ParticleFX");
- #endif
+ //#endif
// Get full list of available renderers
const Ogre::RenderSystemList& availRenderers = _root->getAvailableRenderers();
@@ -177,8 +179,10 @@ namespace engine
// Manage project resources
Ogre::ResourceGroupManager &rgm = Ogre::ResourceGroupManager::getSingleton();
- rgm.addResourceLocation(engine::DATA_DIR, "FileSystem", "data", true);
- rgm.initialiseResourceGroup("data");
+ rgm.addResourceLocation(engine::DATA_DIR, "FileSystem", "General", true);
+ rgm.addResourceLocation(engine::DATA_DIR + "/media", "FileSystem", "General", true);
+ rgm.addResourceLocation(engine::DATA_DIR + "/media/MyGUI_Media", "FileSystem", "General", true);
+ rgm.initialiseResourceGroup("General");
Ogre::MaterialManager::getSingleton().setDefaultAnisotropy(16);
Ogre::MaterialManager::getSingleton().setDefaultTextureFiltering(Ogre::TFO_ANISOTROPIC);
View
@@ -1,242 +0,0 @@
- /*
- * Copyright (c) 2008-2010 Agop 'nullsquared' Shirinian and Sven-Hendrik 'Svenstaro' Haase
- * This file is part of Pseudoform (Pseudoform project at http://www.pseudoform.org).
- * For conditions of distribution and use, see copyright notice in COPYING
- */
-
-#include <OgreRenderSystem.h>
-#include <OgreManualObject.h>
-#include <OgreSceneManager.h>
-#include <OgreRoot.h>
-
-#include "brush.hpp"
-#include "log.hpp"
-
-#include "gfx/utils.hpp"
-#include "gfx/render_lib.hpp"
-
-namespace engine
-{
- namespace gui
- {
- idGen brush::_idGen;
-
- brush::brush():
- _rs(Ogre::Root::getSingleton().getRenderSystem()),
- _pass(NULL),
- _selectPass(NULL),
- _pressPass(NULL),
- _noBlendPass(NULL),
- _quad(NULL)
- {
- _pass = gfx::getPass("gui_mat", 0, 0, true);
- _selectPass = gfx::getPass("gui_mat", 0, 1, true);
- _pressPass = gfx::getPass("gui_mat", 0, 2, true);
- _noBlendPass = gfx::getPass("gui_mat", 0, 3, true);
-
- if (!_pass || !_selectPass || !_pressPass || !_noBlendPass)
- {
- log("gui_mat unavailable, GUI rendering will be disabled");
- }
-
- // Just get some scene manager, doesn't matter which
- Ogre::SceneManagerEnumerator::SceneManagerIterator sceneIter =
- Ogre::Root::getSingleton().getSceneManagerIterator();
- assert(sceneIter.hasMoreElements());
-
- Ogre::SceneManager *sceneMgr = sceneIter.peekNextValue();
-
- _quad = sceneMgr->createManualObject(_idGen("brush") + "::_quad");
-
- _quad->clear();
- _quad->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_TRIANGLE_LIST);
- {
- // top-right
- _quad->position(vec3(1, 1, 0));
- _quad->textureCoord(vec2(1, 0));
-
- // bottom-right
- _quad->position(vec3(1, -1, 0));
- _quad->textureCoord(vec2(1, 1));
-
- // bottom-left
- _quad->position(vec3(-1, -1, 0));
- _quad->textureCoord(vec2(0, 1));
-
- // top-left
- _quad->position(vec3(-1, 1, 0));
- _quad->textureCoord(vec2(0, 0));
-
- // Vertices are clockwise, make them anticlockwise
- _quad->quad(3, 2, 1, 0);
- }
- _quad->end();
- }
-
- brush::~brush()
- {
- if (_quad)
- _quad->_getManager()->destroyManualObject(_quad);
- _quad = NULL;
- _rs = NULL;
- }
-
-// void brush::prepareForUse() const
-// {
-// assert(_rs);
-//
-// _rs->unbindGpuProgram(Ogre::GPT_FRAGMENT_PROGRAM);
-// _rs->unbindGpuProgram(Ogre::GPT_VERTEX_PROGRAM);
-//
-// _rs->_setWorldMatrix(mat4::IDENTITY);
-// _rs->_setViewMatrix(mat4::IDENTITY);
-// _rs->_setProjectionMatrix(mat4::IDENTITY);
-//
-// _rs->setLightingEnabled(false);
-// _rs->_setDepthBias(false);
-// _rs->_setDepthBufferCheckEnabled(false);
-// _rs->_setDepthBufferWriteEnabled(false);
-// _rs->_setColourBufferWriteEnabled(true, true, true, true);
-// _rs->_setFog(Ogre::FOG_NONE);
-// _rs->_setPolygonMode(Ogre::PM_SOLID);
-// _rs->_setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);
-// _rs->_setTextureCoordSet(0, 0);
-// _rs->_setTextureUnitFiltering(0, Ogre::FO_NONE, Ogre::FO_NONE, Ogre::FO_NONE);
-// }
-
-// void brush::texture(const string &name) const
-// {
-//// assert(_rs);
-// if (!_pass)
-// return;
-//
-//// _rs->_setTexture(0, true, name);
-// _pass->getTextureUnitState(0)->setTextureName(name);
-// }
-
- void brush::render(Ogre::Viewport *vp, const vec4 &rect, const effect &e) const
- {
- if (_texture.empty())
- return;
-
- Ogre::Pass *pass = NULL;
-
- switch (e)
- {
- case E_NONE:
- pass = _pass;
- break;
-
- case E_SELECT:
- pass = _selectPass;
- break;
-
- case E_PRESS:
- pass = _pressPass;
- break;
-
- case E_NO_BLEND:
- pass = _noBlendPass;
- break;
- }
-
- if (!pass)
- return;
-
- pass->getTextureUnitState(0)->setTextureName(_texture);
-// if (!_pass)
-// _pass = gfx::getPass("gui_mat", 0, 0, true);
-// if (!_pass)
-// return;
-
- _quad->_getManager()->_setPass(pass, true, false);
-
- vec4 r = rect;
- {
- // If not relative, make it relative and cache it
- float w = 1.0 / vp->getActualWidth();
- float h = 1.0 / vp->getActualHeight();
-
- // Scale XY to [0..2], ZW to [0..1]
- r *= vec4(w * 2, h * 2, w, h);
-
- // Move XY to [-1..1] and add [0..1] WH to XY
- r += vec4(-1 + r.z, -1 + r.w, 0, 0);
-
- // Negate Y because 0 is at bottom
- r.y *= -1;
- }
-
- Ogre::RenderOperation rop;
- _quad->getSection(0)->getRenderOperation(rop);
-
- _rs->_setViewport(vp); // Render to said viewport
-
- // Scale to dimensions
- mat4 mat(mat4::getScale(r.z, r.w, 1));
-
- // Translate by XY
- mat = mat4::getTrans(r.x, r.y, 0) * mat;
-
- // Translate by half-texel offsets if necessary
- if (gfx::renderLib == gfx::RL_D3D)
- {
- // Get [-1..1] offsets
- float ox = 1.0 / vp->getTarget()->getWidth();
- float oy = 1.0 / vp->getTarget()->getHeight();
-
- // Subtract from quad position
- mat = mat4::getTrans(-ox, oy, 0) * mat;
- // (using a positive Y offset because Y goes up
- // in this space)
- }
-
- // Flip if needed for GL render targets
- if (vp->getTarget()->requiresTextureFlipping())
- mat = mat4::getScale(1, -1, 1) * mat;
-
- Ogre::GpuProgramParametersSharedPtr vertParams = pass->getVertexProgramParameters();
-
- if (vertParams->_findNamedConstantDefinition("mat"))
- vertParams->setNamedConstant("mat", mat);
-
- if (vertParams->_findNamedConstantDefinition("invSize"))
- {
- Ogre::TexturePtr tex = gfx::getTexture(_texture);
- if (tex.get())
- {
- vec4 v(1.0 / tex->getWidth(), 1.0 / tex->getHeight(), 1, 1);
- vertParams->setNamedConstant("invSize", v);
- }
- }
-
- // TODO: !!!!!!
- //_rs->bindGpuProgramParameters(Ogre::GPT_VERTEX_PROGRAM, vertParams);
-
- Ogre::GpuProgramParametersSharedPtr fragParams = pass->getFragmentProgramParameters();
-
- if (fragParams->_findNamedConstantDefinition("alpha"))
- fragParams->setNamedConstant("alpha", _alpha);
-
- if (fragParams->_findNamedConstantDefinition("colour"))
- fragParams->setNamedConstant("colour", _colour);
-
- if (fragParams->_findNamedConstantDefinition("invSize"))
- {
- Ogre::TexturePtr tex = gfx::getTexture(_texture);
- if (tex.get())
- {
- vec4 v(1.0 / tex->getWidth(), 1.0 / tex->getHeight(), 1, 1);
- fragParams->setNamedConstant("invSize", v);
- }
- }
-
- // TODO: !!!!!!
- //_rs->bindGpuProgramParameters(Ogre::GPT_FRAGMENT_PROGRAM, fragParams);
-
- _rs->_beginFrame();
- _rs->_render(rop);
- _rs->_endFrame();
- }
- }
-}
Oops, something went wrong.

0 comments on commit 2a53916

Please sign in to comment.