You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(11) |
Apr
(47) |
May
(14) |
Jun
|
Jul
(73) |
Aug
(4) |
Sep
(2) |
Oct
(60) |
Nov
(48) |
Dec
(66) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(1) |
Mar
(27) |
Apr
(82) |
May
(89) |
Jun
(91) |
Jul
(44) |
Aug
(53) |
Sep
(113) |
Oct
(20) |
Nov
(37) |
Dec
(10) |
2008 |
Jan
|
Feb
(2) |
Mar
|
Apr
(2) |
May
(21) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2009 |
Jan
(76) |
Feb
(89) |
Mar
(52) |
Apr
(11) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(27) |
2010 |
Jan
(11) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(9) |
Sep
|
Oct
|
Nov
|
Dec
(14) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(11) |
Oct
(3) |
Nov
|
Dec
|
2013 |
Jan
(4) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <eg...@us...> - 2010-01-02 16:28:28
|
Revision: 1176 http://opengate.svn.sourceforge.net/opengate/?rev=1176&view=rev Author: egore Date: 2010-01-02 16:28:18 +0000 (Sat, 02 Jan 2010) Log Message: ----------- Move around sector and dialog stuff Modified Paths: -------------- trunk/src/Makefile.am Added Paths: ----------- trunk/src/dialogs/ trunk/src/dialogs/BaseDialog.cpp trunk/src/dialogs/BaseDialog.h trunk/src/dialogs/ConfigDialog.cpp trunk/src/dialogs/ConfigDialog.h trunk/src/dialogs/MarketDialog.h trunk/src/dialogs/ShipConfigDialog.cpp trunk/src/dialogs/ShipConfigDialog.h trunk/src/sector/ trunk/src/sector/SectorAvatarObject.cpp trunk/src/sector/SectorAvatarObject.h trunk/src/sector/SectorBaseObject.cpp trunk/src/sector/SectorBaseObject.h trunk/src/sector/SectorBeaconObject.cpp trunk/src/sector/SectorBeaconObject.h trunk/src/sector/SectorBeaconPadObject.cpp trunk/src/sector/SectorBeaconPadObject.h trunk/src/sector/SectorChildObject.cpp trunk/src/sector/SectorChildObject.h trunk/src/sector/SectorCollisionObject.cpp trunk/src/sector/SectorCollisionObject.h trunk/src/sector/SectorEnvironmentObject.cpp trunk/src/sector/SectorEnvironmentObject.h trunk/src/sector/SectorExplosionObject.cpp trunk/src/sector/SectorExplosionObject.h trunk/src/sector/SectorMeshObject.cpp trunk/src/sector/SectorMeshObject.h trunk/src/sector/SectorMissileObject.cpp trunk/src/sector/SectorMissileObject.h trunk/src/sector/SectorMovableObject.cpp trunk/src/sector/SectorMovableObject.h trunk/src/sector/SectorPadObject.cpp trunk/src/sector/SectorPadObject.h trunk/src/sector/SectorProjectileObject.cpp trunk/src/sector/SectorProjectileObject.h trunk/src/sector/SectorStationObject.cpp trunk/src/sector/SectorStationObject.h trunk/src/sector/SectorStationPadObject.cpp trunk/src/sector/SectorStationPadObject.h trunk/src/sector/SectorVesselObject.cpp trunk/src/sector/SectorVesselObject.h Removed Paths: ------------- trunk/src/BaseDialog.cpp trunk/src/BaseDialog.h trunk/src/ConfigDialog.cpp trunk/src/ConfigDialog.h trunk/src/MarketDialog.h trunk/src/SectorAvatarObject.cpp trunk/src/SectorAvatarObject.h trunk/src/SectorBaseObject.cpp trunk/src/SectorBaseObject.h trunk/src/SectorBeaconObject.cpp trunk/src/SectorBeaconObject.h trunk/src/SectorBeaconPadObject.cpp trunk/src/SectorBeaconPadObject.h trunk/src/SectorChildObject.cpp trunk/src/SectorChildObject.h trunk/src/SectorCollisionObject.cpp trunk/src/SectorCollisionObject.h trunk/src/SectorEnvironmentObject.cpp trunk/src/SectorEnvironmentObject.h trunk/src/SectorExplosionObject.cpp trunk/src/SectorExplosionObject.h trunk/src/SectorMeshObject.cpp trunk/src/SectorMeshObject.h trunk/src/SectorMissileObject.cpp trunk/src/SectorMissileObject.h trunk/src/SectorMovableObject.cpp trunk/src/SectorMovableObject.h trunk/src/SectorPadObject.cpp trunk/src/SectorPadObject.h trunk/src/SectorProjectileObject.cpp trunk/src/SectorProjectileObject.h trunk/src/SectorStationObject.cpp trunk/src/SectorStationObject.h trunk/src/SectorStationPadObject.cpp trunk/src/SectorStationPadObject.h trunk/src/SectorVesselObject.cpp trunk/src/SectorVesselObject.h trunk/src/ShipConfigDialog.cpp trunk/src/ShipConfigDialog.h Deleted: trunk/src/BaseDialog.cpp =================================================================== --- trunk/src/BaseDialog.cpp 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/BaseDialog.cpp 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,115 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 "BaseDialog.h" -#include "ResourceManager.h" - -#include <OgreRenderWindow.h> - -#include <CEGUIWindowManager.h> -#include <CEGUIWindow.h> -#include <CEGUIImageset.h> - -namespace OpenGate{ - -void renameClonedWindows( const CEGUI::Window * parent, const CEGUI::String & namePrefix) { - // std::cout << parent->getName() << ": " << parent->getChildCount() << std::endl; - - for ( unsigned int i = 0; i < parent->getChildCount(); i ++ ){ - // std::cout << i << "accessing: "<< parent->getName() << std::endl; - CEGUI::Window * child = parent->getChildAtIdx( i ); - CEGUI::WindowManager::getSingleton().renameWindow( child , namePrefix + child->getName() ); - renameClonedWindows( child, namePrefix ); - } -} - -void showRecursive( CEGUI::Window * w, bool show ){ - if ( show ) w->show(); else w->hide(); - for ( uint i = 0; i < w->getChildCount(); i ++ ) showRecursive( w->getChildAtIdx( i ), show ); -} - -void fitWindowToImage( const std::string & name, CEGUI::Window * win ){ - - CEGUI::Size imSize( CEGUI::ImagesetManager::getSingleton().getImageset( name )->getImageSize( name ) ); - CEGUI::Size winSize( win->getParent()->getPixelSize() ); - -// std::cout << imSize.d_width << " "<< imSize.d_height << std::endl; -// std::cout << winSize.d_width << " "<< winSize.d_height << std::endl; - - if ( imSize.d_width <= winSize.d_width && imSize.d_height <= winSize.d_height ){ - win->setSize( CEGUI::UVector2(CEGUI::UDim( 0.0, imSize.d_width), CEGUI::UDim( 0.0, imSize.d_height) ) ); - - if ( imSize.d_width < winSize.d_width || imSize.d_height < winSize.d_height ){ - - win->setPosition( CEGUI::UVector2(CEGUI::UDim( 0.0, ( winSize.d_width - imSize.d_width ) / 2.0), - CEGUI::UDim( 0.0, ( winSize.d_height - imSize.d_height ) / 2.0 ) ) ); - } else { - win->setPosition( CEGUI::UVector2(CEGUI::UDim( 0.0, 0.0 ), CEGUI::UDim( 0.0, 0.0 ) ) ); - } - } -} - -float windowHeight( const CEGUI::Window * child ){ - if ( child->getParent() ) return child->getHeight().asAbsolute( windowHeight( child->getParent() ) ); - return child->getHeight().asAbsolute( ResourceManager::getSingleton().renderWindow->getHeight() ); -} - -float windowWidth( const CEGUI::Window * child ){ - if ( child->getParent() ) return child->getWidth().asAbsolute( windowWidth( child->getParent() ) ); - return child->getWidth().asAbsolute( ResourceManager::getSingleton().renderWindow->getWidth() ); -} - -BaseDialog::BaseDialog( const std::string & layout ) - : rootWindow_( CEGUI::WindowManager::getSingleton().loadWindowLayout( layout ) ), - resources_( ResourceManager::getSingletonPtr() ), visible_( false ) { - hide(); - //** attach this window if parent is valid -// if ( resources_->guiSystem ){ -// if ( resources_->guiSystem->getGUISheet() ){ -// resources_->guiSystem->getGUISheet()->addChildWindow( rootWindow_ ); -// } -// } -} - -BaseDialog::~BaseDialog(){ -// if ( resources_->guiSystem ){ -// if ( resources_->guiSystem->getGUISheet() ){ -// resources_->guiSystem->getGUISheet()->removeChildWindow( rootWindow_ ); -// } -// } - CEGUI::WindowManager::getSingleton().destroyWindow( rootWindow_ ); -} - -CEGUI::String BaseDialog::name() const { - return rootWindow_->getName(); -} - -void BaseDialog::show( ){ - visible_ = true; - rootWindow_->show(); - rootWindow_->moveToFront(); -} - -void BaseDialog::hide( ){ - visible_ = false; - rootWindow_->hide(); -} - -} // namespace OpenGate Deleted: trunk/src/BaseDialog.h =================================================================== --- trunk/src/BaseDialog.h 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/BaseDialog.h 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,78 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 _OPENGATE_BASEDIALOG__H -#define _OPENGATE_BASEDIALOG__H - -#include "Opengate.h" - -#include <string> - -namespace OpenGate{ - -void renameClonedWindows( const CEGUI::Window * parent, const CEGUI::String & namePrefix ); -void showRecursive( CEGUI::Window * w, bool show = true ); -void fitWindowToImage( const std::string & name, CEGUI::Window * win ); -float windowHeight( const CEGUI::Window * child ); -float windowWidth( const CEGUI::Window * child ); - -/*! - * \brief This is a base class for dialogs - * - * \author Carsten <spo...@us...> - */ -class BaseDialog { -public: - BaseDialog( const std::string & layout ); - - /*! Default destructor. */ - virtual ~BaseDialog(); - - /*! This method returns the name of this dialog. */ - CEGUI::String name() const; - - /*! This method is used to show the dialog. */ - void show( ); - - /*! This method is used to hide the dialog. */ - void hide( ); - - /*! This is used to change the visibility */ - void setVisible( bool visibility ){ if ( visibility ) show(); else hide(); } - - /*! Check if the dialog is visible \return True, if the dialog is visible */ - bool isVisible( ) const { return visible_; } - - virtual void setupEventHandlers() = 0; - - CEGUI::Window * rootWindow(){ return rootWindow_; } - -protected: - - CEGUI::Window * rootWindow_; - ResourceManager * resources_; - - bool visible_; - -}; - -} //namespace OpenGate - -#endif // _OPENGATE_BASEDIALOG__H Deleted: trunk/src/ConfigDialog.cpp =================================================================== --- trunk/src/ConfigDialog.cpp 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/ConfigDialog.cpp 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,216 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 "ConfigDialog.h" -#include "common.h" -#include "GameStateManager.h" -#include "KeyMap.h" -#include "LogManager.h" - -#include <CEGUI/CEGUIWindowManager.h> -#include <CEGUI/elements/CEGUIPushButton.h> -#include <CEGUI/elements/CEGUIEditbox.h> -#include <CEGUI/elements/CEGUIListbox.h> -#include <CEGUI/elements/CEGUIListboxTextItem.h> - -#include <OgreArchiveManager.h> -#include <OgreFileSystem.h> - -#include <fstream> - -namespace OpenGate{ - -ConfigDialog::ConfigDialog( ) - : BaseDialog( "dialogs/ConfigDialog.layout" ){ - setupEventHandlers(); - - lastActiveWindow_ = NULL; - activeWindow_ = NULL; -} - -ConfigDialog::~ConfigDialog(){ -} - -void ConfigDialog::setupEventHandlers(){ - CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton(); - - BIND_CEGUI_EVENT( wmgr.getWindow( (CEGUI::utf8*)"Config/QuitButton" ), - CEGUI::PushButton::EventClicked, ConfigDialog::handleQuitButton_ ); - BIND_CEGUI_EVENT( wmgr.getWindow( (CEGUI::utf8*)"Config/CreditsButton" ), - CEGUI::PushButton::EventClicked, ConfigDialog::handleCreditsButton_ ); - BIND_CEGUI_EVENT( wmgr.getWindow( (CEGUI::utf8*)"Config/ControlsButton" ), - CEGUI::PushButton::EventClicked, ConfigDialog::handleControlsButton_ ); -} - -bool ConfigDialog::handleQuitButton_( const CEGUI::EventArgs & e ){ - resources_->gameStateRoot->shutdown(); - return true; -} - -bool ConfigDialog::handleControlsButton_( const CEGUI::EventArgs & e ){ - activeWindow_ = static_cast<CEGUI::Listbox*>( CEGUI::WindowManager::getSingleton().getWindow( "Config/Controls" ) ); - - KeyMap::KeyBindingsMap keyBindings = resources_->keyMap()->unDockedKeyBindings(); - uint count = 0; - - for ( KeyMap::KeyBindingsMap::iterator it = keyBindings.begin(); it != keyBindings.end(); it ++ ){ - CEGUI::Window *b; - - if ( CEGUI::WindowManager::getSingleton().isWindowPresent( activeWindow_->getName() + it->first ) ){ - b = CEGUI::WindowManager::getSingleton().getWindow( activeWindow_->getName() + it->first ); - } else { - b = CEGUI::WindowManager::getSingleton().createWindow( "opengate/Button", activeWindow_->getName() + it->first ); - b->setProperty( "Text", it->first ); - b->setSize( CEGUI::UVector2( CEGUI::UDim( 0.0, 80.0 ), CEGUI::UDim( 0.0, 25.0 ) ) ); - b->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0, 85.0 * count ), CEGUI::UDim( 0.0, 0.0 ) ) ); - CEGUI::WindowManager::getSingleton().getWindow( "Config/Controls/Header" )->addChildWindow( b ); - count ++; - BIND_CEGUI_EVENT( b, CEGUI::PushButton::EventClicked, ConfigDialog::handleControlsCategoryButton_ ); - } - - b->show(); - } - - if ( lastActiveWindow_ ) lastActiveWindow_->hide(); - activeWindow_->show(); - lastActiveWindow_ = activeWindow_; - - return true; -} - -bool ConfigDialog::handleControlsCategoryButton_( const CEGUI::EventArgs & e ){ - const CEGUI::WindowEventArgs & we = static_cast< const CEGUI::WindowEventArgs & >( e ); - std::string category( we.window->getText().c_str() ); - - fillControlsWindow_( category ); - return true; -} - -void ConfigDialog::fillControlsWindow_( const std::string & category ){ - CEGUI::Window * window = CEGUI::WindowManager::getSingleton().getWindow( "Config/Controls/Body" ); - - std::vector <CEGUI::Window *> removeList; - for ( uint i = 0; i < window->getChildCount(); i ++ ) { - removeList.push_back( window->getChildAtIdx( i ) ); - } - for ( uint i = 0; i < removeList.size(); i ++ ) { - CEGUI::WindowManager::getSingleton().destroyWindow( removeList[ i ] ); - } - //window->show(); - - std::map < std::string, std::pair< uint, uint > > keyBindings( resources_->keyMap()->unDockedKeyBindings()[ category ] ); - uint count = 0; - double x = 0.0, y; - for ( std::map < std::string, std::pair< uint, uint > >::iterator it = keyBindings.begin(); it != keyBindings.end(); it ++ ){ - std::string keyName( it->first ); - - CEGUI::Window * b; - CEGUI::String keyWindowName( window->getName() + keyName ); - - if ( CEGUI::WindowManager::getSingleton().isWindowPresent( keyWindowName ) ){ - b = CEGUI::WindowManager::getSingleton().getWindow( keyWindowName ); - b->show(); - } else { - b = CEGUI::WindowManager::getSingleton().loadWindowLayout( "dialogs/ConfigControlKey.layout" ); - CEGUI::WindowManager::getSingleton().renameWindow( b, keyWindowName ); - renameClonedWindows( b, keyWindowName ); - - window->addChildWindow( b ); - - y = count * 30.0; - if ( y > window->getPixelSize().d_height - 30.0 ){ - x = b->getPixelSize().d_width + 10; y = 0.0; - count = 0; - } - b->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0, x ), CEGUI::UDim( 0.0, y ) ) ); - - CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/Name" )->setProperty( "Text", keyName ); - CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton1" )->setProperty( "Text", - resources_->keyMap()->keycodeName( it->second.first ) ); - CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton2" )->setProperty( "Text", - resources_->keyMap()->keycodeName( it->second.second ) ); - - BIND_CEGUI_EVENT( CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton1" ), - CEGUI::PushButton::EventKeyDown, ConfigDialog::handleControlsKey1Button_ ); - BIND_CEGUI_EVENT( CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton2" ), - CEGUI::PushButton::EventKeyDown, ConfigDialog::handleControlsKey2Button_ ); - } - count ++; - b->show(); - } -} - -bool ConfigDialog::handleControlsKeyButton_( const CEGUI::EventArgs & e, uint key ){ - const CEGUI::WindowEventArgs & we = static_cast< const CEGUI::WindowEventArgs & >( e ); - CEGUI::Window *b = we.window->getParent(); - - uint keycode = resources_->keyMap()->lastKeycode(); - if ( resources_->keyMap()->lastKeycode() == OIS::KC_ESCAPE ) return true; - - if ( !resources_->keyMap()->haveKeyBinding( keycode ) ){ - CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton" + toStr( key ) )->setProperty( "Text", - resources_->keyMap()->keycodeName( keycode ) ); - - - resources_->keyMap()->setKeyBinding( CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/Name" )->getProperty( "Text").c_str(), keycode, key ); - } else { - resources_->log().warn( "there is allready a binding for " + resources_->keyMap()->keycodeName( keycode ) ); - } - - - return true; -} - - -bool ConfigDialog::handleCreditsButton_( const CEGUI::EventArgs & e ){ - //std::cout << "ConfigDialog::handleCreditsButton_( const CEGUI::EventArgs & e ){" << std::endl; - CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"Config/Credits/Header" ) - ->setProperty("Text", "Credits" ); - - activeWindow_ = static_cast<CEGUI::Listbox*> (CEGUI::WindowManager::getSingleton().getWindow( "Config/Credits/Body" ) ); - fillCreditsWindow_( dynamic_cast<CEGUI::Listbox*>( activeWindow_ ) ); - if ( lastActiveWindow_ ) lastActiveWindow_->hide(); - activeWindow_->show(); - lastActiveWindow_ = activeWindow_; - return true; -} - -void ConfigDialog::fillCreditsWindow_( CEGUI::Listbox * window ){ - window->resetList(); - std::string fileName = resources_->findFullFileName( "credits.txt" ); - - std::fstream file; file.open( fileName.c_str() ); - - std::vector < std::string > row; - while( !file.eof() ){ - row = getRowSubstrings( file ); - - CEGUI::String str; - for ( uint i = 0; i < row.size(); i ++ ){ - str += row[ i ] + " "; - } - CEGUI::ListboxTextItem * item = new CEGUI::ListboxTextItem( str ); - window->addItem ( item ); - } - window->ensureItemIsVisible( window->getItemCount() ); - file.close(); -} - -} // namespace OpenGate Deleted: trunk/src/ConfigDialog.h =================================================================== --- trunk/src/ConfigDialog.h 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/ConfigDialog.h 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,59 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 _OPENGATE_CONFIGDIALOG__H -#define _OPENGATE_CONFIGDIALOG__H - -#include "Opengate.h" -#include "BaseDialog.h" - -namespace OpenGate{ - -class ConfigDialog : public BaseDialog{ -public: - ConfigDialog( ); - - virtual ~ConfigDialog(); - - virtual void setupEventHandlers(); - -protected: - void fillCreditsWindow_( CEGUI::Listbox * window ); - void fillControlsWindow_( const std::string & category ); - - bool handleQuitButton_( const CEGUI::EventArgs & e ); - bool handleBackButton_( const CEGUI::EventArgs & e ); - bool handleCreditsButton_( const CEGUI::EventArgs & e ); - bool handleControlsButton_( const CEGUI::EventArgs & e ); - bool handleControlsCategoryButton_( const CEGUI::EventArgs & e ); - - inline bool handleControlsKey1Button_( const CEGUI::EventArgs & e ){ return handleControlsKeyButton_( e, 1 ); } - inline bool handleControlsKey2Button_( const CEGUI::EventArgs & e ){ return handleControlsKeyButton_( e, 2 ); } - bool handleControlsKeyButton_( const CEGUI::EventArgs & e, uint key ); - - std::map < std::string, std::set < CEGUI::Window * > > controlKeys_; - - CEGUI::Window * lastActiveWindow_; - CEGUI::Window * activeWindow_; -}; - -} //namespace OpenGate - -#endif // _OPENGATE_CONFIGDIALOG__H Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/Makefile.am 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -I$(top_srcdir)/src/model +AM_CPPFLAGS = -I$(top_srcdir)/src/model -I$(top_srcdir)/src/dialogs -I$(top_srcdir)/src/sector bin_PROGRAMS = \ opengateclient \ @@ -27,12 +27,16 @@ AiManager.cpp \ AiObject.h \ AiObject.cpp \ - BaseDialog.h \ - BaseDialog.cpp \ + dialogs/BaseDialog.cpp \ + dialogs/BaseDialog.h \ + dialogs/ConfigDialog.cpp \ + dialogs/ConfigDialog.h \ + dialogs/MarketDialog.cpp \ + dialogs/MarketDialog.h \ + dialogs/ShipConfigDialog.cpp \ + dialogs/ShipConfigDialog.h \ BaseObject.h \ BaseObject.cpp \ - ConfigDialog.h \ - ConfigDialog.cpp \ Console.h \ Console.cpp \ DockedState.h \ @@ -68,8 +72,6 @@ LogManager.cpp \ LogManagerBase.h \ LogManagerBase.cpp \ - MarketDialog.h \ - MarketDialog.cpp \ OpcodeWrapper.h \ OpcodeWrapper.cpp \ Opengate.h \ @@ -81,41 +83,39 @@ ResourceManager.cpp \ Sector.h \ Sector.cpp \ - SectorAvatarObject.h \ - SectorAvatarObject.cpp \ - SectorBaseObject.h \ - SectorBaseObject.cpp \ - SectorBeaconObject.h \ - SectorBeaconObject.cpp \ - SectorBeaconPadObject.h \ - SectorBeaconPadObject.cpp \ - SectorChildObject.h \ - SectorChildObject.cpp \ - SectorCollisionObject.h \ - SectorCollisionObject.cpp \ - SectorEnvironmentObject.h \ - SectorEnvironmentObject.cpp \ - SectorExplosionObject.h \ - SectorExplosionObject.cpp \ - SectorMeshObject.h \ - SectorMeshObject.cpp \ - SectorMissileObject.h \ - SectorMissileObject.cpp \ - SectorMovableObject.h \ - SectorMovableObject.cpp \ - SectorObject.h \ - SectorPadObject.h \ - SectorPadObject.cpp \ - SectorStationObject.h \ - SectorStationObject.cpp \ - SectorStationPadObject.h \ - SectorStationPadObject.cpp \ - SectorVesselObject.h \ - SectorVesselObject.cpp \ - SectorProjectileObject.h \ - SectorProjectileObject.cpp \ - ShipConfigDialog.h \ - ShipConfigDialog.cpp \ + sector/SectorAvatarObject.h \ + sector/SectorAvatarObject.cpp \ + sector/SectorBaseObject.h \ + sector/SectorBaseObject.cpp \ + sector/SectorBeaconObject.h \ + sector/SectorBeaconObject.cpp \ + sector/SectorBeaconPadObject.h \ + sector/SectorBeaconPadObject.cpp \ + sector/SectorChildObject.h \ + sector/SectorChildObject.cpp \ + sector/SectorCollisionObject.h \ + sector/SectorCollisionObject.cpp \ + sector/SectorEnvironmentObject.h \ + sector/SectorEnvironmentObject.cpp \ + sector/SectorExplosionObject.h \ + sector/SectorExplosionObject.cpp \ + sector/SectorMeshObject.h \ + sector/SectorMeshObject.cpp \ + sector/SectorMissileObject.h \ + sector/SectorMissileObject.cpp \ + sector/SectorMovableObject.h \ + sector/SectorMovableObject.cpp \ + sector/SectorObject.h \ + sector/SectorPadObject.h \ + sector/SectorPadObject.cpp \ + sector/SectorStationObject.h \ + sector/SectorStationObject.cpp \ + sector/SectorStationPadObject.h \ + sector/SectorStationPadObject.cpp \ + sector/SectorVesselObject.h \ + sector/SectorVesselObject.cpp \ + sector/SectorProjectileObject.h \ + sector/SectorProjectileObject.cpp \ UnDockedState.cpp \ UnDockedState.h \ Vessel.h \ Deleted: trunk/src/MarketDialog.h =================================================================== --- trunk/src/MarketDialog.h 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/MarketDialog.h 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,119 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 _OPENGATE_MARKETDIALOG__H -#define _OPENGATE_MARKETDIALOG__H - -#include "BaseDialog.h" -#include "EntityManager.h" - -namespace CEGUI{ - class Listbox; - class EventArgs; -} - -#include <vector> - -namespace OpenGate{ - -/*! - * \brief This is the user interface to the market - * - * \author Carsten <spo...@us...> - */ -enum SortBy{Alphanumeric, Cost, Size, Rank, Amount}; - -class MarketDialog : public BaseDialog{ -public: - MarketDialog( ); - - virtual ~MarketDialog(); - - virtual void setupEventHandlers(); - - bool buyItems( Entity * item , int amount ); - - bool sellItems( Entity * item , int amount ); - - void updateMarketView(); - - void updateInventView(); - -protected: - void updateSortIcons(); - - void populateItemWidget( CEGUI::Window * window, std::vector < CEGUI::Window * > & vWindow, int & col, int & row ); - - void fillShortItemWindow( CEGUI::Window * win, Entity * item = NULL, int amount = 0, int price = 0 ); - void fillMarketItemDetailedView( CEGUI::Window * itemWindow ); - - bool handleCategorieChanged( const CEGUI::EventArgs & e ); - - bool handeMainWindowShown( const CEGUI::EventArgs & e ); - - bool handleMarketItemSortAlphaAscend( const CEGUI::EventArgs & e ){ sortBy_ = Alphanumeric; updateSortIcons(); return true; } - bool handleMarketItemSortAlphaDescend( const CEGUI::EventArgs & e ){ sortBy_ = Alphanumeric; updateSortIcons(); return true; } - bool handleMarketItemSortCost( const CEGUI::EventArgs & e ){ sortBy_ = Cost; updateSortIcons(); return true; } - bool handleMarketItemSortSizeAscend( const CEGUI::EventArgs & e ){ sortBy_ = Size; updateSortIcons(); return true; } - bool handleMarketItemSortSizeDescend( const CEGUI::EventArgs & e ){ sortBy_ = Size; updateSortIcons(); return true; } - bool handleMarketItemSortRank( const CEGUI::EventArgs & e ){ sortBy_ = Rank; updateSortIcons(); return true; } - bool handleMarketItemSortAmountAscend( const CEGUI::EventArgs & e ){ sortBy_ = Amount; updateSortIcons(); return true; } - bool handleMarketItemSortAmountDescend( const CEGUI::EventArgs & e ){ sortBy_ = Amount; updateSortIcons(); return true; } - - bool handleMarketItemSortAscend( const CEGUI::EventArgs & e ){ sortAscending_ = true; updateSortIcons(); return true; } - bool handleMarketItemSortDescend( const CEGUI::EventArgs & e ){ sortAscending_ = false; updateSortIcons(); return true; } - - bool handleMarketItemWindowUpButton( const CEGUI::EventArgs & e ){ marketOffsetRow_--; updateMarketView(); return true; } - bool handleMarketItemWindowDownButton( const CEGUI::EventArgs & e ){ marketOffsetRow_++; updateMarketView(); return true; } - bool handleInventItemWindowUpButton( const CEGUI::EventArgs & e ){ inventOffsetRow_--; updateInventView(); return true; } - bool handleInventItemWindowDownButton( const CEGUI::EventArgs & e ){ inventOffsetRow_++; updateInventView(); return true; } - - bool handleMarketItemMouseEnters( const CEGUI::EventArgs & e ); - bool handleMarketItemMouseLeaves( const CEGUI::EventArgs & e ); - bool handleMarketItemClicked( const CEGUI::EventArgs & e ); - bool handleInventItemClicked( const CEGUI::EventArgs & e ); - - bool handleMarketItemViewNotNowButton( const CEGUI::EventArgs & e ); - bool handleMarketItemViewAcceptButton( const CEGUI::EventArgs & e ); - bool handleMarketItemChangeAmount( const CEGUI::EventArgs & e ); - - bool handleMouseWheelChanged( const CEGUI::EventArgs & e ); - - std::string selectedCategory_; - std::vector < CEGUI::Window * > marketItems_; - std::vector < CEGUI::Window * > inventItems_; - - int marketItemWindowCol_; - int marketItemWindowRow_; - int marketOffsetRow_; - - int inventItemWindowCol_; - int inventItemWindowRow_; - int inventOffsetRow_; - - bool buyMode_; - bool sortAscending_; - SortBy sortBy_; - -}; - -} //namespace OpenGate - -#endif // _OPENGATE_MARKETDIALOG__H Deleted: trunk/src/SectorAvatarObject.cpp =================================================================== --- trunk/src/SectorAvatarObject.cpp 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/SectorAvatarObject.cpp 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,92 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by OpenGate development team * - * spo...@us... * - * * - * 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 "Opengate.h" - -#include "SectorAvatarObject.h" - -#include "LogManager.h" -#include "Moveable.h" -#include "OpcodeWrapper.h" -#include "ResourceManager.h" -#include "Sector.h" -#include "SectorMissileObject.h" -#include "Vessel.h" - -#include <OgreSceneNode.h> - -namespace OpenGate{ - -SectorAvatarObject::SectorAvatarObject( const std::string & name, Sector * sector, Vessel * vessel ) - : SectorVesselObject( name, sector, vessel ){ - - reset(); -} - -SectorAvatarObject::~SectorAvatarObject( ){ -} - -void SectorAvatarObject::reset( ){ - SectorVesselObject::reset(); - thrustChange_ = 0.0; -} - -void SectorAvatarObject::collide( SectorCollisionObject * object ){ - SectorMovableObject::collide( object ); -} - -bool SectorAvatarObject::update( Ogre::Real elapsedTime ){ - //** just for key autorepeat - if ( thrustChange_ != 0.0 ){ - thrustRate_ += ( thrustChange_ * 0.8 * elapsedTime ); - thrustRate_ = max( thrustRate_, 0.0 ); - thrustRate_ = min( 1.0, thrustRate_ ); - setThrustRate( thrustRate_ ); - } - return SectorVesselObject::update( elapsedTime ); -} - -void SectorAvatarObject::decrementThrust( bool pressed ){ - if ( pressed ){ - thrustChange_ = -1.0; - } else { - thrustChange_ = 0.0; - } -} - -void SectorAvatarObject::incrementThrust( bool pressed ){ - if ( pressed ){ - thrustChange_ = 1.0; - } else { - thrustChange_ = 0.0; - } -} - -void SectorAvatarObject::fireMissile( Missile * missile, SectorMeshObject * target ){ - - SectorMissileObject * obj = sector_->createMissileObject( missile, mainNode_->getPosition() - mainNode_->getOrientation().yAxis() * 3.0 ); - obj->setTarget( target ); - obj->mainNode()->setOrientation( mainNode_->getOrientation() ); - obj->launch(); -} - -} //namespace OpenGate - - Deleted: trunk/src/SectorAvatarObject.h =================================================================== --- trunk/src/SectorAvatarObject.h 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/SectorAvatarObject.h 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,74 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by OpenGate development team * - * spo...@us... * - * * - * 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 _OPENGATE_SECTORAVATAROBJECT__H -#define _OPENGATE_SECTORAVATAROBJECT__H - -#include "Opengate.h" -#include "SectorVesselObject.h" - -namespace OpenGate{ - -/*! Baseclass for SectorObjects that can move, SectorMovableObject are mainly used for remote objects.*/ -class SectorAvatarObject : public SectorVesselObject { -public: - /*! Construct SectorObjectBase, Movable is a property template for the moveable object*/ - SectorAvatarObject( const std::string & name, Sector * sector, Vessel * vessel ); - - /*! Default destructor */ - virtual ~SectorAvatarObject( ); - - /*! Abstract method for runtime identification */ - virtual int rtti( ) const { return SECTOR_AVATAR_OBJECT_RTTI; } - - virtual bool update( Ogre::Real elapsedTime ); - - /*! Decide what happen if this object collide with another. */ - virtual void collide( SectorCollisionObject * object ); - - /*! Reset all values for this object. */ - virtual void reset( ); - - /*! Decrement thrust while key pressed, for auto key repeat simulation */ - void decrementThrust( bool pressed ); - - /*! Increment thrust while key pressed, for auto key repeat simulation */ - void incrementThrust( bool pressed ); - - /*! Returns the relative speed */ - inline Ogre::Real speedRate() const { if ( maxSpeed_ > 0 ) return ( speed_ / maxSpeed_ ); else return 0.0; } -// /*! Returns the current relative armor. */ -// inline Ogre::Real armorRate() const { if ( maxArmor() > 0 ) return (float)armor_ / maxArmor(); else return 0.0; } -// /*! Returns the relative shield. */ -// inline Ogre::Real shieldRate() const { if ( maxShield() > 0 ) return (float)shield_ / maxShield(); else return 0.0; } - - - void fireMissile( Missile * missile, SectorMeshObject * target = NULL ); - -protected: - Ogre::Real thrustChange_; -}; - - -} //namespace OpenGate - -#endif //_OPENGATE_SECTORAVATAROBJECT__H - - Deleted: trunk/src/SectorBaseObject.cpp =================================================================== --- trunk/src/SectorBaseObject.cpp 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/SectorBaseObject.cpp 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,49 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by OpenGate development team * - * spo...@us... * - * * - * 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 "SectorBaseObject.h" - -#include "LogManager.h" -#include "Sector.h" - -#include <OgreSceneManager.h> -#include <OgreSceneNode.h> - -namespace OpenGate{ - -SectorBaseObject::SectorBaseObject( const std::string & name, Sector * sector, Ogre::SceneNode * parentNode ) - : name_( name ), sector_( sector ), destroyRequest_ ( false ){ - - Ogre::SceneNode * par = parentNode; - if ( !par ) par = sector_->sceneManager()->getRootSceneNode(); - - try { - mainNode_ = par->createChildSceneNode( name_ ); - } catch ( Ogre::Exception & e ) { - LogManager::getSingleton().fatal( e.getFullDescription() ); - } -} - -SectorBaseObject::~SectorBaseObject( ){ - Ogre::SceneNode * par = mainNode_->getParentSceneNode(); - par->removeAndDestroyChild( mainNode_->getName() ); -} - -} Deleted: trunk/src/SectorBaseObject.h =================================================================== --- trunk/src/SectorBaseObject.h 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/SectorBaseObject.h 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,76 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by OpenGate development team * - * spo...@us... * - * * - * 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 _OPENGATE_SECTORBASEOBJECT__H -#define _OPENGATE_SECTORBASEOBJECT__H - -#include "Opengate.h" - -namespace OpenGate{ - -/*! Baseclass for SectorObjects. All visible and interaction stuff that belongs to a sector is a SectorObject. Each SectorObject has a OgreSceneNode and provide a update function */ -class SectorBaseObject { -public: - /*! Construct SectorBaseObject, each SectorObject must have an unique name, a sector (which can be understand as a runtime container for the object) - and a parent Ogre::SceneNode, the default parent node is OgreSceneManager::rootSceneNode() */ - SectorBaseObject( const std::string & name, Sector * sector, Ogre::SceneNode * parentNode = NULL ); - - /*! Default destructor */ - virtual ~SectorBaseObject( ); - - /*! Abstract class for runtime identification */ - virtual int rtti( ) const = 0; - - /*! Base update loop return fals either !update_() or destroyRequest */ - virtual bool update( Ogre::Real elapsedTime ) = 0; - - //** Start GETer/SETer - /*! Return the name of the object */ - inline const std::string & name() const { return name_; } - - /*! Return a ptr to the corresponding sector */ - inline Sector * sector() { return sector_; } - - /*! Return a ptr to main OgreSceneNode for this SectorObject. */ - inline Ogre::SceneNode * mainNode() { return mainNode_; } - - inline bool isDestroyRequest() const { return destroyRequest_; } - - //** END GETer/SETer - -protected: - /*! Mark the object for destruction \n - To keep destruction thread safe, we just notify and let update return false, so the sector update cycle do the destruction job */ - inline void setDestroyRequest_( bool dest = true ) { destroyRequest_ = dest; } - - - std::string name_; - Sector * sector_; - Ogre::SceneNode * mainNode_; - - bool destroyRequest_; -}; - - -} //namespace OpenGate - -#endif //_OPENGATE_SECTORBASEOBJECT__H - - Deleted: trunk/src/SectorBeaconObject.cpp =================================================================== --- trunk/src/SectorBeaconObject.cpp 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/SectorBeaconObject.cpp 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,77 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by OpenGate development team * - * spo...@us... * - * * - * 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 "SectorBeaconObject.h" - -#include "LogManager.h" -#include "ResourceManager.h" -#include "Sector.h" -#include "SectorBeaconPadObject.h" - -#include <OgreEntity.h> -#include <OgreSceneManager.h> -#include <OgreSceneNode.h> -#include <OgreSubEntity.h> - -namespace OpenGate{ - -SectorBeaconObject::SectorBeaconObject( const std::string & name, Sector * sector, Ogre::SceneNode * parentNode ) - : SectorMeshObject( name, sector, parentNode ) { - - entryPad_ = NULL; - exitPad_ = NULL; - - setMesh( "beacon.mesh" ); - entityScaleNode_->scale( 20.0, 20.0, 20.0 ); - - for ( uint i = 0; i < entity()->getNumSubEntities(); i ++ ){ - std::cout << entity()->getSubEntity( i )->getMaterialName() << " Techniques: " - << entity()->getSubEntity( i )->getMaterial()->getNumTechniques() << " used: " - << entity()->getSubEntity( i )->getTechnique()->getName() << std::endl; - - if ( entity()->getSubEntity( i )->getMaterialName() == "beacon/bg" ){ - entity()->getSubEntity( i )->setMaterialName( "Sta/TS/Background" ); - } - - if ( entity()->getSubEntity( i )->getMaterialName() == "beacon/pad_mount_0" ){ - entity()->getSubEntity( i )->setMaterialName( "Shader/SingleColor" ); - entity()->getSubEntity( i )->setCustomParameter( 0, Ogre::Vector4( 0.5, 0.5, 0.5, 1.0 ) ); - entryPad_ = new SectorBeaconPadObject( "EntryPad", this, entity()->getSubEntity( i ) ); - entryPad_->changeEntity( "beacon_pad.mesh" ); - entryPad_->entity()->setMaterialName( "Shader/SingleColor" ); - entryPad_->entity()->getSubEntity( 0 )->setCustomParameter( 0, Ogre::Vector4( 0.8, 0.0, 0.0, 0.2 ) ); - } - if ( entity()->getSubEntity( i )->getMaterialName() == "beacon/pad_mount_1" ){ - entity()->getSubEntity( i )->setMaterialName( "Shader/SingleColor" ); - entity()->getSubEntity( i )->setCustomParameter( 0, Ogre::Vector4( 0.5, 0.5, 0.5, 1.0 ) ); - exitPad_ = new SectorBeaconPadObject( "ExitPad", this, entity()->getSubEntity( i ) ); - exitPad_->changeEntity( "beacon_pad.mesh" ); - exitPad_->entity()->setMaterialName( "Shader/SingleColor" ); - exitPad_->entity()->getSubEntity( 0 )->setCustomParameter( 0, Ogre::Vector4( 0.8, 0.0, 0.0, 0.2 ) ); - } - } -} - -SectorBeaconObject::~SectorBeaconObject( ){ - if ( entryPad_ ) delete entryPad_; - if ( exitPad_ ) delete exitPad_; -} - -} Deleted: trunk/src/SectorBeaconObject.h =================================================================== --- trunk/src/SectorBeaconObject.h 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/SectorBeaconObject.h 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,60 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by OpenGate development team * - * spo...@us... * - * * - * 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 _OPENGATE_SECTORBEACONOBJECT__H -#define _OPENGATE_SECTORBEACONOBJECT__H - -#include "Opengate.h" - -#include "SectorMeshObject.h" - -namespace OpenGate{ - -/*! A Beacon object */ -class SectorBeaconObject : public SectorMeshObject { -public: - /*! Construct the Beacon */ - SectorBeaconObject( const std::string & name, Sector * sector, Ogre::SceneNode * parentNode = NULL ); - - /*! Default destructor */ - virtual ~SectorBeaconObject( ); - - /*! Abstract method for runtime identification */ - virtual int rtti( ) const { return SECTOR_BEACON_OBJECT_RTTI; } - - inline virtual std::string collisionClass() const { return "Station"; } - - /*! Update function */ - virtual bool update( Ogre::Real elapsedTime ) { return true; } - - /*! Return ptr to the entry pad */ - SectorBeaconPadObject * entryPad() { return entryPad_; } - - /*! Return ptr to the exit pad */ - SectorBeaconPadObject * exitPad() { return exitPad_; } - -protected: - SectorBeaconPadObject * entryPad_; - SectorBeaconPadObject * exitPad_; -}; - -} //namespace OpenGate - -#endif //_OPENGATE_SECTORBEACONOBJECT__H Deleted: trunk/src/SectorBeaconPadObject.cpp =================================================================== --- trunk/src/SectorBeaconPadObject.cpp 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/SectorBeaconPadObject.cpp 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,76 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by OpenGate development team * - * spo...@us... * - * * - * 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 "SectorBeaconPadObject.h" - -#include "OpcodeWrapper.h" -#include "ResourceManager.h" -#include "Sector.h" -#include "SectorBeaconObject.h" - -#include <OgreEntity.h> -#include <OgreSceneManager.h> -#include <OgreSceneNode.h> - -namespace OpenGate{ - -SectorBeaconPadObject::SectorBeaconPadObject( const std::string & name, SectorBeaconObject * parent, Ogre::SubEntity * parentSubEntity ) - : SectorPadObject( name, parent, parentSubEntity ){ - - if ( ResourceManager::getSingleton().collisionManager ){ - ResourceManager::getSingleton().collisionManager->create( this ); - } -} - -SectorBeaconPadObject::~SectorBeaconPadObject( ){ - if ( ResourceManager::getSingleton().collisionManager ){ - ResourceManager::getSingleton().collisionManager->destroy( this ); - } -} - -bool SectorBeaconPadObject::update( Ogre::Real elapsedTime ) { - return true; -} - -void SectorBeaconPadObject::collide( SectorCollisionObject * obj ){ - std::cout << "SectorBeaconPadObject: " << this->name() << " collide with " - << obj->rtti() << " " << obj->name() << std::endl; -} - -SectorBeaconObject * SectorBeaconPadObject::beacon() { - return dynamic_cast < SectorBeaconObject * >( parent_ ); -} - -void SectorBeaconPadObject::changeEntity( const std::string & meshname ){ - if ( ResourceManager::getSingleton().collisionManager ){ - ResourceManager::getSingleton().collisionManager->destroy( this ); - } - mainNode_->detachObject( entity_ ); - sector_->sceneManager()->destroyEntity( entity_ ); - entity_ = sector_->sceneManager()->createEntity( name_ + "/Entity", meshname ); - mainNode_->attachObject( entity_ ); - mainNode_->translate( position_ ); - - if ( ResourceManager::getSingleton().collisionManager ){ - ResourceManager::getSingleton().collisionManager->create( this ); - } -} - -} Deleted: trunk/src/SectorBeaconPadObject.h =================================================================== --- trunk/src/SectorBeaconPadObject.h 2010-01-02 15:46:45 UTC (rev 1175) +++ trunk/src/SectorBeaconPadObject.h 2010-01-02 16:28:18 UTC (rev 1176) @@ -1,61 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by OpenGate development team * - * spo...@us... * - * * - * 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 _OPENGATE_SECTORBEACONPADOBJECT__H -#define _OPENGATE_SECTORBEACONPADOBJECT__H - -#include "Opengate.h" -#include "SectorPadObject.h" - -namespace OpenGate{ - -/*! Baseclass for Child SectorObjects that contains to any parent SectorCollisionObject. i.e. projectile, pads. */ -class SectorBeaconPadObject : public SectorPadObject { -public: - /*! Construct SectorPadObject */ - SectorBeaconPadObje... [truncated message content] |
From: <eg...@us...> - 2010-01-02 15:46:59
|
Revision: 1175 http://opengate.svn.sourceforge.net/opengate/?rev=1175&view=rev Author: egore Date: 2010-01-02 15:46:45 +0000 (Sat, 02 Jan 2010) Log Message: ----------- The model is moved out to it's directory with this commit Modified Paths: -------------- trunk/src/Makefile.am Added Paths: ----------- trunk/src/model/Equipment.cpp trunk/src/model/Equipment.h Removed Paths: ------------- trunk/src/Equipment.cpp trunk/src/Equipment.h Deleted: trunk/src/Equipment.cpp =================================================================== --- trunk/src/Equipment.cpp 2010-01-02 15:41:20 UTC (rev 1174) +++ trunk/src/Equipment.cpp 2010-01-02 15:46:45 UTC (rev 1175) @@ -1,83 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * eg...@us... * - * * - * 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 "Equipment.h" -#include "common.h" - -namespace OpenGate{ - -void Commodity::readPropertiesFromXML( TiXmlHandle & hRoot ){ - Entity::readPropertiesFromXML( hRoot ); - readXMLNode< int >( hRoot, "melting-point", this, &OpenGate::Commodity::setMeltingPoint, false ); - readXMLNode< double >( hRoot, "gravitic-sig", this, &OpenGate::Commodity::setGraviticSig, false ); -} - -void Equipment::readPropertiesFromXML( TiXmlHandle & hRoot ){ - Entity::readPropertiesFromXML( hRoot ); - readXMLNode< double >( hRoot, "efficency", this, &OpenGate::Equipment::setEfficiency, false ); - readXMLNode< std::string >( hRoot, "Manufacturer", this, &OpenGate::Equipment::setManufacturer, false ); - readXMLNode< Uint32 >( hRoot, "power_input", this, &OpenGate::Equipment::setPowerConsumption, false ); -} - -void PowerPlant::readPropertiesFromXML( TiXmlHandle & hRoot ){ - Equipment::readPropertiesFromXML( hRoot ); - readXMLNode< Uint32 >( hRoot, "power_output", this, &OpenGate::PowerPlant::setPowerOutput, false ); - } - -void Engine::readPropertiesFromXML( TiXmlHandle & hRoot ){ - Equipment::readPropertiesFromXML( hRoot ); - readXMLNode< Uint32 >( hRoot, "maximum_thrust", this, &OpenGate::Engine::setMaxThrust, false ); - } - -void Radar::readPropertiesFromXML( TiXmlHandle & hRoot ){ - Equipment::readPropertiesFromXML( hRoot ); - readXMLNode< Uint32 >( hRoot, "maximum_range", this, &OpenGate::Radar::setMaxRange, false ); - } - -void Ecm::readPropertiesFromXML( TiXmlHandle & hRoot ){ - Equipment::readPropertiesFromXML( hRoot ); - readXMLNode< Uint8 >( hRoot, "sensorlevel", this, &OpenGate::Ecm::setSensorLevel, false ); - } - -void Shield::readPropertiesFromXML( TiXmlHandle & hRoot ){ - Equipment::readPropertiesFromXML( hRoot ); - readXMLNode< Uint32 >( hRoot, "regeneration_rate", this, &OpenGate::Shield::setRegenerationRate, false ); - readXMLNode< Uint32 >( hRoot, "maximum_deflection", this, &OpenGate::Shield::setMaxDeflection, false ); - } - -void Capacitor::readPropertiesFromXML( TiXmlHandle & hRoot ){ - Equipment::readPropertiesFromXML( hRoot ); - readXMLNode< Uint32 >( hRoot, "capacity", this, &OpenGate::Capacitor::setCapacity, false ); -} - -void Gun::readPropertiesFromXML( TiXmlHandle & hRoot ){ - Equipment::readPropertiesFromXML( hRoot ); - readXMLNode< Uint32 >( hRoot, "damage", this, &OpenGate::Gun::setDamage, false ); - readXMLNode< Uint32 >( hRoot, "velocity", this, &OpenGate::Gun::setSpeed, false ); - readXMLNode< std::string >( hRoot, "type", this, &OpenGate::Gun::setType, false ); - readXMLNode< double >( hRoot, "life_time", this, &OpenGate::Gun::setLifeTime, false ); - readXMLNode< double >( hRoot, "fire_delay", this, &OpenGate::Gun::setFireDelay, false ); - readXMLNode< Uint32 >( hRoot, "power_per_shot", this, &OpenGate::Gun::setEnergy, false ); -} - - -} // namespace OpenGate - - Deleted: trunk/src/Equipment.h =================================================================== --- trunk/src/Equipment.h 2010-01-02 15:41:20 UTC (rev 1174) +++ trunk/src/Equipment.h 2010-01-02 15:46:45 UTC (rev 1175) @@ -1,349 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * eg...@us... * - * * - * 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 _OPENGATE_EQUIPMENT_H -#define _OPENGATE_EQUIPMENT_H - -#include <set> -#include <string> - -#include "common.h" - -#include "Entity.h" - -namespace OpenGate{ - -/*! - * \brief This class defines a commodity (goods, ore, etc. to build stuff from) - * - * This class is handled like equipment. But since it's not plugable into a - * ship it's a seperate class. This stores some information about a commodity, - * like its mass, its melting point, etc. - * \author Christoph Brill <eg...@us...> - */ -class Commodity : public Entity { -public: - - Commodity() : Entity() { //, commodityID_( "unknownID" ) { - rtti_ = COMMODITY; - meltingPoint_ = 0; - graviticSig_ = 0.0; - } - virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); - - inline void setMeltingPoint( int meltingPoint ){ meltingPoint_ = meltingPoint; } - inline int meltingPoint( ) const { return meltingPoint_; } - - inline void setGraviticSig( double graviticSig ){ graviticSig_ = graviticSig; } - inline double graviticSig( ) const { return graviticSig_; } - -// inline void setCommodityID( const std::string & commodityID ) { commodityID_ = commodityID; } -// inline std::string commodityID( ) const { return commodityID_; } - -protected: - // /*! The unique name of this commodity \todo check if that can be merged with EntityTemlpate.id_ */ -// std::string commodityID_; - /*! The specific melting point of this commodity */ - int meltingPoint_; - /*! The specific atomic wheight of this commodity */ - double graviticSig_; -}; - - -/** - * \brief This abstract class defines the basics for Equipment that is plugged - * into a vessel. - * - * So if you plug in an engine (which is a child class of this) you plug in an - * equipment part. It has power consumption etc. This class only - * defines whatever is common for all equipments parts. - * - * \author Christoph Brill <eg...@us...> - */ - -class Equipment : public Entity{ -public: - virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); - - inline void setManufacturer( const std::string & manufacturer ) { manufacturer_ = manufacturer; } - inline std::string manufacturer( ) const { return manufacturer_; } - - /*! Sets the Efficiency of this Equipment between 0(min) and 1(max) */ - inline void setEfficiency( double efficiency ) { efficiency_ = efficiency; } - inline double efficiency( ) const { return efficiency_; } - - virtual void setPowerConsumption( Uint32 powerConsumption ) { - powerConsumption_ = powerConsumption; - //** if input power is < 1000, then input is scaled in kW - if ( powerConsumption_ < 1e3 ) powerConsumption_ *= 1000; - } - virtual Uint32 powerConsumption( ) const { return powerConsumption_; } - -protected: - Equipment() : Entity(), manufacturer_( "unkown" ) { - size_ = 0; - efficiency_ = 1.0; - powerConsumption_ = 0; - } - - virtual ~Equipment() { } - - /*! Name of the company that produces this equipment */ - std::string manufacturer_; - - /*! Stores the efficiency of this equipment */ - double efficiency_; - - /*! Stores the power consumption of this equipment */ - Uint32 powerConsumption_; -}; - -/*! - * \brief This class stores the basical information of a PowerPlant - * - * This class, like all other equipment classes, is filled by loading the - * information from an XML file. It defines the details for a PowerPlant, which - * is a component that is plugged into the ship. - * \author Christoph Brill <eg...@us...> - */ -class PowerPlant : public Equipment { -public: - PowerPlant() : Equipment(){ - rtti_ = POWERPLANT; - powerOutput_ = 0; - } - virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); - - inline void setPowerOutput( Uint32 power ) { - powerOutput_ = power; - //** if input power is < 100kW, then input is scaled in kW - if ( powerOutput_ < 1e5 ) powerOutput_ *= 1000; - } - inline Uint32 powerOutput( ) const { return powerOutput_; } - -protected: - Uint32 powerOutput_; -}; - -/*! - * \brief This class stores the basical information of an engine - * - * This class, like all other equipment classes, is filled by loading the - * information from an XML file. It defines the details for an engine, which - * is a component that is plugged into the ship. - * \author Christoph Brill <eg...@us...> - */ -class Engine : public Equipment { -public: - - Engine() : Equipment() { - rtti_ = ENGINE; - maxThrust_ = 0; - } - - virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); - - inline void setMaxThrust( Uint32 maxThrust ) { - maxThrust_ = maxThrust; - //** if input thrust is < 100kN, then input is scaled in kN - if ( maxThrust_ < 1e5 ) maxThrust_ *= 1000; - } - inline Uint32 maxThrust( ) { return maxThrust_; } - - virtual Uint32 powerConsumption( ) const { return (Uint32)rint( (float)maxThrust_ / efficiency_ ); } - -private: - /*! Stores the maximum thrust of this engine */ - Uint32 maxThrust_; -}; - -/*! - * \brief This class stores the basical information of a radar - * - * This class, like all other equipment classes, is filled by loading the - * information from an XML file. It defines the details for a radar, which - * is a component that is plugged into the ship. - * \author Christoph Brill <eg...@us...> - */ -class Radar : public Equipment { -public: - Radar() : Equipment(){ - rtti_ = RADAR; - } - virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); - - inline void setMaxRange( Uint32 range ){ range_ = range; } - inline Uint32 maxRange() const{ return range_; } - -protected: - Uint32 range_; -}; - -/*! - * \brief This class stores the basical information of an Ecm (Evasion and Counter Measures) - * - * This class, like all other equipment classes, is filled by loading the - * information from an XML file. It defines the details for a Ecm, which - * is a component that is plugged into the ship. - * \author Christoph Brill <eg...@us...> - */ -class Ecm : public Equipment{ -public: - - Ecm() : Equipment() { - rtti_ = ECM; - sensorLevel_ = 0; - } - virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); - - inline void setSensorLevel( short sensorLevel ) { sensorLevel_ = sensorLevel; } - inline Uint8 sensorLevel( ) { return sensorLevel_; } - -private: - /*! Stores the sensorlevel of this Ecm */ - Uint8 sensorLevel_; -}; - -/*! - * \brief This class stores the basical information of a Shield - * - * This class, like all other equipment classes, is filled by loading the - * information from an XML file. It defines the details for a shield, which - * is a component that is plugged into the ship. - * \author Christoph Brill <eg...@us...> - */ -class Shield : public Equipment { -public: - Shield() : Equipment(){ - rtti_ = SHIELD; - } - virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); - - inline void setMaxDeflection( Uint32 deflection ){ - setMaximumDeflection_ = deflection; - //** if input deflection is < 100kJ, then input is scaled in kJ - if ( setMaximumDeflection_ < 1e5 ) setMaximumDeflection_ *= 1000; - } - inline Uint32 maxDeflection( ) const { return setMaximumDeflection_; } - - inline void setRegenerationRate( Uint32 regenRate ){ - regenerationRate_ = regenRate; - //** if input regeneration rate is < 10kJ, then input is scaled in kJ - if ( regenerationRate_ < 1e4 ) regenerationRate_ *= 1000; - } - inline Uint32 regenerationRate( ) const { return regenerationRate_; } - - inline Uint32 powerConsumption( ) const { return (Uint32) rint( regenerationRate_ / efficiency_ ); } - -protected: - Uint32 regenerationRate_; - Uint32 setMaximumDeflection_; -}; - -/*! - * \brief This class stores the basical information of a capactitor - * - * This class, like all other equipment classes, is filled by loading the - * information from an XML file. It defines the details for a capacitor, which - * is a component that is plugged into the ship. - * \author Christoph Brill <eg...@us...> - */ -class Capacitor : public Equipment{ -public: - - Capacitor() : Equipment() { - rtti_ = CAPACITOR; - capacity_ = 0; - } - virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); - - inline void setCapacity( Uint32 capacity ) { - capacity_ = capacity; - //** if input capacity is < 100kJ, then input is scaled in kJ - if ( capacity_ < 1e5 ) capacity_ *= 1000; - } - inline Uint32 capacity( ) { return capacity_; } - -private: - /*! Stores the capacity of a capacitor */ - Uint32 capacity_; -}; - -class Gun : public Equipment{ -public: - Gun(): Equipment(){ - rtti_ = GUN; - type_ = UNKNOWN; - } - - virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); - - void setType( const std::string & type ) { - if ( type == "laser" ){ - type_ = LASER; - } else if ( type == "mininglaser" ){ - type_ = MININGLASER; - } else if ( type == "bullet" ){ - type_ = BULLET; - } - } - - inline GunType type() const { return type_; } - - inline void setEnergy( Uint32 energy ){ - powerConsumption_ = energy; if ( powerConsumption_ < 1e4 ) powerConsumption_ *= 1000; } - - inline void setDamage( Uint32 damage ) { - damage_ = damage; if ( damage_ < 1e4 ) damage_ *= 1000; } - - inline Uint32 damage( ) const { return damage_; } - - inline void setSpeed( Uint32 speed ) { speed_ = speed; } - inline Uint32 speed() const { return speed_; } - - inline void setLifeTime( Ogre::Real lifeTime ) { lifeTime_ = lifeTime; } - inline Ogre::Real lifeTime() const { return lifeTime_; }; - - inline void setFireDelay( Ogre::Real fireDelay ) { fireDelay_ = fireDelay; } - inline Ogre::Real fireDelay() const { return fireDelay_; } - -protected: - GunType type_; - Uint32 damage_; - Uint32 speed_; - Ogre::Real lifeTime_; - Ogre::Real fireDelay_; -}; - -class ModX : public Equipment{ -public: - ModX() : Equipment(){ - rtti_ = MODX; - } - virtual ~ModX(){}; - -protected: -}; - - -} // namespace OpenGate - -#endif //_OPENGATE_ENTITY_H - Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2010-01-02 15:41:20 UTC (rev 1174) +++ trunk/src/Makefile.am 2010-01-02 15:46:45 UTC (rev 1175) @@ -39,6 +39,8 @@ DockedState.cpp \ model/Entity.cpp \ model/Entity.h \ + model/Equipment.cpp \ + model/Equipment.h \ model/MeshEntity.cpp \ model/MeshEntity.h \ model/Missile.cpp \ @@ -48,8 +50,6 @@ model/Station.h \ EntityManager.h \ EntityManager.cpp \ - Equipment.h \ - Equipment.cpp \ GameState.h \ GameState.cpp \ GameStateManager.h \ Copied: trunk/src/model/Equipment.cpp (from rev 1168, trunk/src/Equipment.cpp) =================================================================== --- trunk/src/model/Equipment.cpp (rev 0) +++ trunk/src/model/Equipment.cpp 2010-01-02 15:46:45 UTC (rev 1175) @@ -0,0 +1,83 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by OpenGate development team * + * eg...@us... * + * * + * 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 "Equipment.h" +#include "common.h" + +namespace OpenGate{ + +void Commodity::readPropertiesFromXML( TiXmlHandle & hRoot ){ + Entity::readPropertiesFromXML( hRoot ); + readXMLNode< int >( hRoot, "melting-point", this, &OpenGate::Commodity::setMeltingPoint, false ); + readXMLNode< double >( hRoot, "gravitic-sig", this, &OpenGate::Commodity::setGraviticSig, false ); +} + +void Equipment::readPropertiesFromXML( TiXmlHandle & hRoot ){ + Entity::readPropertiesFromXML( hRoot ); + readXMLNode< double >( hRoot, "efficency", this, &OpenGate::Equipment::setEfficiency, false ); + readXMLNode< std::string >( hRoot, "Manufacturer", this, &OpenGate::Equipment::setManufacturer, false ); + readXMLNode< Uint32 >( hRoot, "power_input", this, &OpenGate::Equipment::setPowerConsumption, false ); +} + +void PowerPlant::readPropertiesFromXML( TiXmlHandle & hRoot ){ + Equipment::readPropertiesFromXML( hRoot ); + readXMLNode< Uint32 >( hRoot, "power_output", this, &OpenGate::PowerPlant::setPowerOutput, false ); + } + +void Engine::readPropertiesFromXML( TiXmlHandle & hRoot ){ + Equipment::readPropertiesFromXML( hRoot ); + readXMLNode< Uint32 >( hRoot, "maximum_thrust", this, &OpenGate::Engine::setMaxThrust, false ); + } + +void Radar::readPropertiesFromXML( TiXmlHandle & hRoot ){ + Equipment::readPropertiesFromXML( hRoot ); + readXMLNode< Uint32 >( hRoot, "maximum_range", this, &OpenGate::Radar::setMaxRange, false ); + } + +void Ecm::readPropertiesFromXML( TiXmlHandle & hRoot ){ + Equipment::readPropertiesFromXML( hRoot ); + readXMLNode< Uint8 >( hRoot, "sensorlevel", this, &OpenGate::Ecm::setSensorLevel, false ); + } + +void Shield::readPropertiesFromXML( TiXmlHandle & hRoot ){ + Equipment::readPropertiesFromXML( hRoot ); + readXMLNode< Uint32 >( hRoot, "regeneration_rate", this, &OpenGate::Shield::setRegenerationRate, false ); + readXMLNode< Uint32 >( hRoot, "maximum_deflection", this, &OpenGate::Shield::setMaxDeflection, false ); + } + +void Capacitor::readPropertiesFromXML( TiXmlHandle & hRoot ){ + Equipment::readPropertiesFromXML( hRoot ); + readXMLNode< Uint32 >( hRoot, "capacity", this, &OpenGate::Capacitor::setCapacity, false ); +} + +void Gun::readPropertiesFromXML( TiXmlHandle & hRoot ){ + Equipment::readPropertiesFromXML( hRoot ); + readXMLNode< Uint32 >( hRoot, "damage", this, &OpenGate::Gun::setDamage, false ); + readXMLNode< Uint32 >( hRoot, "velocity", this, &OpenGate::Gun::setSpeed, false ); + readXMLNode< std::string >( hRoot, "type", this, &OpenGate::Gun::setType, false ); + readXMLNode< double >( hRoot, "life_time", this, &OpenGate::Gun::setLifeTime, false ); + readXMLNode< double >( hRoot, "fire_delay", this, &OpenGate::Gun::setFireDelay, false ); + readXMLNode< Uint32 >( hRoot, "power_per_shot", this, &OpenGate::Gun::setEnergy, false ); +} + + +} // namespace OpenGate + + Copied: trunk/src/model/Equipment.h (from rev 1168, trunk/src/Equipment.h) =================================================================== --- trunk/src/model/Equipment.h (rev 0) +++ trunk/src/model/Equipment.h 2010-01-02 15:46:45 UTC (rev 1175) @@ -0,0 +1,349 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by OpenGate development team * + * eg...@us... * + * * + * 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 _OPENGATE_EQUIPMENT_H +#define _OPENGATE_EQUIPMENT_H + +#include <set> +#include <string> + +#include "common.h" + +#include "Entity.h" + +namespace OpenGate{ + +/*! + * \brief This class defines a commodity (goods, ore, etc. to build stuff from) + * + * This class is handled like equipment. But since it's not plugable into a + * ship it's a seperate class. This stores some information about a commodity, + * like its mass, its melting point, etc. + * \author Christoph Brill <eg...@us...> + */ +class Commodity : public Entity { +public: + + Commodity() : Entity() { //, commodityID_( "unknownID" ) { + rtti_ = COMMODITY; + meltingPoint_ = 0; + graviticSig_ = 0.0; + } + virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); + + inline void setMeltingPoint( int meltingPoint ){ meltingPoint_ = meltingPoint; } + inline int meltingPoint( ) const { return meltingPoint_; } + + inline void setGraviticSig( double graviticSig ){ graviticSig_ = graviticSig; } + inline double graviticSig( ) const { return graviticSig_; } + +// inline void setCommodityID( const std::string & commodityID ) { commodityID_ = commodityID; } +// inline std::string commodityID( ) const { return commodityID_; } + +protected: + // /*! The unique name of this commodity \todo check if that can be merged with EntityTemlpate.id_ */ +// std::string commodityID_; + /*! The specific melting point of this commodity */ + int meltingPoint_; + /*! The specific atomic wheight of this commodity */ + double graviticSig_; +}; + + +/** + * \brief This abstract class defines the basics for Equipment that is plugged + * into a vessel. + * + * So if you plug in an engine (which is a child class of this) you plug in an + * equipment part. It has power consumption etc. This class only + * defines whatever is common for all equipments parts. + * + * \author Christoph Brill <eg...@us...> + */ + +class Equipment : public Entity{ +public: + virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); + + inline void setManufacturer( const std::string & manufacturer ) { manufacturer_ = manufacturer; } + inline std::string manufacturer( ) const { return manufacturer_; } + + /*! Sets the Efficiency of this Equipment between 0(min) and 1(max) */ + inline void setEfficiency( double efficiency ) { efficiency_ = efficiency; } + inline double efficiency( ) const { return efficiency_; } + + virtual void setPowerConsumption( Uint32 powerConsumption ) { + powerConsumption_ = powerConsumption; + //** if input power is < 1000, then input is scaled in kW + if ( powerConsumption_ < 1e3 ) powerConsumption_ *= 1000; + } + virtual Uint32 powerConsumption( ) const { return powerConsumption_; } + +protected: + Equipment() : Entity(), manufacturer_( "unkown" ) { + size_ = 0; + efficiency_ = 1.0; + powerConsumption_ = 0; + } + + virtual ~Equipment() { } + + /*! Name of the company that produces this equipment */ + std::string manufacturer_; + + /*! Stores the efficiency of this equipment */ + double efficiency_; + + /*! Stores the power consumption of this equipment */ + Uint32 powerConsumption_; +}; + +/*! + * \brief This class stores the basical information of a PowerPlant + * + * This class, like all other equipment classes, is filled by loading the + * information from an XML file. It defines the details for a PowerPlant, which + * is a component that is plugged into the ship. + * \author Christoph Brill <eg...@us...> + */ +class PowerPlant : public Equipment { +public: + PowerPlant() : Equipment(){ + rtti_ = POWERPLANT; + powerOutput_ = 0; + } + virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); + + inline void setPowerOutput( Uint32 power ) { + powerOutput_ = power; + //** if input power is < 100kW, then input is scaled in kW + if ( powerOutput_ < 1e5 ) powerOutput_ *= 1000; + } + inline Uint32 powerOutput( ) const { return powerOutput_; } + +protected: + Uint32 powerOutput_; +}; + +/*! + * \brief This class stores the basical information of an engine + * + * This class, like all other equipment classes, is filled by loading the + * information from an XML file. It defines the details for an engine, which + * is a component that is plugged into the ship. + * \author Christoph Brill <eg...@us...> + */ +class Engine : public Equipment { +public: + + Engine() : Equipment() { + rtti_ = ENGINE; + maxThrust_ = 0; + } + + virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); + + inline void setMaxThrust( Uint32 maxThrust ) { + maxThrust_ = maxThrust; + //** if input thrust is < 100kN, then input is scaled in kN + if ( maxThrust_ < 1e5 ) maxThrust_ *= 1000; + } + inline Uint32 maxThrust( ) { return maxThrust_; } + + virtual Uint32 powerConsumption( ) const { return (Uint32)rint( (float)maxThrust_ / efficiency_ ); } + +private: + /*! Stores the maximum thrust of this engine */ + Uint32 maxThrust_; +}; + +/*! + * \brief This class stores the basical information of a radar + * + * This class, like all other equipment classes, is filled by loading the + * information from an XML file. It defines the details for a radar, which + * is a component that is plugged into the ship. + * \author Christoph Brill <eg...@us...> + */ +class Radar : public Equipment { +public: + Radar() : Equipment(){ + rtti_ = RADAR; + } + virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); + + inline void setMaxRange( Uint32 range ){ range_ = range; } + inline Uint32 maxRange() const{ return range_; } + +protected: + Uint32 range_; +}; + +/*! + * \brief This class stores the basical information of an Ecm (Evasion and Counter Measures) + * + * This class, like all other equipment classes, is filled by loading the + * information from an XML file. It defines the details for a Ecm, which + * is a component that is plugged into the ship. + * \author Christoph Brill <eg...@us...> + */ +class Ecm : public Equipment{ +public: + + Ecm() : Equipment() { + rtti_ = ECM; + sensorLevel_ = 0; + } + virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); + + inline void setSensorLevel( short sensorLevel ) { sensorLevel_ = sensorLevel; } + inline Uint8 sensorLevel( ) { return sensorLevel_; } + +private: + /*! Stores the sensorlevel of this Ecm */ + Uint8 sensorLevel_; +}; + +/*! + * \brief This class stores the basical information of a Shield + * + * This class, like all other equipment classes, is filled by loading the + * information from an XML file. It defines the details for a shield, which + * is a component that is plugged into the ship. + * \author Christoph Brill <eg...@us...> + */ +class Shield : public Equipment { +public: + Shield() : Equipment(){ + rtti_ = SHIELD; + } + virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); + + inline void setMaxDeflection( Uint32 deflection ){ + setMaximumDeflection_ = deflection; + //** if input deflection is < 100kJ, then input is scaled in kJ + if ( setMaximumDeflection_ < 1e5 ) setMaximumDeflection_ *= 1000; + } + inline Uint32 maxDeflection( ) const { return setMaximumDeflection_; } + + inline void setRegenerationRate( Uint32 regenRate ){ + regenerationRate_ = regenRate; + //** if input regeneration rate is < 10kJ, then input is scaled in kJ + if ( regenerationRate_ < 1e4 ) regenerationRate_ *= 1000; + } + inline Uint32 regenerationRate( ) const { return regenerationRate_; } + + inline Uint32 powerConsumption( ) const { return (Uint32) rint( regenerationRate_ / efficiency_ ); } + +protected: + Uint32 regenerationRate_; + Uint32 setMaximumDeflection_; +}; + +/*! + * \brief This class stores the basical information of a capactitor + * + * This class, like all other equipment classes, is filled by loading the + * information from an XML file. It defines the details for a capacitor, which + * is a component that is plugged into the ship. + * \author Christoph Brill <eg...@us...> + */ +class Capacitor : public Equipment{ +public: + + Capacitor() : Equipment() { + rtti_ = CAPACITOR; + capacity_ = 0; + } + virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); + + inline void setCapacity( Uint32 capacity ) { + capacity_ = capacity; + //** if input capacity is < 100kJ, then input is scaled in kJ + if ( capacity_ < 1e5 ) capacity_ *= 1000; + } + inline Uint32 capacity( ) { return capacity_; } + +private: + /*! Stores the capacity of a capacitor */ + Uint32 capacity_; +}; + +class Gun : public Equipment{ +public: + Gun(): Equipment(){ + rtti_ = GUN; + type_ = UNKNOWN; + } + + virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); + + void setType( const std::string & type ) { + if ( type == "laser" ){ + type_ = LASER; + } else if ( type == "mininglaser" ){ + type_ = MININGLASER; + } else if ( type == "bullet" ){ + type_ = BULLET; + } + } + + inline GunType type() const { return type_; } + + inline void setEnergy( Uint32 energy ){ + powerConsumption_ = energy; if ( powerConsumption_ < 1e4 ) powerConsumption_ *= 1000; } + + inline void setDamage( Uint32 damage ) { + damage_ = damage; if ( damage_ < 1e4 ) damage_ *= 1000; } + + inline Uint32 damage( ) const { return damage_; } + + inline void setSpeed( Uint32 speed ) { speed_ = speed; } + inline Uint32 speed() const { return speed_; } + + inline void setLifeTime( Ogre::Real lifeTime ) { lifeTime_ = lifeTime; } + inline Ogre::Real lifeTime() const { return lifeTime_; }; + + inline void setFireDelay( Ogre::Real fireDelay ) { fireDelay_ = fireDelay; } + inline Ogre::Real fireDelay() const { return fireDelay_; } + +protected: + GunType type_; + Uint32 damage_; + Uint32 speed_; + Ogre::Real lifeTime_; + Ogre::Real fireDelay_; +}; + +class ModX : public Equipment{ +public: + ModX() : Equipment(){ + rtti_ = MODX; + } + virtual ~ModX(){}; + +protected: +}; + + +} // namespace OpenGate + +#endif //_OPENGATE_ENTITY_H + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2010-01-02 15:41:41
|
Revision: 1174 http://opengate.svn.sourceforge.net/opengate/?rev=1174&view=rev Author: egore Date: 2010-01-02 15:41:20 +0000 (Sat, 02 Jan 2010) Log Message: ----------- Move around more fileMove around more filess Modified Paths: -------------- trunk/src/Makefile.am Added Paths: ----------- trunk/src/model/Missile.cpp trunk/src/model/Missile.h Removed Paths: ------------- trunk/src/Missile.cpp trunk/src/Missile.h Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2010-01-02 15:35:42 UTC (rev 1173) +++ trunk/src/Makefile.am 2010-01-02 15:41:20 UTC (rev 1174) @@ -41,6 +41,8 @@ model/Entity.h \ model/MeshEntity.cpp \ model/MeshEntity.h \ + model/Missile.cpp \ + model/Missile.h \ model/Moveable.cpp \ model/Moveable.h \ model/Station.h \ @@ -68,8 +70,6 @@ LogManagerBase.cpp \ MarketDialog.h \ MarketDialog.cpp \ - Missile.h \ - Missile.cpp \ OpcodeWrapper.h \ OpcodeWrapper.cpp \ Opengate.h \ Deleted: trunk/src/Missile.cpp =================================================================== --- trunk/src/Missile.cpp 2010-01-02 15:35:42 UTC (rev 1173) +++ trunk/src/Missile.cpp 2010-01-02 15:41:20 UTC (rev 1174) @@ -1,41 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 "Missile.h" -#include "common.h" - -namespace OpenGate{ - -Missile::Missile( ) : Movable() { - rtti_ = MISSILE; - dragFactor_ = 1; - thrust_ = 1; - lifetime_ = 1; -} - -void Missile::readPropertiesFromXML( TiXmlHandle & hRoot ){ - Movable::readPropertiesFromXML( hRoot ); - - readXMLNode< int >( hRoot, "damage", this, &OpenGate::Missile::setDamage, false ); - readXMLNode< int >( hRoot, "thrust", this, &OpenGate::Missile::setThrust, false ); - readXMLNode< int >( hRoot, "lifetime life_time", this, &OpenGate::Missile::setLifeTime, false ); -} - -} //namespace OpenGate Deleted: trunk/src/Missile.h =================================================================== --- trunk/src/Missile.h 2010-01-02 15:35:42 UTC (rev 1173) +++ trunk/src/Missile.h 2010-01-02 15:41:20 UTC (rev 1174) @@ -1,58 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 _OPENGATE_MISSILE__H -#define _OPENGATE_MISSILE__H - -#include "Moveable.h" - -#include <map> -#include <vector> - -namespace OpenGate{ - -class Missile: public Movable{ -public: - Missile(); - virtual ~Missile(){} - - virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); - - /*! Set Damage in k, internal damage is stored in */ - void setDamage( Uint32 damage ) { damage_ = 1000 * damage; } - Uint32 damage() const { return damage_; } - - void setThrust( Uint32 thrust ) { thrust_ = thrust; } - Uint32 thrust( ) const { return thrust_; } - - void setLifeTime( double lifetime ) { lifetime_ = lifetime; } - double lifetime( ) const { return lifetime_; } - - inline virtual Ogre::Real maxSpeed() const { return std::sqrt( thrust_ / dragFactor_ ); } - -protected: - Uint32 damage_; - Uint32 thrust_; - double lifetime_; -}; - -} - -#endif //_OPENGATE_MISSILE__H Copied: trunk/src/model/Missile.cpp (from rev 1168, trunk/src/Missile.cpp) =================================================================== --- trunk/src/model/Missile.cpp (rev 0) +++ trunk/src/model/Missile.cpp 2010-01-02 15:41:20 UTC (rev 1174) @@ -0,0 +1,41 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by OpenGate development team * + * spo...@us... * + * * + * 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 "Missile.h" +#include "common.h" + +namespace OpenGate{ + +Missile::Missile( ) : Movable() { + rtti_ = MISSILE; + dragFactor_ = 1; + thrust_ = 1; + lifetime_ = 1; +} + +void Missile::readPropertiesFromXML( TiXmlHandle & hRoot ){ + Movable::readPropertiesFromXML( hRoot ); + + readXMLNode< int >( hRoot, "damage", this, &OpenGate::Missile::setDamage, false ); + readXMLNode< int >( hRoot, "thrust", this, &OpenGate::Missile::setThrust, false ); + readXMLNode< int >( hRoot, "lifetime life_time", this, &OpenGate::Missile::setLifeTime, false ); +} + +} //namespace OpenGate Copied: trunk/src/model/Missile.h (from rev 1168, trunk/src/Missile.h) =================================================================== --- trunk/src/model/Missile.h (rev 0) +++ trunk/src/model/Missile.h 2010-01-02 15:41:20 UTC (rev 1174) @@ -0,0 +1,58 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by OpenGate development team * + * spo...@us... * + * * + * 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 _OPENGATE_MISSILE__H +#define _OPENGATE_MISSILE__H + +#include "Moveable.h" + +#include <map> +#include <vector> + +namespace OpenGate{ + +class Missile: public Movable{ +public: + Missile(); + virtual ~Missile(){} + + virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); + + /*! Set Damage in k, internal damage is stored in */ + void setDamage( Uint32 damage ) { damage_ = 1000 * damage; } + Uint32 damage() const { return damage_; } + + void setThrust( Uint32 thrust ) { thrust_ = thrust; } + Uint32 thrust( ) const { return thrust_; } + + void setLifeTime( double lifetime ) { lifetime_ = lifetime; } + double lifetime( ) const { return lifetime_; } + + inline virtual Ogre::Real maxSpeed() const { return std::sqrt( thrust_ / dragFactor_ ); } + +protected: + Uint32 damage_; + Uint32 thrust_; + double lifetime_; +}; + +} + +#endif //_OPENGATE_MISSILE__H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2010-01-02 15:36:02
|
Revision: 1173 http://opengate.svn.sourceforge.net/opengate/?rev=1173&view=rev Author: egore Date: 2010-01-02 15:35:42 +0000 (Sat, 02 Jan 2010) Log Message: ----------- Continue moving around the model classes Modified Paths: -------------- trunk/src/Makefile.am Added Paths: ----------- trunk/src/model/Moveable.cpp trunk/src/model/Moveable.h Removed Paths: ------------- trunk/src/Moveable.cpp trunk/src/Moveable.h Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2010-01-02 15:25:51 UTC (rev 1172) +++ trunk/src/Makefile.am 2010-01-02 15:35:42 UTC (rev 1173) @@ -37,10 +37,12 @@ Console.cpp \ DockedState.h \ DockedState.cpp \ + model/Entity.cpp \ model/Entity.h \ - model/Entity.cpp \ + model/MeshEntity.cpp \ model/MeshEntity.h \ - model/MeshEntity.cpp \ + model/Moveable.cpp \ + model/Moveable.h \ model/Station.h \ EntityManager.h \ EntityManager.cpp \ @@ -68,8 +70,6 @@ MarketDialog.cpp \ Missile.h \ Missile.cpp \ - Moveable.h \ - Moveable.cpp \ OpcodeWrapper.h \ OpcodeWrapper.cpp \ Opengate.h \ Deleted: trunk/src/Moveable.cpp =================================================================== --- trunk/src/Moveable.cpp 2010-01-02 15:25:51 UTC (rev 1172) +++ trunk/src/Moveable.cpp 2010-01-02 15:35:42 UTC (rev 1173) @@ -1,45 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 "Moveable.h" -#include "common.h" -#include "LogManager.h" - -namespace OpenGate{ - -Movable::Movable() : MeshEntity(){ - yaw_ = 1.0; - pitch_ = 1.0; - roll_ = 1.0; - armor_ = 1; - dragFactor_ = 1.0; -} - -void Movable::readPropertiesFromXML( TiXmlHandle & hRoot ){ - MeshEntity::readPropertiesFromXML( hRoot ); - - readXMLNode< float >( hRoot, "yaw maximum_yaw", this, &OpenGate::Movable::setYaw, false ); - readXMLNode< float >( hRoot, "pitch maximum_pitch", this, &OpenGate::Movable::setPitch, false ); - readXMLNode< float >( hRoot, "roll maximum_roll", this, &OpenGate::Movable::setRoll, false ); - readXMLNode< Uint32 >( hRoot, "armor", this, &OpenGate::Movable::setArmor, false ); - readXMLNode< float >( hRoot, "dragfactor drag_factor", this, &OpenGate::Movable::setDragFactor, false ); -} - -} //namespace OpenGate Deleted: trunk/src/Moveable.h =================================================================== --- trunk/src/Moveable.h 2010-01-02 15:25:51 UTC (rev 1172) +++ trunk/src/Moveable.h 2010-01-02 15:35:42 UTC (rev 1173) @@ -1,77 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 _OPENGATE_MOVABLE__H -#define _OPENGATE_MOVABLE__H - -#include "MeshEntity.h" - -namespace OpenGate{ - -/*! \brief A movabeble entity is a MeshEntity that is capable of being moved. - * - * The best example of a movable entity is the players vessel. The game would - * not be fun if the player could not move around in space. Other stuff like - * stations or planets are immovable and therefore not in this class hierarchie. - */ -class Movable : public MeshEntity{ -public: - Movable(); - virtual ~Movable(){} - - virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); - - inline void setArmor( Uint32 armor ){ armor_ = armor * 1000; } - inline Uint32 armor( ) const { return armor_; } - - /*! degree /second */ - inline void setYaw( float yaw ){ yaw_ = yaw; - if ( yaw_ < 1.0 ) yaw_ = 1000.0 * ( 180.0 * yaw_ ) / 3.141592; } - - inline float yaw( ) const { return yaw_; } - - //** degree /second - inline void setPitch( float pitch ){ pitch_ = pitch; - if ( pitch_ < 1.0 ) pitch_ = 1000.0 * ( 180.0 * pitch_ ) / 3.141592; } - - inline float pitch( ) const { return pitch_; } - - inline void setRoll( float roll ){ roll_ = roll; - if ( roll_ < 1.0 ) roll_ = 1000.0 * ( 180.0 * roll_ ) / 3.141592; } - - inline float roll( ) const { return roll_; } - - inline void setDragFactor( float drag ){ dragFactor_ = drag; } - inline float dragFactor( ) const { return dragFactor_; } - - virtual Ogre::Real maxSpeed() const { return 0.0; } -protected: - Uint32 armor_; - - Ogre::Real yaw_; - Ogre::Real pitch_; - Ogre::Real roll_; - - Ogre::Real dragFactor_; -}; - -} // namespace OpenGate - -#endif //_OPENGATE_MOVABLE__H Copied: trunk/src/model/Moveable.cpp (from rev 1168, trunk/src/Moveable.cpp) =================================================================== --- trunk/src/model/Moveable.cpp (rev 0) +++ trunk/src/model/Moveable.cpp 2010-01-02 15:35:42 UTC (rev 1173) @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by OpenGate development team * + * spo...@us... * + * * + * 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 "Moveable.h" +#include "common.h" +#include "LogManager.h" + +namespace OpenGate{ + +Movable::Movable() : MeshEntity(){ + yaw_ = 1.0; + pitch_ = 1.0; + roll_ = 1.0; + armor_ = 1; + dragFactor_ = 1.0; +} + +void Movable::readPropertiesFromXML( TiXmlHandle & hRoot ){ + MeshEntity::readPropertiesFromXML( hRoot ); + + readXMLNode< float >( hRoot, "yaw maximum_yaw", this, &OpenGate::Movable::setYaw, false ); + readXMLNode< float >( hRoot, "pitch maximum_pitch", this, &OpenGate::Movable::setPitch, false ); + readXMLNode< float >( hRoot, "roll maximum_roll", this, &OpenGate::Movable::setRoll, false ); + readXMLNode< Uint32 >( hRoot, "armor", this, &OpenGate::Movable::setArmor, false ); + readXMLNode< float >( hRoot, "dragfactor drag_factor", this, &OpenGate::Movable::setDragFactor, false ); +} + +} //namespace OpenGate Copied: trunk/src/model/Moveable.h (from rev 1172, trunk/src/Moveable.h) =================================================================== --- trunk/src/model/Moveable.h (rev 0) +++ trunk/src/model/Moveable.h 2010-01-02 15:35:42 UTC (rev 1173) @@ -0,0 +1,77 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by OpenGate development team * + * spo...@us... * + * * + * 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 _OPENGATE_MOVABLE__H +#define _OPENGATE_MOVABLE__H + +#include "MeshEntity.h" + +namespace OpenGate{ + +/*! \brief A movabeble entity is a MeshEntity that is capable of being moved. + * + * The best example of a movable entity is the players vessel. The game would + * not be fun if the player could not move around in space. Other stuff like + * stations or planets are immovable and therefore not in this class hierarchie. + */ +class Movable : public MeshEntity{ +public: + Movable(); + virtual ~Movable(){} + + virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); + + inline void setArmor( Uint32 armor ){ armor_ = armor * 1000; } + inline Uint32 armor( ) const { return armor_; } + + /*! degree /second */ + inline void setYaw( float yaw ){ yaw_ = yaw; + if ( yaw_ < 1.0 ) yaw_ = 1000.0 * ( 180.0 * yaw_ ) / 3.141592; } + + inline float yaw( ) const { return yaw_; } + + //** degree /second + inline void setPitch( float pitch ){ pitch_ = pitch; + if ( pitch_ < 1.0 ) pitch_ = 1000.0 * ( 180.0 * pitch_ ) / 3.141592; } + + inline float pitch( ) const { return pitch_; } + + inline void setRoll( float roll ){ roll_ = roll; + if ( roll_ < 1.0 ) roll_ = 1000.0 * ( 180.0 * roll_ ) / 3.141592; } + + inline float roll( ) const { return roll_; } + + inline void setDragFactor( float drag ){ dragFactor_ = drag; } + inline float dragFactor( ) const { return dragFactor_; } + + virtual Ogre::Real maxSpeed() const { return 0.0; } +protected: + Uint32 armor_; + + Ogre::Real yaw_; + Ogre::Real pitch_; + Ogre::Real roll_; + + Ogre::Real dragFactor_; +}; + +} // namespace OpenGate + +#endif //_OPENGATE_MOVABLE__H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2010-01-02 15:25:57
|
Revision: 1172 http://opengate.svn.sourceforge.net/opengate/?rev=1172&view=rev Author: egore Date: 2010-01-02 15:25:51 +0000 (Sat, 02 Jan 2010) Log Message: ----------- Continue moving out the model to its own directory Modified Paths: -------------- trunk/src/EntityManager.cpp trunk/src/Makefile.am trunk/src/Moveable.h trunk/src/SectorStationObject.cpp trunk/src/model/Entity.cpp trunk/src/model/Entity.h Added Paths: ----------- trunk/src/model/MeshEntity.cpp trunk/src/model/MeshEntity.h trunk/src/model/Station.h Modified: trunk/src/EntityManager.cpp =================================================================== --- trunk/src/EntityManager.cpp 2010-01-02 15:10:50 UTC (rev 1171) +++ trunk/src/EntityManager.cpp 2010-01-02 15:25:51 UTC (rev 1172) @@ -26,8 +26,8 @@ #include "Equipment.h" #include "Missile.h" #include "Vessel.h" +#include "Station.h" - #include <OgreArchive.h> #include <OgreArchiveManager.h> #include <OgreFileSystem.h> Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2010-01-02 15:10:50 UTC (rev 1171) +++ trunk/src/Makefile.am 2010-01-02 15:25:51 UTC (rev 1172) @@ -39,6 +39,9 @@ DockedState.cpp \ model/Entity.h \ model/Entity.cpp \ + model/MeshEntity.h \ + model/MeshEntity.cpp \ + model/Station.h \ EntityManager.h \ EntityManager.cpp \ Equipment.h \ Modified: trunk/src/Moveable.h =================================================================== --- trunk/src/Moveable.h 2010-01-02 15:10:50 UTC (rev 1171) +++ trunk/src/Moveable.h 2010-01-02 15:25:51 UTC (rev 1172) @@ -21,7 +21,7 @@ #ifndef _OPENGATE_MOVABLE__H #define _OPENGATE_MOVABLE__H -#include "Entity.h" +#include "MeshEntity.h" namespace OpenGate{ Modified: trunk/src/SectorStationObject.cpp =================================================================== --- trunk/src/SectorStationObject.cpp 2010-01-02 15:10:50 UTC (rev 1171) +++ trunk/src/SectorStationObject.cpp 2010-01-02 15:25:51 UTC (rev 1172) @@ -22,7 +22,7 @@ #include "commonWithOgre.h" -#include "Entity.h" +#include "Station.h" #include "Sector.h" #include "SectorStationPadObject.h" Modified: trunk/src/model/Entity.cpp =================================================================== --- trunk/src/model/Entity.cpp 2010-01-02 15:10:50 UTC (rev 1171) +++ trunk/src/model/Entity.cpp 2010-01-02 15:25:51 UTC (rev 1172) @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * + * Copyright (C) 2006-2010 by OpenGate development team * * eg...@us... * * * * This program is free software; you can redistribute it and/or modify * @@ -140,70 +140,4 @@ setFactionName_( ResourceManager::getSingleton().factionName( factionID_ ) ); } -MeshEntity::MeshEntity(): Entity(){ - baseSize_ = Ogre::Vector3::ZERO; - baseYaw_ = 0.0; - basePitch_ = 0.0; - baseRoll_ = 0.0; - baseScale_ = 0.0; -} - -MeshEntity::~MeshEntity(){ - if ( !pMesh_.isNull() ) Ogre::MeshManager::getSingleton().unload( pMesh_->getName() ); -} - -void MeshEntity::readPropertiesFromXML( TiXmlHandle & hRoot ){ - Entity::readPropertiesFromXML( hRoot ); - - readXMLNode< float >( hRoot, "base_yaw baseyaw", this, &OpenGate::MeshEntity::setBaseYaw, false ); - readXMLNode< float >( hRoot, "base_pitch basepitch", this, &OpenGate::MeshEntity::setBasePitch, false ); - readXMLNode< float >( hRoot, "base_roll baseroll", this, &OpenGate::MeshEntity::setBaseRoll, false ); - readXMLNode< float >( hRoot, "base_size basesize", this, &OpenGate::MeshEntity::setBaseSize, false ); - readXMLNode< float >( hRoot, "base_scale basescale", this, &OpenGate::MeshEntity::setBaseScale, false ); - - // readXMLNode< float >( hRoot, "basesize", this, &OpenGate::MeshEntity::setBaseSize, false ); - TiXmlElement * pElem; - - Ogre::Real length = 0; - pElem = hRoot.ChildElement( "length", 0 ).Element(); - if ( pElem ) length = toDouble( pElem->FirstChild()->Value() ); - - Ogre::Real width = 0; - pElem = hRoot.ChildElement( "width", 0 ).Element(); - if ( pElem ) width = toDouble( pElem->FirstChild()->Value() ); - - Ogre::Real height = 0; - pElem = hRoot.ChildElement( "height", 0 ).Element(); - if ( pElem ) height = toDouble( pElem->FirstChild()->Value() ); - - if ( length > 0 && width > 0 && height > 0 ) this->setBaseSizeVector( width, height, length ); - - if ( !readXMLNode< std::string >( hRoot, "mesh", this, &OpenGate::MeshEntity::setMesh, false ) ){ - - try { - setMesh( createMeshName( name_ ) ); - } catch( Ogre::Exception & e ){ - LogManager::getSingleton().warn( e.what() ); - } - } -} - -std::string MeshEntity::createMeshName( const std::string & meshName ){ - return strReplaceBlankWithUnderscore( strCopyToLowerCase( meshName ) ); -} - -void MeshEntity::setMesh( const std::string & meshName ){ - meshName_ = meshName.substr( 0, meshName.rfind( ".mesh" ) ) + ".mesh" ; - - pMesh_ = Ogre::MeshManager::getSingleton().load( meshName_, - "Opengate", - Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, - Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, - true, true); - - unsigned short src = 0, dest = 0; - if ( !pMesh_->suggestTangentVectorBuildParams( Ogre::VES_TANGENT, src, dest) ) { - pMesh_->buildTangentVectors( Ogre::VES_TANGENT, src, dest); - } -} } // namespace OpenGate Modified: trunk/src/model/Entity.h =================================================================== --- trunk/src/model/Entity.h 2010-01-02 15:10:50 UTC (rev 1171) +++ trunk/src/model/Entity.h 2010-01-02 15:25:51 UTC (rev 1172) @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * + * Copyright (C) 2006-2010 by OpenGate development team * * eg...@us... * * * * This program is free software; you can redistribute it and/or modify * @@ -173,80 +173,6 @@ //std::vector < Property< class ValueType > * > properties_; }; -/*! - * \brief A MeshEntity is an entity that also has a mesh associated. - * - * Entities like vessels are mesh entities, as you can also see them flying - * around in space. Stuff like cargo, which does not have a 3d model (aka mesh) - * therefore is no MeshEntity, but an Entity. - */ -class MeshEntity : public Entity{ -public: - MeshEntity(); - - virtual ~MeshEntity(); - - void readPropertiesFromXML( TiXmlHandle & hRoot ); - - /*! Base sizes are necessary for resizing the ogremesh */ - inline void setBaseSizeVector( float length, float width, float height ){ - baseSize_[ 0 ] = length; baseSize_[ 1 ] = width; baseSize_[ 2 ] = height; } - - /*! If size is a scalar value, the length of the entity.*/ - inline void setBaseSize( float size ){ baseSize_[ 2 ] = size; } - inline const Ogre::Vector3 & baseSize( ) const { return baseSize_; } - - /*! If size is a scalar value, the length of the entity.*/ - inline void setBaseScale( float scale ){ baseScale_ = scale; } - inline const Ogre::Real baseScale( ) const { return baseScale_; } - - /*! Base sizes are necessary for resizing the ogremesh */ - inline void setBaseYaw( Ogre::Real baseYaw ){ baseYaw_ = baseYaw; } - inline Ogre::Real baseYaw( ) const { return baseYaw_; } - - /*! Base sizes are necessary for resizing the ogremesh */ - inline void setBasePitch( Ogre::Real basePitch ){ basePitch_ = basePitch; } - inline Ogre::Real basePitch( ) const { return basePitch_; } - - /*! Base sizes are necessary for resizing the ogremesh */ - inline void setBaseRoll( Ogre::Real baseRoll ){ baseRoll_ = baseRoll; } - inline Ogre::Real baseRoll( ) const { return baseRoll_; } - - void setMesh( const std::string & meshName ); - inline const std::string & meshName( ) const { return meshName_; } - virtual std::string createMeshName( const std::string & meshName ); - Ogre::MeshPtr & meshPtr( ){ return pMesh_; } - -protected: - //** geometric parameters - Ogre::Vector3 baseSize_; - Ogre::Real baseYaw_; - Ogre::Real basePitch_; - Ogre::Real baseRoll_; - Ogre::Real baseScale_; - - Ogre::MeshPtr pMesh_; - - std::string meshName_; -}; - -//! -/*!*/ -class Station : public MeshEntity{ -public: - Station( ) : MeshEntity(){ - rtti_ = STATION; - } - - virtual ~Station( ){} - - void readPropertiesFromXML( TiXmlHandle & hRoot ){ - MeshEntity::readPropertiesFromXML( hRoot ); - } - -protected: -}; - } // namespace OpenGate #endif //_OPENGATE_ENTITY_H Added: trunk/src/model/MeshEntity.cpp =================================================================== --- trunk/src/model/MeshEntity.cpp (rev 0) +++ trunk/src/model/MeshEntity.cpp 2010-01-02 15:25:51 UTC (rev 1172) @@ -0,0 +1,96 @@ +/*************************************************************************** + * Copyright (C) 2006-2010 by OpenGate development team * + * eg...@us... * + * * + * 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 "MeshEntity.h" + +#include "LogManager.h" + +#include <OgreMeshManager.h> + +namespace OpenGate{ + +MeshEntity::MeshEntity(): Entity(){ + baseSize_ = Ogre::Vector3::ZERO; + baseYaw_ = 0.0; + basePitch_ = 0.0; + baseRoll_ = 0.0; + baseScale_ = 0.0; +} + +MeshEntity::~MeshEntity(){ + if ( !pMesh_.isNull() ) Ogre::MeshManager::getSingleton().unload( pMesh_->getName() ); +} + +void MeshEntity::readPropertiesFromXML( TiXmlHandle & hRoot ){ + Entity::readPropertiesFromXML( hRoot ); + + readXMLNode< float >( hRoot, "base_yaw baseyaw", this, &OpenGate::MeshEntity::setBaseYaw, false ); + readXMLNode< float >( hRoot, "base_pitch basepitch", this, &OpenGate::MeshEntity::setBasePitch, false ); + readXMLNode< float >( hRoot, "base_roll baseroll", this, &OpenGate::MeshEntity::setBaseRoll, false ); + readXMLNode< float >( hRoot, "base_size basesize", this, &OpenGate::MeshEntity::setBaseSize, false ); + readXMLNode< float >( hRoot, "base_scale basescale", this, &OpenGate::MeshEntity::setBaseScale, false ); + + // readXMLNode< float >( hRoot, "basesize", this, &OpenGate::MeshEntity::setBaseSize, false ); + TiXmlElement * pElem; + + Ogre::Real length = 0; + pElem = hRoot.ChildElement( "length", 0 ).Element(); + if ( pElem ) length = toDouble( pElem->FirstChild()->Value() ); + + Ogre::Real width = 0; + pElem = hRoot.ChildElement( "width", 0 ).Element(); + if ( pElem ) width = toDouble( pElem->FirstChild()->Value() ); + + Ogre::Real height = 0; + pElem = hRoot.ChildElement( "height", 0 ).Element(); + if ( pElem ) height = toDouble( pElem->FirstChild()->Value() ); + + if ( length > 0 && width > 0 && height > 0 ) this->setBaseSizeVector( width, height, length ); + + if ( !readXMLNode< std::string >( hRoot, "mesh", this, &OpenGate::MeshEntity::setMesh, false ) ){ + + try { + setMesh( createMeshName( name_ ) ); + } catch( Ogre::Exception & e ){ + LogManager::getSingleton().warn( e.what() ); + } + } +} + +std::string MeshEntity::createMeshName( const std::string & meshName ){ + return strReplaceBlankWithUnderscore( strCopyToLowerCase( meshName ) ); +} + +void MeshEntity::setMesh( const std::string & meshName ){ + meshName_ = meshName.substr( 0, meshName.rfind( ".mesh" ) ) + ".mesh" ; + + pMesh_ = Ogre::MeshManager::getSingleton().load( meshName_, + "Opengate", + Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, + Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, + true, true); + + unsigned short src = 0, dest = 0; + if ( !pMesh_->suggestTangentVectorBuildParams( Ogre::VES_TANGENT, src, dest) ) { + pMesh_->buildTangentVectors( Ogre::VES_TANGENT, src, dest); + } +} + +} // namespace OpenGate Added: trunk/src/model/MeshEntity.h =================================================================== --- trunk/src/model/MeshEntity.h (rev 0) +++ trunk/src/model/MeshEntity.h 2010-01-02 15:25:51 UTC (rev 1172) @@ -0,0 +1,88 @@ +/*************************************************************************** + * Copyright (C) 2006-2010 by OpenGate development team * + * eg...@us... * + * * + * 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 _OPENGATE_MESH_ENTITY_H +#define _OPENGATE_MESH_ENTITY_H + +#include "Entity.h" + +namespace OpenGate{ + +/*! + * \brief A MeshEntity is an entity that also has a mesh associated. + * + * Entities like vessels are mesh entities, as you can also see them flying + * around in space. Stuff like cargo, which does not have a 3d model (aka mesh) + * therefore is no MeshEntity, but an Entity. + */ +class MeshEntity : public Entity{ +public: + MeshEntity(); + + virtual ~MeshEntity(); + + void readPropertiesFromXML( TiXmlHandle & hRoot ); + + /*! Base sizes are necessary for resizing the ogremesh */ + inline void setBaseSizeVector( float length, float width, float height ){ + baseSize_[ 0 ] = length; baseSize_[ 1 ] = width; baseSize_[ 2 ] = height; } + + /*! If size is a scalar value, the length of the entity.*/ + inline void setBaseSize( float size ){ baseSize_[ 2 ] = size; } + inline const Ogre::Vector3 & baseSize( ) const { return baseSize_; } + + /*! If size is a scalar value, the length of the entity.*/ + inline void setBaseScale( float scale ){ baseScale_ = scale; } + inline const Ogre::Real baseScale( ) const { return baseScale_; } + + /*! Base sizes are necessary for resizing the ogremesh */ + inline void setBaseYaw( Ogre::Real baseYaw ){ baseYaw_ = baseYaw; } + inline Ogre::Real baseYaw( ) const { return baseYaw_; } + + /*! Base sizes are necessary for resizing the ogremesh */ + inline void setBasePitch( Ogre::Real basePitch ){ basePitch_ = basePitch; } + inline Ogre::Real basePitch( ) const { return basePitch_; } + + /*! Base sizes are necessary for resizing the ogremesh */ + inline void setBaseRoll( Ogre::Real baseRoll ){ baseRoll_ = baseRoll; } + inline Ogre::Real baseRoll( ) const { return baseRoll_; } + + void setMesh( const std::string & meshName ); + inline const std::string & meshName( ) const { return meshName_; } + virtual std::string createMeshName( const std::string & meshName ); + Ogre::MeshPtr & meshPtr( ){ return pMesh_; } + +protected: + //** geometric parameters + Ogre::Vector3 baseSize_; + Ogre::Real baseYaw_; + Ogre::Real basePitch_; + Ogre::Real baseRoll_; + Ogre::Real baseScale_; + + Ogre::MeshPtr pMesh_; + + std::string meshName_; +}; + +} // namespace OpenGate + +#endif //_OPENGATE_MESH_ENTITY_H + Added: trunk/src/model/Station.h =================================================================== --- trunk/src/model/Station.h (rev 0) +++ trunk/src/model/Station.h 2010-01-02 15:25:51 UTC (rev 1172) @@ -0,0 +1,47 @@ +/*************************************************************************** + * Copyright (C) 2006-2010 by OpenGate development team * + * eg...@us... * + * * + * 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 _OPENGATE_STATION_H +#define _OPENGATE_STATION_H + +#include "MeshEntity.h" + +namespace OpenGate { + +//! +/*!*/ +class Station : public MeshEntity{ +public: + Station( ) : MeshEntity(){ + rtti_ = STATION; + } + + virtual ~Station( ){} + + void readPropertiesFromXML( TiXmlHandle & hRoot ){ + MeshEntity::readPropertiesFromXML( hRoot ); + } + +protected: +}; + +} // namespace OpenGate + +#endif // _OPENGATE_STATION_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2010-01-02 15:11:02
|
Revision: 1171 http://opengate.svn.sourceforge.net/opengate/?rev=1171&view=rev Author: spom_spom Date: 2010-01-02 15:10:50 +0000 (Sat, 02 Jan 2010) Log Message: ----------- Add truster-trail Modified Paths: -------------- trunk/data/asteroids/asteroid.material trunk/data/materials/advancedMaterials.material trunk/data/misc/misc.particle trunk/data/misc/test.sector trunk/src/ConfigDialog.cpp trunk/src/Console.cpp trunk/src/GameStateManager.cpp trunk/src/GameStateManager.h trunk/src/GunObject.cpp trunk/src/GunObject.h trunk/src/KeyMap.cpp trunk/src/KeyMap.h trunk/src/MarketDialog.cpp trunk/src/ResourceManager.cpp trunk/src/ResourceManager.h trunk/src/Sector.cpp trunk/src/Sector.h trunk/src/SectorAvatarObject.cpp trunk/src/SectorMissileObject.cpp trunk/src/SectorMissileObject.h trunk/src/UnDockedState.cpp Modified: trunk/data/asteroids/asteroid.material =================================================================== --- trunk/data/asteroids/asteroid.material 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/data/asteroids/asteroid.material 2010-01-02 15:10:50 UTC (rev 1171) @@ -1,5 +1,179 @@ -material Asteroid/BumpMapping : OpenGate/BumpMapping +material OpenGate/NormalMapping { + + // This is the preferred technique which uses both vertex and + // fragment programs, supports coloured lights + technique vpfp + { + scheme vpfp + pass + { + vertex_program_ref BasicVertexPrograms/AmbientOneTextureUnified + { + param_named_auto ambient ambient_light_colour + } + + } + pass + { + // base colours, not needed for rendering, but as information + // to lighting pass categorisation routine + ambient 1 1 1 1 + + // do this for each light + iteration once_per_light + + scene_blend add + + // Vertex program reference + vertex_program_ref BumpMapVP + { + param_named_auto lightPosition light_position_object_space 0 + } + + // Fragment program + fragment_program_ref BumpMapFP + { + param_named_auto lightDiffuse light_diffuse_colour 0 + } + + // Base bump map + texture_unit + { + texture_alias ImageBumpMap + colour_op replace + } + // Normalisation cube map + texture_unit + { + cubic_texture nm.png combinedUVW + tex_coord_set 1 + tex_address_mode clamp + } + } + + // Decal pass + pass + { + // base colours, not needed for rendering, but as information + // to lighting pass categorisation routine + lighting off + // Really basic vertex program + // NB we don't use fixed function here because GL does not like + // mixing fixed function and vertex programs, depth fighting can + // be an issue + vertex_program_ref BasicVertexPrograms/AmbientOneTextureUnified + { + param_named ambient float4 1 1 1 1 + } + scene_blend dest_colour zero + texture_unit + { + texture_alias Image + } + + } + } + + // This is the fallback which cards which don't have fragment program support will use + // Note that it still requires vertex program support + technique vp + { + scheme vpOnly + // Base ambient pass + pass + { + // base colours, not needed for rendering, but as information + // to lighting pass categorisation routine + ambient 1 1 1 + diffuse 0 0 0 + specular 0 0 0 0 + // Really basic vertex program + // NB we don't use fixed function here because GL does not like + // mixing fixed function and vertex programs, depth fighting can + // be an issue + vertex_program_ref BasicVertexPrograms/AmbientOneTextureUnified + { + param_named_auto ambient ambient_light_colour + } + + } + // Now do the lighting pass + // NB we don't do decal texture here because this is repeated per light + pass + { + // base colours, not needed for rendering, but as information + // to lighting pass categorisation routine + ambient 0 0 0 + // do this for each light + iteration once_per_light + + + scene_blend add + + // Vertex program reference + vertex_program_ref BumpMapVP + { + param_named_auto lightPosition light_position_object_space 0 + } + + // Base bump map + texture_unit + { + texture_alias ImageBumpMap + colour_op replace + } + // Normalisation cube map, with dot product on bump map + texture_unit + { + cubic_texture nm.png combinedUVW + tex_coord_set 1 + tex_address_mode clamp + colour_op_ex dotproduct src_texture src_current + colour_op_multipass_fallback dest_colour zero + } + } + + // Decal pass + pass + { + lighting off + // Really basic vertex program + // NB we don't use fixed function here because GL does not like + // mixing fixed function and vertex programs, depth fighting can + // be an issue + vertex_program_ref BasicVertexPrograms/AmbientOneTextureUnified + { + param_named ambient float4 1 1 1 1 + } + scene_blend dest_colour zero + texture_unit + { + texture_alias Image + } + + } + } + // This is the fallback which cards which don't have fragment program and vertex program support + technique fallback + { + scheme Default + pass + { + ambient 0.500000 0.500000 0.500000 1.000000 + diffuse 0.900000 0.900000 0.900000 1.000000 + emissive 0.500000 0.500000 0.500000 1.000000 + texture_unit + { + texture_alias ImageFallback + } + } + } +} + + +material Asteroid/NormalMapping : OpenGate/NormalMapping +{ set_texture_alias Image asteroid.png set_texture_alias ImageBumpMap asteroidBump.png set_texture_alias ImageFallback asteroid.png @@ -15,7 +189,7 @@ { // ambient 0.500000 0.500000 0.500000 1.000000 // diffuse 0.900000 0.900000 0.900000 1.000000 - emissive 0.500000 0.500000 0.500000 1.000000 + emissive 1.000000 1.000000 1.00000 1.000000 texture_unit { texture asteroid.png Modified: trunk/data/materials/advancedMaterials.material =================================================================== --- trunk/data/materials/advancedMaterials.material 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/data/materials/advancedMaterials.material 2010-01-02 15:10:50 UTC (rev 1171) @@ -1,186 +0,0 @@ -material OpenGate/BumpMapping -{ - - // This is the preferred technique which uses both vertex and - // fragment programs, supports coloured lights - technique vpfp - { - scheme vpfp - // Base ambient pass - pass - { - // base colours, not needed for rendering, but as information - // to lighting pass categorisation routine -// ambient 1 1 1 -// diffuse 0 0 9 -// specular 0 0 1 1 -// emissive 0 0 1 1 - // Really basic vertex program - // NB we don't use fixed function here because GL does not like - // mixing fixed function and vertex programs, depth fighting can - // be an issue - vertex_program_ref BasicVertexPrograms/AmbientOneTextureUnified - { - param_named_auto ambient ambient_light_colour - } - - } - // Now do the lighting pass - // NB we don't do decal texture here because this is repeated per light - pass - { - // base colours, not needed for rendering, but as information - // to lighting pass categorisation routine - ambient 0 0 1 - - // do this for each light - iteration once_per_light - - scene_blend add - - // Vertex program reference - vertex_program_ref BumpMapVP - { - param_named_auto lightPosition light_position_object_space 0 - } - - // Fragment program - fragment_program_ref BumpMapFP - { - param_named_auto lightDiffuse light_diffuse_colour 0 - } - - // Base bump map - texture_unit - { - texture_alias ImageBumpMap - colour_op replace - } - // Normalisation cube map - texture_unit - { - cubic_texture nm.png combinedUVW - tex_coord_set 1 - tex_address_mode clamp - } - } - - // Decal pass - pass - { - // base colours, not needed for rendering, but as information - // to lighting pass categorisation routine - lighting off - // Really basic vertex program - // NB we don't use fixed function here because GL does not like - // mixing fixed function and vertex programs, depth fighting can - // be an issue - vertex_program_ref BasicVertexPrograms/AmbientOneTextureUnified - { - param_named ambient float4 1 1 1 1 - } - scene_blend dest_colour zero - texture_unit - { - texture_alias Image - } - - } - } - - // This is the fallback which cards which don't have fragment program support will use - // Note that it still requires vertex program support - technique vp - { - scheme vpOnly - // Base ambient pass - pass - { - // base colours, not needed for rendering, but as information - // to lighting pass categorisation routine - ambient 1 1 1 - diffuse 0 0 0 - specular 0 0 0 0 - // Really basic vertex program - // NB we don't use fixed function here because GL does not like - // mixing fixed function and vertex programs, depth fighting can - // be an issue - vertex_program_ref BasicVertexPrograms/AmbientOneTextureUnified - { - param_named_auto ambient ambient_light_colour - } - - } - // Now do the lighting pass - // NB we don't do decal texture here because this is repeated per light - pass - { - // base colours, not needed for rendering, but as information - // to lighting pass categorisation routine - ambient 0 0 0 - // do this for each light - iteration once_per_light - - - scene_blend add - - // Vertex program reference - vertex_program_ref BumpMapVP - { - param_named_auto lightPosition light_position_object_space 0 - } - - // Base bump map - texture_unit - { - texture_alias ImageBumpMap - colour_op replace - } - // Normalisation cube map, with dot product on bump map - texture_unit - { - cubic_texture nm.png combinedUVW - tex_coord_set 1 - tex_address_mode clamp - colour_op_ex dotproduct src_texture src_current - colour_op_multipass_fallback dest_colour zero - } - } - - // Decal pass - pass - { - lighting off - // Really basic vertex program - // NB we don't use fixed function here because GL does not like - // mixing fixed function and vertex programs, depth fighting can - // be an issue - vertex_program_ref BasicVertexPrograms/AmbientOneTextureUnified - { - param_named ambient float4 1 1 1 1 - } - scene_blend dest_colour zero - texture_unit - { - texture_alias Image - } - - } - } - // This is the fallback which cards which don't have fragment program and vertex program support - technique fallback - { - scheme Default - pass - { - ambient 0.500000 0.500000 0.500000 1.000000 - diffuse 0.900000 0.900000 0.900000 1.000000 - emissive 0.500000 0.500000 0.500000 1.000000 - texture_unit - { - texture_alias ImageFallback - } - } - } -} - Modified: trunk/data/misc/misc.particle =================================================================== --- trunk/data/misc/misc.particle 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/data/misc/misc.particle 2010-01-02 15:10:50 UTC (rev 1171) @@ -39,3 +39,39 @@ } } +particle_system OpenGate/ThrustTrail +{ + material OpenGate/Space/Dust + particle_width 0.5 + particle_height 0.5 + cull_each true + quota 1000 + billboard_type oriented_self + //billboard_rotation_type vertex + + //billboard_type perpendicular_common + //billboard_type perpendicular_self + //common_direction 0 0 -1 + //self_direction 0 0 -1 + //self_up_vector 0 0 1 + + // Area emitter + emitter Ellipsoid{ + + time_to_live 3 + colour 1.0 1.0 1.0 + emission_rate 333 + velocity 0.001 + width 1 + height 1 + depth 5 + } + + // Fader + affector ColourFader + { + red -0.333 + green -0.333 + blue -0.333 + } +} Modified: trunk/data/misc/test.sector =================================================================== --- trunk/data/misc/test.sector 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/data/misc/test.sector 2010-01-02 15:10:50 UTC (rev 1171) @@ -13,10 +13,10 @@ <sectorobject name="astro with bump"> <position y="0" x="-250" z="440"></position> <scale y="20" x="20" z="20"></scale> - <entity meshFile="asteroid01.mesh" material-0="Asteroid/BumpMapping" numSubEntities="1"></entity> + <entity meshFile="asteroid01.mesh" material-0="Asteroid/NormalMapping" numSubEntities="1"></entity> </sectorobject> <sectorobject name="astro without bump"> - <position y="0" x="-250" z="500"></position> + <position y="100" x="-250" z="500"></position> <scale y="20" x="20" z="20"></scale> <entity meshFile="asteroid01.mesh" material-0="Asteroid" numSubEntities="1"></entity> </sectorobject> Modified: trunk/src/ConfigDialog.cpp =================================================================== --- trunk/src/ConfigDialog.cpp 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/src/ConfigDialog.cpp 2010-01-02 15:10:50 UTC (rev 1171) @@ -66,13 +66,13 @@ bool ConfigDialog::handleControlsButton_( const CEGUI::EventArgs & e ){ activeWindow_ = static_cast<CEGUI::Listbox*>( CEGUI::WindowManager::getSingleton().getWindow( "Config/Controls" ) ); - - KeyMap::KeyBindingsMap keyBindings = resources_->keymap()->unDockedKeyBindings(); + + KeyMap::KeyBindingsMap keyBindings = resources_->keyMap()->unDockedKeyBindings(); uint count = 0; - + for ( KeyMap::KeyBindingsMap::iterator it = keyBindings.begin(); it != keyBindings.end(); it ++ ){ CEGUI::Window *b; - + if ( CEGUI::WindowManager::getSingleton().isWindowPresent( activeWindow_->getName() + it->first ) ){ b = CEGUI::WindowManager::getSingleton().getWindow( activeWindow_->getName() + it->first ); } else { @@ -87,25 +87,25 @@ b->show(); } - + if ( lastActiveWindow_ ) lastActiveWindow_->hide(); activeWindow_->show(); lastActiveWindow_ = activeWindow_; - + return true; } bool ConfigDialog::handleControlsCategoryButton_( const CEGUI::EventArgs & e ){ const CEGUI::WindowEventArgs & we = static_cast< const CEGUI::WindowEventArgs & >( e ); std::string category( we.window->getText().c_str() ); - + fillControlsWindow_( category ); return true; } void ConfigDialog::fillControlsWindow_( const std::string & category ){ CEGUI::Window * window = CEGUI::WindowManager::getSingleton().getWindow( "Config/Controls/Body" ); - + std::vector <CEGUI::Window *> removeList; for ( uint i = 0; i < window->getChildCount(); i ++ ) { removeList.push_back( window->getChildAtIdx( i ) ); @@ -114,8 +114,8 @@ CEGUI::WindowManager::getSingleton().destroyWindow( removeList[ i ] ); } //window->show(); - - std::map < std::string, std::pair< uint, uint > > keyBindings( resources_->keymap()->unDockedKeyBindings()[ category ] ); + + std::map < std::string, std::pair< uint, uint > > keyBindings( resources_->keyMap()->unDockedKeyBindings()[ category ] ); uint count = 0; double x = 0.0, y; for ( std::map < std::string, std::pair< uint, uint > >::iterator it = keyBindings.begin(); it != keyBindings.end(); it ++ ){ @@ -133,7 +133,7 @@ renameClonedWindows( b, keyWindowName ); window->addChildWindow( b ); - + y = count * 30.0; if ( y > window->getPixelSize().d_height - 30.0 ){ x = b->getPixelSize().d_width + 10; y = 0.0; @@ -142,14 +142,14 @@ b->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0, x ), CEGUI::UDim( 0.0, y ) ) ); CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/Name" )->setProperty( "Text", keyName ); - CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton1" )->setProperty( "Text", - resources_->keymap()->keycodeName( it->second.first ) ); - CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton2" )->setProperty( "Text", - resources_->keymap()->keycodeName( it->second.second ) ); + CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton1" )->setProperty( "Text", + resources_->keyMap()->keycodeName( it->second.first ) ); + CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton2" )->setProperty( "Text", + resources_->keyMap()->keycodeName( it->second.second ) ); - BIND_CEGUI_EVENT( CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton1" ), + BIND_CEGUI_EVENT( CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton1" ), CEGUI::PushButton::EventKeyDown, ConfigDialog::handleControlsKey1Button_ ); - BIND_CEGUI_EVENT( CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton2" ), + BIND_CEGUI_EVENT( CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton2" ), CEGUI::PushButton::EventKeyDown, ConfigDialog::handleControlsKey2Button_ ); } count ++; @@ -160,21 +160,21 @@ bool ConfigDialog::handleControlsKeyButton_( const CEGUI::EventArgs & e, uint key ){ const CEGUI::WindowEventArgs & we = static_cast< const CEGUI::WindowEventArgs & >( e ); CEGUI::Window *b = we.window->getParent(); - - uint keycode = resources_->keymap()->lastKeycode(); - if ( resources_->keymap()->lastKeycode() == OIS::KC_ESCAPE ) return true; - - if ( !resources_->keymap()->haveKeyBinding( keycode ) ){ - CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton" + toStr( key ) )->setProperty( "Text", - resources_->keymap()->keycodeName( keycode ) ); - - - resources_->keymap()->setKeyBinding( CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/Name" )->getProperty( "Text").c_str(), keycode, key ); + + uint keycode = resources_->keyMap()->lastKeycode(); + if ( resources_->keyMap()->lastKeycode() == OIS::KC_ESCAPE ) return true; + + if ( !resources_->keyMap()->haveKeyBinding( keycode ) ){ + CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton" + toStr( key ) )->setProperty( "Text", + resources_->keyMap()->keycodeName( keycode ) ); + + + resources_->keyMap()->setKeyBinding( CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/Name" )->getProperty( "Text").c_str(), keycode, key ); } else { - resources_->log().warn( "there is allready a binding for " + resources_->keymap()->keycodeName( keycode ) ); + resources_->log().warn( "there is allready a binding for " + resources_->keyMap()->keycodeName( keycode ) ); } - - + + return true; } @@ -183,7 +183,7 @@ //std::cout << "ConfigDialog::handleCreditsButton_( const CEGUI::EventArgs & e ){" << std::endl; CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"Config/Credits/Header" ) ->setProperty("Text", "Credits" ); - + activeWindow_ = static_cast<CEGUI::Listbox*> (CEGUI::WindowManager::getSingleton().getWindow( "Config/Credits/Body" ) ); fillCreditsWindow_( dynamic_cast<CEGUI::Listbox*>( activeWindow_ ) ); if ( lastActiveWindow_ ) lastActiveWindow_->hide(); @@ -206,7 +206,7 @@ for ( uint i = 0; i < row.size(); i ++ ){ str += row[ i ] + " "; } - CEGUI::ListboxTextItem * item = new CEGUI::ListboxTextItem( str ); + CEGUI::ListboxTextItem * item = new CEGUI::ListboxTextItem( str ); window->addItem ( item ); } window->ensureItemIsVisible( window->getItemCount() ); Modified: trunk/src/Console.cpp =================================================================== --- trunk/src/Console.cpp 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/src/Console.cpp 2010-01-02 15:10:50 UTC (rev 1171) @@ -18,15 +18,15 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include "Console.h" +#include "Console.h" -#include "common.h" +#include "common.h" -#include "ResourceManager.h" -// #include "GameState.h" -#include "GameStateManager.h" +#include "ResourceManager.h" +// #include "GameState.h" +#include "GameStateManager.h" -#include "LogManager.h" +#include "LogManager.h" #include "networkClient.h" #include "KeyMap.h" @@ -38,7 +38,7 @@ namespace OpenGate{ -Console::Console( ) +Console::Console( ) : rootWindow_( CEGUI::WindowManager::getSingleton().loadWindowLayout( "opengateConsole.layout" ) ), resources_( ResourceManager::getSingletonPtr() ) { @@ -48,13 +48,13 @@ listBox_ = static_cast<CEGUI::Listbox*> (CEGUI::WindowManager::getSingleton().getWindow( "ConsoleList" ) ); BIND_CEGUI_EVENT( editBox_, CEGUI::Editbox::EventTextAccepted, Console::handleEditTextAccepted ); -} +} -Console::~Console(){ +Console::~Console(){ LogManager::getSingleton().setConsole( NULL ); InputManager::getSingleton().removeKeyListener( "ConsoleKeyListener" ); CEGUI::WindowManager::getSingleton().destroyWindow( rootWindow_ ); -} +} void Console::show( ){ visible_ = true; @@ -67,7 +67,7 @@ rootWindow_->hide(); } -void Console::start( ){ +void Console::start( ){ if ( resources_->guiSystem ){ if ( resources_->guiSystem->getGUISheet() ){ resources_->guiSystem->getGUISheet()->addChildWindow( rootWindow_ ); @@ -78,7 +78,7 @@ show(); } -void Console::stop( ){ +void Console::stop( ){ if ( resources_->guiSystem ){ if ( resources_->guiSystem->getGUISheet() ){ resources_->guiSystem->getGUISheet()->removeChildWindow( rootWindow_ ); @@ -87,13 +87,13 @@ InputManager::getSingleton().removeKeyListener( "ConsoleKeyListener" ); } -bool Console::frameStarted( const Ogre::FrameEvent & evt ){ +bool Console::frameStarted( const Ogre::FrameEvent & evt ){ return true; } -bool Console::frameEnded( const Ogre::FrameEvent & evt ){ - return true; -} +bool Console::frameEnded( const Ogre::FrameEvent & evt ){ + return true; +} bool Console::handleResize( const CEGUI::EventArgs & e ){ @@ -125,42 +125,42 @@ return true; } -bool Console::keyPressed( const OIS::KeyEvent & e ){ - if ( e.key == OIS::KC_LCONTROL) resources_->keymap()->setGlobalKeyModifier( KEY_CONTROL ); - if ( e.key == OIS::KC_RCONTROL) resources_->keymap()->setGlobalKeyModifier( KEY_CONTROL ); - if ( e.key == OIS::KC_LSHIFT) resources_->keymap()->setGlobalKeyModifier( KEY_SHIFT ); - if ( e.key == OIS::KC_RSHIFT) resources_->keymap()->setGlobalKeyModifier( KEY_SHIFT ); - resources_->keymap()->setLastKeycode( e.key ); - +bool Console::keyPressed( const OIS::KeyEvent & e ){ + if ( e.key == OIS::KC_LCONTROL) resources_->keyMap()->setGlobalKeyModifier( KEY_CONTROL ); + if ( e.key == OIS::KC_RCONTROL) resources_->keyMap()->setGlobalKeyModifier( KEY_CONTROL ); + if ( e.key == OIS::KC_LSHIFT) resources_->keyMap()->setGlobalKeyModifier( KEY_SHIFT ); + if ( e.key == OIS::KC_RSHIFT) resources_->keyMap()->setGlobalKeyModifier( KEY_SHIFT ); + resources_->keyMap()->setLastKeycode( e.key ); + CEGUI::System::getSingleton().injectKeyDown( e.key ); CEGUI::System::getSingleton().injectChar( e.text ); //** for testings - if ( e.key == OIS::KC_BACK && resources_->keymap()->globalKeyModifier( ) == KEY_CONTROL ){ - resources_->renderWindow->setFullscreen( true, - resources_->renderWindow->getWidth(), + if ( e.key == OIS::KC_BACK && resources_->keyMap()->globalKeyModifier( ) == KEY_CONTROL ){ + resources_->renderWindow->setFullscreen( true, + resources_->renderWindow->getWidth(), resources_->renderWindow->getHeight() ); // resources_->renderWindow->resize( 1280, 1024 ); std::cout << "Fullscreen: " << resources_->renderWindow->isFullScreen() << std::endl; } - if ( (this->*resources_->keymap()->consoleKeyAction( e ))( true ) ) return true; + if ( (this->*resources_->keyMap()->consoleKeyAction( e ))( true ) ) return true; - return true; + return true; } -bool Console::keyReleased( const OIS::KeyEvent & e ){ +bool Console::keyReleased( const OIS::KeyEvent & e ){ CEGUI::System::getSingleton().injectKeyUp( e.key ); - if ( e.key == OIS::KC_LCONTROL ) resources_->keymap()->setGlobalKeyModifier( KEY_NONE ); - if ( e.key == OIS::KC_RCONTROL ) resources_->keymap()->setGlobalKeyModifier( KEY_NONE ); - if ( e.key == OIS::KC_LSHIFT ) resources_->keymap()->setGlobalKeyModifier( KEY_NONE ); - if ( e.key == OIS::KC_RSHIFT ) resources_->keymap()->setGlobalKeyModifier( KEY_NONE ); - + if ( e.key == OIS::KC_LCONTROL ) resources_->keyMap()->setGlobalKeyModifier( KEY_NONE ); + if ( e.key == OIS::KC_RCONTROL ) resources_->keyMap()->setGlobalKeyModifier( KEY_NONE ); + if ( e.key == OIS::KC_LSHIFT ) resources_->keyMap()->setGlobalKeyModifier( KEY_NONE ); + if ( e.key == OIS::KC_RSHIFT ) resources_->keyMap()->setGlobalKeyModifier( KEY_NONE ); + return true; } -bool Console::keyActionScreenshot( bool pressed ){ +bool Console::keyActionScreenshot( bool pressed ){ if ( pressed ){ std::string tmp( "screenshot" + LogManager::getSingleton().timeStamp() + ".png" ); ResourceManager::getSingleton().renderWindow->writeContentsToFile( tmp.c_str() ); @@ -172,7 +172,7 @@ return true; } -void Console::print( const std::string & t ){ +void Console::print( const std::string & t ){ CEGUI::colour col(1.0, 1.0, 1.0, 1.0); if ( t.find( "INFO:" ) == 0 ){ col = CEGUI::colour( 1.0, 1.0, 0.0, 1.0 ); @@ -192,27 +192,27 @@ if ( i * consoleLineLength_ + count > (int)t.size() ){ count = -1; } CEGUI::String text( t, i*consoleLineLength_, count ); - CEGUI::ListboxTextItem * item = new CEGUI::ListboxTextItem( text ); + CEGUI::ListboxTextItem * item = new CEGUI::ListboxTextItem( text ); item->setTextColours( col ); listBox_->addItem ( item ); listBox_->ensureItemIsVisible( listBox_->getItemCount() ); } -} +} - -void Console::addCommand( const std::string & command, void (GameStateManager::*ptr) ( const std::vector< std::string > & ), + +void Console::addCommand( const std::string & command, void (GameStateManager::*ptr) ( const std::vector< std::string > & ), const std::string & help ){ - commands_[ command ] = ptr; + commands_[ command ] = ptr; help_[ command ] = help; } -void Console::removeCommand( const std::string & command ){ +void Console::removeCommand( const std::string & command ){ if ( commands_.find( command ) != commands_.end() ){ - commands_.erase( commands_.find( command ) ); - help_.erase( help_.find( command ) ); + commands_.erase( commands_.find( command ) ); + help_.erase( help_.find( command ) ); } } - + void Console::printHelp( ){ LogManager::getSingleton().info( ("printHelp:") ); Modified: trunk/src/GameStateManager.cpp =================================================================== --- trunk/src/GameStateManager.cpp 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/src/GameStateManager.cpp 2010-01-02 15:10:50 UTC (rev 1171) @@ -27,6 +27,7 @@ #include "DockedState.h" #include "EntityManager.h" #include "InputManager.h" +#include "KeyMap.h" #include "networkClient.h" #include "OpcodeWrapper.h" #include "OpenALSoundManager.h" @@ -76,11 +77,11 @@ states_.pop_back(); } if ( resources_.avatar ) delete resources_.avatar; - + if ( resources_.collisionManager ) delete resources_.collisionManager; - + if ( configDialog_ ) delete configDialog_; - + if ( resources_.aiManager ) { log_->info( "Shutdown ai manager." ); delete resources_.aiManager; @@ -101,7 +102,7 @@ delete resources_.soundManager; resources_.soundManager = NULL; } - + if ( resources_.guiRenderer ) { log_->info( "Shutdown CEGUI manager." ); delete resources_.guiSystem; @@ -165,7 +166,7 @@ Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext(); std::cout << "Ressource: " << secName << std::endl; - + if ( secName == "Bootstrap" ){ for ( Ogre::ConfigFile::SettingsMultiMap::iterator i = settings->begin(); i != settings->end(); ++i ){ typeName = i->first; @@ -181,48 +182,51 @@ void GameStateManager::initLoadingVector(){ - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), - std::string >( &GameStateManager::initialiseOgreResources, - "initialise Ogre resources" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + std::string >( &GameStateManager::initialiseOgreResources, + "initialise Ogre resources" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::checkRenderSystemCapabilities, - "check render system capabilities" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + "check render system capabilities" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::initialiseCEGUIEngine, - "initialise CEGUI engine" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + "initialise CEGUI engine" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::initialiseInputManager, - "initialise input system" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + "initialise input system" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::initialiseConsole, - "initialise console" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + "initialise console" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::initialiseMiscResources, - "initialise opengate miscellaneous resources" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + "initialise opengate miscellaneous resources" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::initialiseSoundManager, - "initialise sound manager" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + "initialise sound manager" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::initialiseEntityManager, "initialise entity manager" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::initialiseAiManager, - "initialise ai manager" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + "initialise ai manager" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::createAvatar, - "create avatar" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + "create avatar" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::createConfigDialog, - "create configuration dialog" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + "create configuration dialog" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::createDockedState, - "create station" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + "create station" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::initialiseCollisionManager, - "create collision manager" ) ); - loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + "create collision manager" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), std::string >( &GameStateManager::createUnDockedState, - "create sector" ) ); + "create sector" ) ); + loadResourcesVector_.push_back( std::pair< bool (GameStateManager::*)( ), + std::string >( &GameStateManager::initialiseKeyMap, + "init keymap" ) ); } bool GameStateManager::initialiseAllResources( ){ @@ -260,7 +264,7 @@ resources_.console->addCommand( "/q", &GameStateManager::CMD_shutdown, "Shutting down the client. Shortcut for /quit" ); resources_.console->addCommand( "/quit", &GameStateManager::CMD_shutdown, "Shutting down the client" ); - resources_.console->addCommand( "/help", &GameStateManager::CMD_printHelp,"Show this help" ); + resources_.console->addCommand( "/help", &GameStateManager::CMD_printHelp,"Show this help" ); resources_.console->addCommand( "/time", &GameStateManager::CMD_printTime,"Show current system time" ); resources_.console->addCommand( "/spawn", &GameStateManager::CMD_spawnAi, "[name] Spawn ai subject. /spawn help show all available ships." ); resources_.console->addCommand( "/ai", &GameStateManager::CMD_ai, " [command] interact with aimanager. /ai help show all commands." ); @@ -287,7 +291,7 @@ resources_.collisionManager = new OpcodeCollisionDetection( &resources_ ); return true; } - + // bool GameStateManager::initialiseVesselManager(){ // vesselManager_ = new VesselManager( ); // vesselManager_->load( resources_.resourcePaths(), "ships" ); @@ -368,7 +372,7 @@ for ( std::list<Ogre::ResourceGroupManager::ResourceDeclaration>::iterator it = li.begin(); it != li.end(); it ++ ){ std::cout << (*it).resourceName << std::endl; }*/ - + return true; } @@ -384,7 +388,7 @@ // CEGUI::Scheme::setDefaultResourceGroup("schemes"); CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"opengate.scheme" ); resources_.guiSystem->setDefaultFont( (CEGUI::utf8*)"BlueHighway-12" ); - + // CEGUI::WindowFactoryManager::getSingleton() return true; } @@ -395,11 +399,16 @@ resources_.renderWindow->getCustomAttribute( "WINDOW", &hWnd ); resources_.inputManager->init( hWnd ); - resources_.inputManager->setWindowExtents( resources_.renderWindow->getWidth( ), + resources_.inputManager->setWindowExtents( resources_.renderWindow->getWidth( ), resources_.renderWindow->getHeight( ) ); return true; } +bool GameStateManager::initialiseKeyMap(){ + resources_.keyMap()->setDefaults( resources_.network->online() ); + return true; +} + void GameStateManager::switchConfigDialog( ){ if ( configDialog_->isVisible() ) { configDialog_->hide(); @@ -441,7 +450,7 @@ } } } -#endif +#endif resources_.ogreRoot()->renderOneFrame( ); } } @@ -548,8 +557,8 @@ shutdown(); } -void GameStateManager::CMD_printHelp( const std::vector < std::string > & argv ){ - resources_.console->printHelp(); +void GameStateManager::CMD_printHelp( const std::vector < std::string > & argv ){ + resources_.console->printHelp(); } void GameStateManager::CMD_printTime( const std::vector < std::string > & argv ){ @@ -561,7 +570,7 @@ void GameStateManager::CMD_ai( const std::vector < std::string > & argv ){ resources_.aiManager->cmd( argv ); } - + void GameStateManager::CMD_spawnAi( const std::vector < std::string > & argv ){ std::string aiName = "Squid"; if ( argv.size() > 1 ){ Modified: trunk/src/GameStateManager.h =================================================================== --- trunk/src/GameStateManager.h 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/src/GameStateManager.h 2010-01-02 15:10:50 UTC (rev 1171) @@ -59,10 +59,10 @@ /*! Init ogre root and call initialiseOgreEngine_. */ bool initialiseBootstrap( bool dialog ); - + /*! Init ogre bootstrap resoucees for the init state. */ bool initialiseBootstrapResources( ); - + /*! Init the callback list for loading the game resouces. */ void initLoadingVector(); @@ -71,7 +71,10 @@ bool initialiseOgreResources( ); bool initialiseCEGUIEngine( ); bool initialiseInputManager( ); - + + /*! Initialise Keymap, depending the online status. */ + bool initialiseKeyMap(); + bool initialiseConsole(); //** load id, rank matrix etc. @@ -106,7 +109,7 @@ /*! Get the active gamestate. */ GameState * activeState( ) { return stateStack_.back(); } - + /*! Change to a game state. This replaces the current game state with a new game state. The current game state ends before the new begins. */ void changeGameState( GameState * state ); @@ -115,7 +118,7 @@ /*! Pop a game state off the stack. This destroys the current game state and returns control to the previous game state. */ // void popGameState( ); - + void CMD_shutdown( const std::vector < std::string > & argv ); void CMD_printHelp( const std::vector < std::string > & argv ); void CMD_printTime( const std::vector < std::string > & argv ); @@ -125,7 +128,7 @@ /*! This is a special case function to cause a shutdown. */ void shutdown( ); - std::vector< std::pair< bool (GameStateManager::*)( ), std::string > > * pLoadResourcesVector(){ + std::vector< std::pair< bool (GameStateManager::*)( ), std::string > > * pLoadResourcesVector(){ return &loadResourcesVector_; } protected: @@ -151,7 +154,7 @@ ConfigDialog * configDialog_; - std::vector< std::pair< bool (GameStateManager::*)( ), std::string > > loadResourcesVector_; + std::vector< std::pair< bool (GameStateManager::*)( ), std::string > > loadResourcesVector_; }; Modified: trunk/src/GunObject.cpp =================================================================== --- trunk/src/GunObject.cpp 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/src/GunObject.cpp 2010-01-02 15:10:50 UTC (rev 1171) @@ -96,15 +96,28 @@ pEmit_->setColour( Ogre::ColourValue::Blue, Ogre::ColourValue::Green ); mainNode_->attachObject( thrusterParticles_ ); + + + thrusterTrail_ = mountNode_->getCreator()->createParticleSystem( mainNode_->getName() + "/ThrusterTrail", "OpenGate/ThrustTrail" ); +// thrusterTrail_->setMaterialName( "Examples/Flare" ); +// thrusterTrail_->setDefaultDimensions( 1, 1 ); + pEmitTrail_ = thrusterTrail_->getEmitter( 0 ); + maxTrailEmission_ = pEmitTrail_->getEmissionRate(); + mainNode_->attachObject( thrusterTrail_ ); + mainNode_->setVisible( true ); } EngineObject::~EngineObject(){ + if ( thrusterTrail_ ){ + mainNode_->detachObject( thrusterTrail_ ); + mainNode_->getCreator()->destroyParticleSystem( thrusterTrail_ ); + } if ( thrusterParticles_ ){ mainNode_->detachObject( thrusterParticles_ ); mainNode_->getCreator()->destroyParticleSystem( thrusterParticles_ ); - mountNode_->removeAndDestroyChild( mainNode_->getName() ); } + mountNode_->removeAndDestroyChild( mainNode_->getName() ); } // void EngineObject::mount( SectorMovableObject * parent, Ogre::SceneNode * mountPoint ){ @@ -131,6 +144,12 @@ pEmit_->setEmissionRate( thrustRate_ * 10.0 * 100.0 ); pEmit_->setParticleVelocity( thrustRate_ * 5.0 * 100.0 ); } + + if ( thrusterTrail_ ){ +// pEmitTrail_->setTimeToLive( 2.0 ); + pEmitTrail_->setEmissionRate( thrustRate_ * 333.0 ); +// pEmitTrail_->setParticleVelocity( 0.0 ); + } } Uint32 EngineObject::thrust( Uint32 & powerLine ){ Modified: trunk/src/GunObject.h =================================================================== --- trunk/src/GunObject.h 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/src/GunObject.h 2010-01-02 15:10:50 UTC (rev 1171) @@ -34,7 +34,7 @@ ~GunObject( ); void mount( SectorVesselObject * parent, Ogre::SceneNode * mountPoint ); - + void update( const Ogre::Real elapsedTime ); bool fire( Uint32 & capacity ); @@ -42,7 +42,7 @@ inline Gun * gunBluePrint(){ return gunBluePrint_;} inline Gun & gunBluePrint() const { return *gunBluePrint_;} - + inline SectorVesselObject * parent() { return parent_; } // void setMountPosition( const Ogre::Vector3 & mountPosition ) { mountPosition_ = mountPosition; } @@ -61,41 +61,48 @@ OpenALSoundSource * gunSound_; }; -/*! Construct an engine with a grafical representation i.e. thruster effects. */ +/*! Construct an engine based on a blueprint, with a grafical representation i.e. thruster effects. */ class EngineObject{ public: /*! Construct an engine object, with a Blueprint, a uniqe name, the mountNode on the parent vessel and the absolute position for the emmesive parts of the engine.*/ EngineObject( Engine * engineBluePrint, const std::string & name, Ogre::SceneNode * mountNode, const Ogre::Vector3 & position ); - + /*! Destruct the engine and associated particle or grafical effects. */ ~EngineObject( ); - + /*! Return corresponding main Ogre::SceneNode for this engine. */ inline Ogre::SceneNode * sceneNode() { return mainNode_; } - + /*! Change the thrust rate. Causes a change of the thruster particle effect and determine the amount of power is consumed, by getting the thrust through update powerline cycle. */ void setThrustRate( double rate ); - + /*! Return the preset thrustrate from 0 to 1 */ inline double thrustRate( double rate ){ return thrustRate_; } - + /*! Return the amount of power that the engine provide for a given thrustRate. */ Uint32 thrust( Uint32 & powerLine ); - + protected: Engine * engineBluePrint_; std::string name_; Ogre::SceneNode * mountNode_; Ogre::SceneNode * mainNode_; - + Ogre::ParticleEmitter * pEmit_; Ogre::ParticleSystem * thrusterParticles_; - - double thrustRate_; + + Ogre::ParticleSystem * thrusterTrail_; + Ogre::ParticleEmitter * pEmitTrail_; + + double maxTrailEmission_; + double thrustRate_; }; +class ShieldObject{ +}; + } //namespace OpenGate -#endif +#endif Modified: trunk/src/KeyMap.cpp =================================================================== --- trunk/src/KeyMap.cpp 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/src/KeyMap.cpp 2010-01-02 15:10:50 UTC (rev 1171) @@ -31,8 +31,8 @@ KeyMap::~KeyMap(){ } -void KeyMap::setDefaults(){ - registerUnDockedKeyAction_( "General", "Min/Max Console", &UnDockedState::keyActionSwitchMinMaxConsole, +void KeyMap::setDefaults( bool online ){ + registerUnDockedKeyAction_( "General", "Min/Max Console", &UnDockedState::keyActionSwitchMinMaxConsole, keycode_( 70 ) ); registerUnDockedKeyAction_( "Flight", "1 Rudder increase yaw", &UnDockedState::keyActionAvatarIncreaseYaw, @@ -44,12 +44,12 @@ registerUnDockedKeyAction_( "Flight", "4 Rudder decrease pitch", &UnDockedState::keyActionAvatarDecreasePitch, keycode_( OIS::KC_S ), keycode_( OIS::KC_NUMPAD2 ) ); registerUnDockedKeyAction_( "Flight", "5 Rudder increase roll", &UnDockedState::keyActionAvatarIncreaseRoll, - keycode_( 181 ), keycode_( OIS::KC_NUMPAD0 ) ); + keycode_( OIS::KC_NUMPAD0 ) ); registerUnDockedKeyAction_( "Flight", "6 Rudder decrease roll", &UnDockedState::keyActionAvatarDecreaseRoll, - keycode_( 55 ), keycode_( OIS::KC_NUMPADCOMMA ) ); + keycode_( OIS::KC_DECIMAL ) ); registerUnDockedKeyAction_( "Flight", "7 Rudder center", &UnDockedState::keyActionAvatarCenter, keycode_( OIS::KC_NUMPAD5 ) ); - + registerUnDockedKeyAction_( "Flight", "8 Increase thrust", &UnDockedState::keyActionAvatarIncrementThrust, keycode_( OIS::KC_NUMPAD7 ) ); registerUnDockedKeyAction_( "Flight", "9 Decrease thrust", &UnDockedState::keyActionAvatarDecrementThrust, @@ -60,12 +60,12 @@ keycode_( OIS::KC_NUMPAD9 ) ); registerUnDockedKeyAction_( "Flight", "Docking assistant", &UnDockedState::keyActionDockAssist, keycode_( OIS::KC_A, KEY_SHIFT ) ); - + registerUnDockedKeyAction_( "Radar", "Select next target", &UnDockedState::keyActionSelectTextTarget, keycode_( OIS::KC_N ) ); registerUnDockedKeyAction_( "Radar", "Select previous target", &UnDockedState::keyActionSelectPreviousTarget, keycode_( OIS::KC_P ) ); - + registerUnDockedKeyAction_( "Camera", "1 Normal", &UnDockedState::keyActionCameraNormal, keycode_( OIS::KC_1 ) ); registerUnDockedKeyAction_( "Camera", "2 Look left", &UnDockedState::keyActionCameraLeft, @@ -78,8 +78,8 @@ keycode_( OIS::KC_5 ) ); registerUnDockedKeyAction_( "Camera", "6 Toggle mode", &UnDockedState::keyActionCameraToggle, keycode_( OIS::KC_6 ) ); - - /*! Actions for development, will removed later. */ + + /*! Actions for development, will removed later. */ registerUnDockedKeyAction_( "Development", "Toggle filtering", &UnDockedState::keyActionToggleFiltering_DEV, keycode_( OIS::KC_F ) ); registerUnDockedKeyAction_( "Development", "Toggle polygone", &UnDockedState::keyActionTogglePolygonMode_DEV, @@ -88,10 +88,15 @@ keycode_( OIS::KC_L, KEY_SHIFT ) ); registerUnDockedKeyAction_( "Development", "2 Decrease ambient light", &UnDockedState::keyActionDecreaseAmbientLight_DEV, keycode_( OIS::KC_L ) ); - registerUnDockedKeyAction_( "Development", "3 Increase time zoom", &UnDockedState::keyActionIncreaseTimeZoom_DEV, + + if ( !online ){ + registerUnDockedKeyAction_( "Development", "3 Increase time zoom", &UnDockedState::keyActionIncreaseTimeZoom_DEV, keycode_( OIS::KC_T, KEY_SHIFT ) ); - registerUnDockedKeyAction_( "Development", "4 Decrease time zoom", &UnDockedState::keyActionDecreaseTimeZoom_DEV, + registerUnDockedKeyAction_( "Development", "4 Decrease time zoom", &UnDockedState::keyActionDecreaseTimeZoom_DEV, keycode_( OIS::KC_T ) ); + registerUnDockedKeyAction_( "Development", "Spawn autodocking ai", &UnDockedState::keyActionSpawnAi_DEV, + keycode_( OIS::KC_F7 ) ); + } registerUnDockedKeyAction_( "Development", "5 Increase shader scheme", &UnDockedState::keyActionIncreaseShaderScheme_DEV, keycode_( OIS::KC_O, KEY_SHIFT ) ); registerUnDockedKeyAction_( "Development", "6 Decrease shader scheme", &UnDockedState::keyActionDecreaseShaderScheme_DEV, @@ -105,8 +110,7 @@ keycode_( OIS::KC_F4 ) ); registerUnDockedKeyAction_( "Development", "Selfdestruct", &UnDockedState::keyActionAvatarSelfDestruct_DEV, keycode_( OIS::KC_F8 ) ); - registerUnDockedKeyAction_( "Development", "Spawn autodocking ai", &UnDockedState::keyActionSpawnAi_DEV, - keycode_( OIS::KC_F7 ) ); + registerUnDockedKeyAction_( "Development", "Show infos", &UnDockedState::keyActionShowInfos_DEV, keycode_( OIS::KC_I, KEY_CONTROL ) ); registerUnDockedKeyAction_( "Development", "Show ecliptic", &UnDockedState::keyActionShowEcliptic_DEV, @@ -115,23 +119,23 @@ keycode_( OIS::KC_G, KEY_SHIFT ) ); registerUnDockedKeyAction_( "Development", "8 test dec", &UnDockedState::keyActionTmpDown_DEV, keycode_( OIS::KC_G ) ); - - /*! Actions for console. */ + + /*! Actions for console. */ consoleActionMap_[ keycode_( OIS::KC_SYSRQ ) ] = &Console::keyActionScreenshot; consoleActionMap_[ keycode_( OIS::KC_Q, KEY_CONTROL ) ]= &Console::keyActionShutdown_DEV; // consoleActionMap_[ keycode_( OIS::KC_F4, KEY_ALT ) ] = &Console::keyActionShutdown_DEV; } -void KeyMap::registerUnDockedKeyAction_( const std::string & category, const std::string & name, bool (UnDockedState::*action)( bool ), +void KeyMap::registerUnDockedKeyAction_( const std::string & category, const std::string & name, bool (UnDockedState::*action)( bool ), uint key1, uint key2 ){ unDockedKeyBindings_[ category ].insert( std::pair < std::string, std::pair < uint, uint > > ( name, std::pair< uint, uint >( key1, key2 ) ) ); unDockedKeyActions_[ name ] = action; - + unDockedActionMap_[ key1 ] = action; if ( key2 ) unDockedActionMap_[ key2 ] = action; } - - + + bool(UnDockedState::*KeyMap::unDockedKeyAction( const OIS::KeyEvent & e ))(bool) { uint key = keycode_( e.key, modifier_ ); if ( unDockedActionMap_.count( key ) > 0 ) return unDockedActionMap_[ key ]; @@ -143,25 +147,25 @@ if ( consoleActionMap_.count( key ) > 0 ) return consoleActionMap_[ key ]; return &Console::keyActionDoNothing; } - + std::string KeyMap::keycodeName( uint keycode ){ GlobalKeyModifier modifier = (GlobalKeyModifier)( keycode / 65565 ); uint key = keycode - modifier * 65565; - + std::string name; switch ( modifier ){ case KEY_CONTROL: name += "Ctrl-"; break; case KEY_SHIFT: name += "Shift-"; break; default: break; } - + std::string keyname( ResourceManager::getSingletonPtr()->inputManager->keybord()->getAsString( OIS::KeyCode( key ) ) ); if ( keyname != "Unknown" ){ name += keyname; } return name; } - + bool KeyMap::haveKeyBinding( uint keycode ){ if ( unDockedActionMap_.count( keycode ) || consoleActionMap_.count( keycode ) ){ return true; @@ -181,11 +185,11 @@ oldKeyCode = keyBinding->second.second; keyBinding->second.second = keycode; } - + if ( unDockedActionMap_.count( oldKeyCode ) ){ unDockedActionMap_.erase( oldKeyCode ); } - + unDockedActionMap_[ keycode ] = unDockedKeyActions_[ name ]; std::cout << " KeyMap::setKeyBinding: " << name << "->" << keycodeName( keycode ) << std::endl; break; @@ -194,7 +198,7 @@ } } } - + uint KeyMap::keycode_( uint key, GlobalKeyModifier modifier ){ return modifier * 65565 + key; } Modified: trunk/src/KeyMap.h =================================================================== --- trunk/src/KeyMap.h 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/src/KeyMap.h 2010-01-02 15:10:50 UTC (rev 1171) @@ -40,10 +40,10 @@ typedef std::map< std::string, std::map < std::string, std::pair< uint, uint > > > KeyBindingsMap; KeyMap(); - + ~KeyMap(); - void setDefaults(); + void setDefaults( bool online ); bool (UnDockedState::*unDockedKeyAction( const OIS::KeyEvent & e ))( bool ); @@ -52,36 +52,36 @@ void setGlobalKeyModifier( GlobalKeyModifier modifier ){ modifier_ = modifier; } GlobalKeyModifier globalKeyModifier( ) const { return modifier_; } - + std::map< std::string, std::map < std::string, std::pair< uint, uint > > > & unDockedKeyBindings() { return unDockedKeyBindings_; } - + /*! Return literal name for the key bindings. e.g. 'Shift-A', or 'Ctrl-B' */ std::string keycodeName( uint keycode ); - + void setLastKeycode( uint key ) { lastKeycode_ = keycode_( key, modifier_ ); } - + uint lastKeycode() const { return lastKeycode_; } - + void setKeyBinding( const std::string & name, uint keycode, uint key ); - + bool haveKeyBinding( uint keycode ); - + protected: - /*! Return unique key identifier. */ + /*! Return unique key identifier. */ uint keycode_( uint key, GlobalKeyModifier modifier = KEY_NONE ); - - void registerUnDockedKeyAction_( const std::string & category, const std::string & name, - bool (UnDockedState::*unDockedKeyAction)( bool ), + + void registerUnDockedKeyAction_( const std::string & category, const std::string & name, + bool (UnDockedState::*unDockedKeyAction)( bool ), uint key1, uint key2 = 0 ); std::map< uint, bool (UnDockedState::*)( bool ) > unDockedActionMap_; std::map< uint, bool (Console::*)( bool ) > consoleActionMap_; GlobalKeyModifier modifier_; - + uint lastKeycode_; - - // categorie < name, (key1, key2) > + + // categorie < name, (key1, key2) > KeyBindingsMap unDockedKeyBindings_; std::map < std::string, bool (UnDockedState::*)( bool ) > unDockedKeyActions_; Modified: trunk/src/MarketDialog.cpp =================================================================== --- trunk/src/MarketDialog.cpp 2010-01-02 15:03:47 UTC (rev 1170) +++ trunk/src/MarketDialog.cpp 2010-01-02 15:10:50 UTC (rev 1171) @@ -37,9 +37,9 @@ MarketDialog::MarketDialog( ) : BaseDialog( "dialogs/MarketDialog.layout" ){ - populateItemWidget( CEGUI::WindowManager::getSingleton().getWindow( "MarketWindow/ItemFrame" ), + populateItemWidget( CEGUI::WindowManager::getSingleton().getWindow( "MarketWindow/ItemFrame" ), marketItems_, marketItemWindowCol_, marketItemWindowRow_ ); - populateItemWidget( CEGUI::WindowManager::getSingleton().getWindow( "InventoryWindow/ItemFrame" ), + populateItemWidget( CEGUI::WindowManager::getSingleton().getWindow( "InventoryWindow/ItemFrame" ), inventItems_, inventItemWindowCol_, inventItemWindowRow_ ); setupEventHandlers(); @@ -156,9 +156,9 @@ bool lesserMass( const Entity * l, const Entity * r ) { return ( l->mass() < r->mass() ); } bool greaterMass( const Entity * l, const Entity * r ) { return ( l->mass() > r->mass() ); } -bool lesserName( const Entity * l, const Entity * r ) { return ( strCopyToLowerCase( l->name() ) < +bool lesserName( const Entity * l, const Entity * r ) { return ( strCopyToLowerCase( l->name() ) < strCopyToLowerCase( r->name() ) ); } -bool greaterName( const Entity * l, const Entity * r ) { return ( strCopyToLowerCase( l->name() ) > +bool greaterName( const Entity * l, const Entity * r ) { return ( strCopyToLowerCase( l->name() ) > strCopyToLowerCase( r->name() ) ); } bool lesserSize( const Entity * l, const Entity * r ) { return ( l->size() < r->size() ); } @@ -175,11 +175,11 @@ } else { CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"MarketWindow/UpButton")->show(); } - - std::vector < Entity * > items; - + + std::vector < Entity * > items; + items = ResourceManager::getSingleton().entityManager->allByCategory( selectedCategory_ ); - + switch ( sortBy_ ){ case Alphanumeric: if ( sortAscending_ ) sort( items.begin(), items.end(), &OpenGate::lesserName ); @@ -198,10 +198,10 @@ case Amount: break; } - + int maxRow = (int)ceil( (double)items.size() / marketItemWindowRow_ ); marketOffsetRow_ = min( marketOffsetRow_, maxRow ); - + if ( ( maxRow - marketOffsetRow_ ) > marketItemWindowRow_ ){ CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"MarketWindow/DownButton")->show(); } else { @@ -212,7 +212,7 @@ for ( int j = 0; j < marketItemWindowCol_; j ++ ){ unsigned int widgetCount = i * marketItemWindowCol_ + j; unsigned int itemCount = ( i + marketOffsetRow_ ) * marketItemWindowCol_ + j; - + if ( itemCount >= items.size() ) { fillShortItemWindow( marketItems_[ widgetCount ] ); } else { @@ -250,7 +250,7 @@ } int count = 0; - int startItemCount = inventOffsetRow_ * inventItemWindowCol_; + int startItemCount = inventOffsetRow_ * inventItemWindowCol_; int endItemCount = startItemCount + inventItemWindowRow_ * inventItemWindowCol_; int widgetCount = 0; @@ -297,10 +297,10 @@ textPrice = CEGUI::String( "c" + toStr( price ) ); image = item->ceguiSmallImageName(); icon = CEGUI::String("set:opengate image:IconSize" + toStr( item->size() ) ); - categoryIcon = CEGUI::String("set:opengate image:Icon" + - ResourceManager::getSingleton().entityManager->categoryName( item->entityType() ) + + categoryIcon = CEGUI::String("set:opengate image:Icon" + + ResourceManager::getSingleton().entityManager->categoryName( item->entityType() ) + toStr( item->factionID() ) ); - } + } win->setUserData( item ); win->setProperty( "Text", name ); CEGUI::WindowManager::getSingleton().getWindow( win->getName() + "MarketShortItemAmount" ) @@ -338,7 +338,7 @@ } else { CEGUI::WindowManager::getSingleton().getWindow( "MarketWindow/Sort/OrderHighlightImage" ) ->setPosition( CEGUI::WindowManager::getSingleton().getWindow( "MarketWindow/Sort/DescendOrderButton" )->getPosition() ); - + CEGUI::WindowManager::getSingleton().getWindow( "MarketWindow/Sort/AlphaAscendButton" )->hide(); CEGUI::WindowManager::getSingleton().getWindow( "MarketWindow/Sort/AlphaDescendButton" )->show(); CEGUI::WindowManager::getSingleton().getWindow( "MarketWindow/Sort/SizeAscendButton" )->hide(); @@ -393,7 +393,7 @@ renameClonedWindows( item, basename ); window->addChildWindow( item ); - item->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0, ( xBound + itemWidth ) * j ), + item->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0, ( xBound + itemWidth ) * j ), CEGUI::UDim( 0.0, yBound + ( yBound + itemHe... [truncated message content] |
From: <eg...@us...> - 2010-01-02 15:03:57
|
Revision: 1170 http://opengate.svn.sourceforge.net/opengate/?rev=1170&view=rev Author: egore Date: 2010-01-02 15:03:47 +0000 (Sat, 02 Jan 2010) Log Message: ----------- Whitespace fix Modified Paths: -------------- trunk/src/model/Entity.h Modified: trunk/src/model/Entity.h =================================================================== --- trunk/src/model/Entity.h 2010-01-02 15:00:28 UTC (rev 1169) +++ trunk/src/model/Entity.h 2010-01-02 15:03:47 UTC (rev 1170) @@ -136,7 +136,7 @@ inline void setFactionName_( const std::string & name ) { factionName_ = name; } void loadImages_( ); - /*! A short and most likely unique name of this entity */ + /*! A short and most likely unique name of this entity */ std::string name_; std::string category_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2010-01-02 15:00:34
|
Revision: 1169 http://opengate.svn.sourceforge.net/opengate/?rev=1169&view=rev Author: egore Date: 2010-01-02 15:00:28 +0000 (Sat, 02 Jan 2010) Log Message: ----------- Start cleaning up the directories This starts moving out the data model into a subdirectory called "model" which will eventually be split of to a library. Modified Paths: -------------- trunk/src/EntityManager.h trunk/src/Makefile.am Added Paths: ----------- trunk/src/model/ trunk/src/model/Entity.cpp trunk/src/model/Entity.h Removed Paths: ------------- trunk/src/Entity.cpp trunk/src/Entity.h Deleted: trunk/src/Entity.cpp =================================================================== --- trunk/src/Entity.cpp 2009-12-31 14:53:50 UTC (rev 1168) +++ trunk/src/Entity.cpp 2010-01-02 15:00:28 UTC (rev 1169) @@ -1,209 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * eg...@us... * - * * - * 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 "Entity.h" - -#include "common.h" -#include <string> - -#include "ResourceManager.h" -#include "LogManager.h" - -#include <OgreException.h> -#include <OgreCEGUITexture.h> -#include <OgreMeshManager.h> -#include <CEGUIImageset.h> -#include <CEGUIExceptions.h> -#include <CEGUIBase.h> - -namespace OpenGate{ - -Entity::Entity() - : name_( "unknown" ), category_( "unknown Entity" ), - description_("Please fill in description"), imageFileName_("unknown"), ceguiImageName_( "unknownEntityImageset") { - //** just an idea -// addProperty< float >( "baseYaw", this, setBaseYaw, baseYaw, mandatory, default, description ) - //Property * prop = new Property< Uint32 >( "mass", this, &OpenGate::Entity::setMass, &OpenGate::Entity::mass ); - //properties_.push_back( new Property< Uint32 >( "mass", this, &OpenGate::Entity::setMass, &OpenGate::Entity::mass ) ); - - id_ = 0; - techLevel_ = 0; - mass_ = 1; - size_ = 1; - rtti_ = ENTITY; - factionID_ = 1; - - imageInitialised_ = false; - setFactionName_( ResourceManager::getSingleton().factionName( factionID_ ) ); -} - -Entity::~Entity(){ - -} - -void Entity::readPropertiesFromXML( TiXmlHandle & hRoot ){ - readXMLNode< std::string >( hRoot, "name_"+ ResourceManager::getSingleton().languageSuffix() + " name_en name", - this, &OpenGate::Entity::setName, true ); - - readXMLNode< Uint16 >( hRoot, "object_id", this, &OpenGate::Entity::setID, true ); - readXMLNode< Uint8 >( hRoot, "faction_id", this, &OpenGate::Entity::setFactionID, true ); - - // what is that for - //readXMLNode< Uint8 >( hRoot, "class_id", this, &OpenGate::Entity::setClassID, false ); - readXMLNode< Uint8 >( hRoot, "techlevel required_rank", this, &OpenGate::Entity::setTechLevel, false ); - - readXMLNode< int >( hRoot, "size", this, &OpenGate::Entity::setSize, false ); - readXMLNode< int >( hRoot, "mass", this, &OpenGate::Entity::setMass, false ); - - readXMLNode< std::string >( hRoot, "description_" + ResourceManager::getSingleton().languageSuffix() + - " description_en description", this, &OpenGate::Entity::setDescription, false ); - - readXMLNodes< std::string >( hRoot, "production-center", this, &OpenGate::Entity::addProductionCenter ); - -} - -void Entity::loadImages_( ) { - imageInitialised_ = true; - bool haveSmall = true; - - if ( imageFileName_ == "unknown" ) imageFileName_ = name_; - - if ( !initialiseImage( imageFileName_ + "_small.png", imageFileName_ + "Small" ) ){ - haveSmall = false; - } - - if ( haveSmall ){ - ceguiSmallImageName_ = ceguiImageName_; - } - - if ( !initialiseImage( imageFileName_ + "_big.png", imageFileName_ ) ){ - //**fallback; - initialiseImage( imageFileName_ + ".png", imageFileName_, true ); - } - - if ( !haveSmall ) { - initialiseImage( imageFileName_ + ".png", imageFileName_ + "Small" ); - ceguiSmallImageName_ = ceguiImageName_; - } -} - -bool Entity::initialiseImage( const std::string & imageName, const std::string & targetName, bool verbose ){ - bool fail = true; - CEGUI::Texture * texture = NULL; - - try { - texture = dynamic_cast< CEGUI::OgreCEGUIRenderer * >( ResourceManager::getSingleton().guiRenderer )->createTexture( imageName, "Opengate"); - fail = false; - } catch( CEGUI::Exception & e ){ - LogManager::getSingleton().warn( e.getMessage().c_str() ); - fail = true; - } catch( Ogre::Exception & e ){ - LogManager::getSingleton().warn( e.what() ); - fail = true; - } catch( ... ){ - LogManager::getSingleton().warn( "Unknown exception" ); - fail = true; - } - - if ( !fail && texture ){ - CEGUI::Imageset * imageSet = CEGUI::ImagesetManager::getSingleton().createImageset( targetName, texture ); - imageSet->defineImage( targetName, CEGUI::Point(0.0f, 0.0f), - CEGUI::Size( texture->getWidth(), texture->getHeight() ), CEGUI::Point(0.0f,0.0f)); - - ceguiImageName_ = "set:" + targetName + " image:" + targetName; - } else { - //** fallback image; - ceguiImageName_ = "set:" + targetName + " image:" + targetName; - } - return !fail; -} - -void Entity::setFactionID( int id ){ - factionID_ = id; - setFactionName_( ResourceManager::getSingleton().factionName( factionID_ ) ); -} - -MeshEntity::MeshEntity(): Entity(){ - baseSize_ = Ogre::Vector3::ZERO; - baseYaw_ = 0.0; - basePitch_ = 0.0; - baseRoll_ = 0.0; - baseScale_ = 0.0; -} - -MeshEntity::~MeshEntity(){ - if ( !pMesh_.isNull() ) Ogre::MeshManager::getSingleton().unload( pMesh_->getName() ); -} - -void MeshEntity::readPropertiesFromXML( TiXmlHandle & hRoot ){ - Entity::readPropertiesFromXML( hRoot ); - - readXMLNode< float >( hRoot, "base_yaw baseyaw", this, &OpenGate::MeshEntity::setBaseYaw, false ); - readXMLNode< float >( hRoot, "base_pitch basepitch", this, &OpenGate::MeshEntity::setBasePitch, false ); - readXMLNode< float >( hRoot, "base_roll baseroll", this, &OpenGate::MeshEntity::setBaseRoll, false ); - readXMLNode< float >( hRoot, "base_size basesize", this, &OpenGate::MeshEntity::setBaseSize, false ); - readXMLNode< float >( hRoot, "base_scale basescale", this, &OpenGate::MeshEntity::setBaseScale, false ); - - // readXMLNode< float >( hRoot, "basesize", this, &OpenGate::MeshEntity::setBaseSize, false ); - TiXmlElement * pElem; - - Ogre::Real length = 0; - pElem = hRoot.ChildElement( "length", 0 ).Element(); - if ( pElem ) length = toDouble( pElem->FirstChild()->Value() ); - - Ogre::Real width = 0; - pElem = hRoot.ChildElement( "width", 0 ).Element(); - if ( pElem ) width = toDouble( pElem->FirstChild()->Value() ); - - Ogre::Real height = 0; - pElem = hRoot.ChildElement( "height", 0 ).Element(); - if ( pElem ) height = toDouble( pElem->FirstChild()->Value() ); - - if ( length > 0 && width > 0 && height > 0 ) this->setBaseSizeVector( width, height, length ); - - if ( !readXMLNode< std::string >( hRoot, "mesh", this, &OpenGate::MeshEntity::setMesh, false ) ){ - - try { - setMesh( createMeshName( name_ ) ); - } catch( Ogre::Exception & e ){ - LogManager::getSingleton().warn( e.what() ); - } - } -} - -std::string MeshEntity::createMeshName( const std::string & meshName ){ - return strReplaceBlankWithUnderscore( strCopyToLowerCase( meshName ) ); -} - -void MeshEntity::setMesh( const std::string & meshName ){ - meshName_ = meshName.substr( 0, meshName.rfind( ".mesh" ) ) + ".mesh" ; - - pMesh_ = Ogre::MeshManager::getSingleton().load( meshName_, - "Opengate", - Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, - Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, - true, true); - - unsigned short src = 0, dest = 0; - if ( !pMesh_->suggestTangentVectorBuildParams( Ogre::VES_TANGENT, src, dest) ) { - pMesh_->buildTangentVectors( Ogre::VES_TANGENT, src, dest); - } -} -} // namespace OpenGate Deleted: trunk/src/Entity.h =================================================================== --- trunk/src/Entity.h 2009-12-31 14:53:50 UTC (rev 1168) +++ trunk/src/Entity.h 2010-01-02 15:00:28 UTC (rev 1169) @@ -1,244 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * eg...@us... * - * * - * 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 _OPENGATE_ENTITY_H -#define _OPENGATE_ENTITY_H - -#include <set> -#include <string> - -#include "common.h" - -#include <OgreVector3.h> -#include <OgreMesh.h> - -namespace OpenGate{ - -enum EntityType{NONE,ENTITY,VESSEL,COMMODITY,POWERPLANT,ENGINE,RADAR,ECM,CAPACITOR,SHIELD,GUN,MISSILE,MODX,STATION}; -enum GunType{UNKNOWN,LASER,MININGLASER,BULLET}; - -class ResourceManager; - -// class Property { -// public: -// template < class Class, class Setter, class Getter > Property( const std::string & name, Class * instance, Setter setter, Getter getter ) -// : name_( name ), instance_ ( instance ), setter_( &setter ), getter_( &getter ){ -// } -// -// void operator( )(){ -// (instance_->*setter_)( ); -// } -// protected: -// std::string name_; -// void * instance_; -// void * setter_; -// void * getter_; -// -// }; - -/*! - * \brief This class definies the basic infrastructure for all entities. - * - * Opengate is able to load information about so called entities from XML files. - * These information are loaded into so called templates. These aren't "real" - * entities, but it's like a blueprint to construct an entity from. Every entity - * in Opengate is a child of this base entity template. - * \author Christoph Brill <eg...@us...> - */ - -class Entity{ -public: - Entity(); - - virtual ~Entity(); - - virtual EntityType entityType() const { return rtti_; } - - /*! - * \brief This method is capable of loading the entity from a XML - * definition. - * - * All entities must be able to be read from an XML file containing their - * definition. Each entity can do whatever is necessary here, to get all - * the data from the XML file. - */ - virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); - - inline void setName( const std::string & name ) { name_ = name; } - inline const std::string & name( ) const { return name_; } - - void setFactionID( int id ); - inline int factionID( ) const { return factionID_; } - inline const std::string & factionName( ) const { return factionName_; } - - inline void setCategoryName( const std::string & category ) { category_ = category; } - inline const std::string & categoryName( ) const { return category_; } - - inline void setID( int id ){ id_ = id; } - inline int id( ) const { return id_; } - - inline void setTechLevel( int level ){ techLevel_ = level; } - inline int techLevel( ) const { return techLevel_; } - - inline void setMass( long mass ){ mass_ = mass; } - virtual inline Uint32 mass( ) const { return mass_; } - virtual inline Uint32 totalMass() const { return mass_; } - - inline void setSize( int size ){ size_ = size; } - inline int size( ) const { return size_; } - - inline void setDescription( const std::string & description ){ description_ = description; } - inline const std::string & description( ) const { return description_; } - - inline void setImageName( const std::string & imageFileName ) { imageFileName_ = imageFileName; } - inline const std::string & imageName() const { return imageFileName_; } - inline std::string ceguiImageName() { if ( !imageInitialised_ ) loadImages_(); return ceguiImageName_; } - inline std::string ceguiSmallImageName() { if ( !imageInitialised_ ) loadImages_(); return ceguiSmallImageName_; } - - bool initialiseImage( const std::string & imageName, const std::string & targetName, bool verbose = false ); - - inline void addProductionCenter( const std::string & productionCenter ) { - productionCenters_.insert( productionCenter ); - } - inline const std::set < std::string > & productionCenters( ) const { return productionCenters_; } - - inline void setRequieredComponents( const std::set < Entity * > & requieredComponents ) { - requieredComponents_ = requieredComponents; } - inline const std::set < Entity * > & requieredComponents( ) const { return requieredComponents_; } - -protected: - inline void setFactionName_( const std::string & name ) { factionName_ = name; } - void loadImages_( ); - - /*! A short and most likely unique name of this entity */ - std::string name_; - - std::string category_; - - /*! A rather long description of this component */ - std::string description_; - - std::string factionName_; - int factionID_; - - std::string imageFileName_; - std::string ceguiSmallImageName_; - std::string ceguiImageName_; - bool imageInitialised_; - - /*! The places where this part of equipment is built */ - std::set < std::string > productionCenters_; - - /*! The components required to build this equipment part */ - std::set < Entity * > requieredComponents_; - - /*! A unique ID to find this object \todo maybe push to a string and merge with Commodity.commodityID_ */ - Uint16 id_; - /*! The required tech level to interact with this object */ - int techLevel_; - /*! The mass of this entity. */ - Uint32 mass_; - /*! The amount of slots necessary to plug in such a device. */ - int size_; - - /*! For runtime identification of an entity item. */ - EntityType rtti_; - - //std::vector < Property< class ValueType > * > properties_; -}; - -/*! - * \brief A MeshEntity is an entity that also has a mesh associated. - * - * Entities like vessels are mesh entities, as you can also see them flying - * around in space. Stuff like cargo, which does not have a 3d model (aka mesh) - * therefore is no MeshEntity, but an Entity. - */ -class MeshEntity : public Entity{ -public: - MeshEntity(); - - virtual ~MeshEntity(); - - void readPropertiesFromXML( TiXmlHandle & hRoot ); - - /*! Base sizes are necessary for resizing the ogremesh */ - inline void setBaseSizeVector( float length, float width, float height ){ - baseSize_[ 0 ] = length; baseSize_[ 1 ] = width; baseSize_[ 2 ] = height; } - - /*! If size is a scalar value, the length of the entity.*/ - inline void setBaseSize( float size ){ baseSize_[ 2 ] = size; } - inline const Ogre::Vector3 & baseSize( ) const { return baseSize_; } - - /*! If size is a scalar value, the length of the entity.*/ - inline void setBaseScale( float scale ){ baseScale_ = scale; } - inline const Ogre::Real baseScale( ) const { return baseScale_; } - - /*! Base sizes are necessary for resizing the ogremesh */ - inline void setBaseYaw( Ogre::Real baseYaw ){ baseYaw_ = baseYaw; } - inline Ogre::Real baseYaw( ) const { return baseYaw_; } - - /*! Base sizes are necessary for resizing the ogremesh */ - inline void setBasePitch( Ogre::Real basePitch ){ basePitch_ = basePitch; } - inline Ogre::Real basePitch( ) const { return basePitch_; } - - /*! Base sizes are necessary for resizing the ogremesh */ - inline void setBaseRoll( Ogre::Real baseRoll ){ baseRoll_ = baseRoll; } - inline Ogre::Real baseRoll( ) const { return baseRoll_; } - - void setMesh( const std::string & meshName ); - inline const std::string & meshName( ) const { return meshName_; } - virtual std::string createMeshName( const std::string & meshName ); - Ogre::MeshPtr & meshPtr( ){ return pMesh_; } - -protected: - //** geometric parameters - Ogre::Vector3 baseSize_; - Ogre::Real baseYaw_; - Ogre::Real basePitch_; - Ogre::Real baseRoll_; - Ogre::Real baseScale_; - - Ogre::MeshPtr pMesh_; - - std::string meshName_; -}; - -//! -/*!*/ -class Station : public MeshEntity{ -public: - Station( ) : MeshEntity(){ - rtti_ = STATION; - } - - virtual ~Station( ){} - - void readPropertiesFromXML( TiXmlHandle & hRoot ){ - MeshEntity::readPropertiesFromXML( hRoot ); - } - -protected: -}; - -} // namespace OpenGate - -#endif //_OPENGATE_ENTITY_H - Modified: trunk/src/EntityManager.h =================================================================== --- trunk/src/EntityManager.h 2009-12-31 14:53:50 UTC (rev 1168) +++ trunk/src/EntityManager.h 2010-01-02 15:00:28 UTC (rev 1169) @@ -25,6 +25,7 @@ namespace OpenGate { +class ResourceManager; class LogManager; class PowerPlant; Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2009-12-31 14:53:50 UTC (rev 1168) +++ trunk/src/Makefile.am 2010-01-02 15:00:28 UTC (rev 1169) @@ -1,3 +1,5 @@ +AM_CPPFLAGS = -I$(top_srcdir)/src/model + bin_PROGRAMS = \ opengateclient \ opengateserver @@ -35,8 +37,8 @@ Console.cpp \ DockedState.h \ DockedState.cpp \ - Entity.h \ - Entity.cpp \ + model/Entity.h \ + model/Entity.cpp \ EntityManager.h \ EntityManager.cpp \ Equipment.h \ Copied: trunk/src/model/Entity.cpp (from rev 1168, trunk/src/Entity.cpp) =================================================================== --- trunk/src/model/Entity.cpp (rev 0) +++ trunk/src/model/Entity.cpp 2010-01-02 15:00:28 UTC (rev 1169) @@ -0,0 +1,209 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by OpenGate development team * + * eg...@us... * + * * + * 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 "Entity.h" + +#include "common.h" +#include <string> + +#include "ResourceManager.h" +#include "LogManager.h" + +#include <OgreException.h> +#include <OgreCEGUITexture.h> +#include <OgreMeshManager.h> +#include <CEGUIImageset.h> +#include <CEGUIExceptions.h> +#include <CEGUIBase.h> + +namespace OpenGate{ + +Entity::Entity() + : name_( "unknown" ), category_( "unknown Entity" ), + description_("Please fill in description"), imageFileName_("unknown"), ceguiImageName_( "unknownEntityImageset") { + //** just an idea +// addProperty< float >( "baseYaw", this, setBaseYaw, baseYaw, mandatory, default, description ) + //Property * prop = new Property< Uint32 >( "mass", this, &OpenGate::Entity::setMass, &OpenGate::Entity::mass ); + //properties_.push_back( new Property< Uint32 >( "mass", this, &OpenGate::Entity::setMass, &OpenGate::Entity::mass ) ); + + id_ = 0; + techLevel_ = 0; + mass_ = 1; + size_ = 1; + rtti_ = ENTITY; + factionID_ = 1; + + imageInitialised_ = false; + setFactionName_( ResourceManager::getSingleton().factionName( factionID_ ) ); +} + +Entity::~Entity(){ + +} + +void Entity::readPropertiesFromXML( TiXmlHandle & hRoot ){ + readXMLNode< std::string >( hRoot, "name_"+ ResourceManager::getSingleton().languageSuffix() + " name_en name", + this, &OpenGate::Entity::setName, true ); + + readXMLNode< Uint16 >( hRoot, "object_id", this, &OpenGate::Entity::setID, true ); + readXMLNode< Uint8 >( hRoot, "faction_id", this, &OpenGate::Entity::setFactionID, true ); + + // what is that for + //readXMLNode< Uint8 >( hRoot, "class_id", this, &OpenGate::Entity::setClassID, false ); + readXMLNode< Uint8 >( hRoot, "techlevel required_rank", this, &OpenGate::Entity::setTechLevel, false ); + + readXMLNode< int >( hRoot, "size", this, &OpenGate::Entity::setSize, false ); + readXMLNode< int >( hRoot, "mass", this, &OpenGate::Entity::setMass, false ); + + readXMLNode< std::string >( hRoot, "description_" + ResourceManager::getSingleton().languageSuffix() + + " description_en description", this, &OpenGate::Entity::setDescription, false ); + + readXMLNodes< std::string >( hRoot, "production-center", this, &OpenGate::Entity::addProductionCenter ); + +} + +void Entity::loadImages_( ) { + imageInitialised_ = true; + bool haveSmall = true; + + if ( imageFileName_ == "unknown" ) imageFileName_ = name_; + + if ( !initialiseImage( imageFileName_ + "_small.png", imageFileName_ + "Small" ) ){ + haveSmall = false; + } + + if ( haveSmall ){ + ceguiSmallImageName_ = ceguiImageName_; + } + + if ( !initialiseImage( imageFileName_ + "_big.png", imageFileName_ ) ){ + //**fallback; + initialiseImage( imageFileName_ + ".png", imageFileName_, true ); + } + + if ( !haveSmall ) { + initialiseImage( imageFileName_ + ".png", imageFileName_ + "Small" ); + ceguiSmallImageName_ = ceguiImageName_; + } +} + +bool Entity::initialiseImage( const std::string & imageName, const std::string & targetName, bool verbose ){ + bool fail = true; + CEGUI::Texture * texture = NULL; + + try { + texture = dynamic_cast< CEGUI::OgreCEGUIRenderer * >( ResourceManager::getSingleton().guiRenderer )->createTexture( imageName, "Opengate"); + fail = false; + } catch( CEGUI::Exception & e ){ + LogManager::getSingleton().warn( e.getMessage().c_str() ); + fail = true; + } catch( Ogre::Exception & e ){ + LogManager::getSingleton().warn( e.what() ); + fail = true; + } catch( ... ){ + LogManager::getSingleton().warn( "Unknown exception" ); + fail = true; + } + + if ( !fail && texture ){ + CEGUI::Imageset * imageSet = CEGUI::ImagesetManager::getSingleton().createImageset( targetName, texture ); + imageSet->defineImage( targetName, CEGUI::Point(0.0f, 0.0f), + CEGUI::Size( texture->getWidth(), texture->getHeight() ), CEGUI::Point(0.0f,0.0f)); + + ceguiImageName_ = "set:" + targetName + " image:" + targetName; + } else { + //** fallback image; + ceguiImageName_ = "set:" + targetName + " image:" + targetName; + } + return !fail; +} + +void Entity::setFactionID( int id ){ + factionID_ = id; + setFactionName_( ResourceManager::getSingleton().factionName( factionID_ ) ); +} + +MeshEntity::MeshEntity(): Entity(){ + baseSize_ = Ogre::Vector3::ZERO; + baseYaw_ = 0.0; + basePitch_ = 0.0; + baseRoll_ = 0.0; + baseScale_ = 0.0; +} + +MeshEntity::~MeshEntity(){ + if ( !pMesh_.isNull() ) Ogre::MeshManager::getSingleton().unload( pMesh_->getName() ); +} + +void MeshEntity::readPropertiesFromXML( TiXmlHandle & hRoot ){ + Entity::readPropertiesFromXML( hRoot ); + + readXMLNode< float >( hRoot, "base_yaw baseyaw", this, &OpenGate::MeshEntity::setBaseYaw, false ); + readXMLNode< float >( hRoot, "base_pitch basepitch", this, &OpenGate::MeshEntity::setBasePitch, false ); + readXMLNode< float >( hRoot, "base_roll baseroll", this, &OpenGate::MeshEntity::setBaseRoll, false ); + readXMLNode< float >( hRoot, "base_size basesize", this, &OpenGate::MeshEntity::setBaseSize, false ); + readXMLNode< float >( hRoot, "base_scale basescale", this, &OpenGate::MeshEntity::setBaseScale, false ); + + // readXMLNode< float >( hRoot, "basesize", this, &OpenGate::MeshEntity::setBaseSize, false ); + TiXmlElement * pElem; + + Ogre::Real length = 0; + pElem = hRoot.ChildElement( "length", 0 ).Element(); + if ( pElem ) length = toDouble( pElem->FirstChild()->Value() ); + + Ogre::Real width = 0; + pElem = hRoot.ChildElement( "width", 0 ).Element(); + if ( pElem ) width = toDouble( pElem->FirstChild()->Value() ); + + Ogre::Real height = 0; + pElem = hRoot.ChildElement( "height", 0 ).Element(); + if ( pElem ) height = toDouble( pElem->FirstChild()->Value() ); + + if ( length > 0 && width > 0 && height > 0 ) this->setBaseSizeVector( width, height, length ); + + if ( !readXMLNode< std::string >( hRoot, "mesh", this, &OpenGate::MeshEntity::setMesh, false ) ){ + + try { + setMesh( createMeshName( name_ ) ); + } catch( Ogre::Exception & e ){ + LogManager::getSingleton().warn( e.what() ); + } + } +} + +std::string MeshEntity::createMeshName( const std::string & meshName ){ + return strReplaceBlankWithUnderscore( strCopyToLowerCase( meshName ) ); +} + +void MeshEntity::setMesh( const std::string & meshName ){ + meshName_ = meshName.substr( 0, meshName.rfind( ".mesh" ) ) + ".mesh" ; + + pMesh_ = Ogre::MeshManager::getSingleton().load( meshName_, + "Opengate", + Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, + Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, + true, true); + + unsigned short src = 0, dest = 0; + if ( !pMesh_->suggestTangentVectorBuildParams( Ogre::VES_TANGENT, src, dest) ) { + pMesh_->buildTangentVectors( Ogre::VES_TANGENT, src, dest); + } +} +} // namespace OpenGate Copied: trunk/src/model/Entity.h (from rev 1168, trunk/src/Entity.h) =================================================================== --- trunk/src/model/Entity.h (rev 0) +++ trunk/src/model/Entity.h 2010-01-02 15:00:28 UTC (rev 1169) @@ -0,0 +1,253 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by OpenGate development team * + * eg...@us... * + * * + * 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 _OPENGATE_ENTITY_H +#define _OPENGATE_ENTITY_H + +#include <set> +#include <string> + +#include "common.h" + +#include <OgreVector3.h> +#include <OgreMesh.h> + +namespace OpenGate{ + +/*! + * \brief This is used to determine what kind of object an entity is. + * + * This is returned by Entity#entityType(); + */ +enum EntityType{NONE,ENTITY,VESSEL,COMMODITY,POWERPLANT,ENGINE,RADAR,ECM,CAPACITOR,SHIELD,GUN,MISSILE,MODX,STATION}; +/*! + * \brief This enum is used to determine which type of weapon a gun is + */ +enum GunType{UNKNOWN,LASER,MININGLASER,BULLET}; + +// class Property { +// public: +// template < class Class, class Setter, class Getter > Property( const std::string & name, Class * instance, Setter setter, Getter getter ) +// : name_( name ), instance_ ( instance ), setter_( &setter ), getter_( &getter ){ +// } +// +// void operator( )(){ +// (instance_->*setter_)( ); +// } +// protected: +// std::string name_; +// void * instance_; +// void * setter_; +// void * getter_; +// +// }; + +/*! + * \brief This class definies the basic infrastructure for all entities. + * + * Opengate is able to load information about so called entities from XML files. + * These information are loaded into so called templates. These aren't "real" + * entities, but it's like a blueprint to construct an entity from. Every entity + * in Opengate is a child of this base entity template. + * \author Christoph Brill <eg...@us...> + */ + +class Entity{ +public: + Entity(); + + virtual ~Entity(); + + /*! + * \brief This method return what kind of entity this instance is + */ + virtual EntityType entityType() const { return rtti_; } + + /*! + * \brief This method is capable of loading the entity from a XML + * definition. + * + * All entities must be able to be read from an XML file containing their + * definition. Each entity can do whatever is necessary here, to get all + * the data from the XML file. + */ + virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); + + inline void setName( const std::string & name ) { name_ = name; } + inline const std::string & name( ) const { return name_; } + + void setFactionID( int id ); + inline int factionID( ) const { return factionID_; } + inline const std::string & factionName( ) const { return factionName_; } + + inline void setCategoryName( const std::string & category ) { category_ = category; } + inline const std::string & categoryName( ) const { return category_; } + + inline void setID( int id ){ id_ = id; } + inline int id( ) const { return id_; } + + inline void setTechLevel( int level ){ techLevel_ = level; } + inline int techLevel( ) const { return techLevel_; } + + inline void setMass( long mass ){ mass_ = mass; } + virtual inline Uint32 mass( ) const { return mass_; } + virtual inline Uint32 totalMass() const { return mass_; } + + inline void setSize( int size ){ size_ = size; } + inline int size( ) const { return size_; } + + inline void setDescription( const std::string & description ){ description_ = description; } + inline const std::string & description( ) const { return description_; } + + inline void setImageName( const std::string & imageFileName ) { imageFileName_ = imageFileName; } + inline const std::string & imageName() const { return imageFileName_; } + inline std::string ceguiImageName() { if ( !imageInitialised_ ) loadImages_(); return ceguiImageName_; } + inline std::string ceguiSmallImageName() { if ( !imageInitialised_ ) loadImages_(); return ceguiSmallImageName_; } + + bool initialiseImage( const std::string & imageName, const std::string & targetName, bool verbose = false ); + + inline void addProductionCenter( const std::string & productionCenter ) { + productionCenters_.insert( productionCenter ); + } + inline const std::set < std::string > & productionCenters( ) const { return productionCenters_; } + + inline void setRequieredComponents( const std::set < Entity * > & requieredComponents ) { + requieredComponents_ = requieredComponents; } + inline const std::set < Entity * > & requieredComponents( ) const { return requieredComponents_; } + +protected: + inline void setFactionName_( const std::string & name ) { factionName_ = name; } + void loadImages_( ); + + /*! A short and most likely unique name of this entity */ + std::string name_; + + std::string category_; + + /*! A rather long description of this component */ + std::string description_; + + std::string factionName_; + int factionID_; + + std::string imageFileName_; + std::string ceguiSmallImageName_; + std::string ceguiImageName_; + bool imageInitialised_; + + /*! The places where this part of equipment is built */ + std::set < std::string > productionCenters_; + + /*! The components required to build this equipment part */ + std::set < Entity * > requieredComponents_; + + /*! A unique ID to find this object \todo maybe push to a string and merge with Commodity.commodityID_ */ + Uint16 id_; + /*! The required tech level to interact with this object */ + int techLevel_; + /*! The mass of this entity. */ + Uint32 mass_; + /*! The amount of slots necessary to plug in such a device. */ + int size_; + + /*! For runtime identification of an entity item. */ + EntityType rtti_; + + //std::vector < Property< class ValueType > * > properties_; +}; + +/*! + * \brief A MeshEntity is an entity that also has a mesh associated. + * + * Entities like vessels are mesh entities, as you can also see them flying + * around in space. Stuff like cargo, which does not have a 3d model (aka mesh) + * therefore is no MeshEntity, but an Entity. + */ +class MeshEntity : public Entity{ +public: + MeshEntity(); + + virtual ~MeshEntity(); + + void readPropertiesFromXML( TiXmlHandle & hRoot ); + + /*! Base sizes are necessary for resizing the ogremesh */ + inline void setBaseSizeVector( float length, float width, float height ){ + baseSize_[ 0 ] = length; baseSize_[ 1 ] = width; baseSize_[ 2 ] = height; } + + /*! If size is a scalar value, the length of the entity.*/ + inline void setBaseSize( float size ){ baseSize_[ 2 ] = size; } + inline const Ogre::Vector3 & baseSize( ) const { return baseSize_; } + + /*! If size is a scalar value, the length of the entity.*/ + inline void setBaseScale( float scale ){ baseScale_ = scale; } + inline const Ogre::Real baseScale( ) const { return baseScale_; } + + /*! Base sizes are necessary for resizing the ogremesh */ + inline void setBaseYaw( Ogre::Real baseYaw ){ baseYaw_ = baseYaw; } + inline Ogre::Real baseYaw( ) const { return baseYaw_; } + + /*! Base sizes are necessary for resizing the ogremesh */ + inline void setBasePitch( Ogre::Real basePitch ){ basePitch_ = basePitch; } + inline Ogre::Real basePitch( ) const { return basePitch_; } + + /*! Base sizes are necessary for resizing the ogremesh */ + inline void setBaseRoll( Ogre::Real baseRoll ){ baseRoll_ = baseRoll; } + inline Ogre::Real baseRoll( ) const { return baseRoll_; } + + void setMesh( const std::string & meshName ); + inline const std::string & meshName( ) const { return meshName_; } + virtual std::string createMeshName( const std::string & meshName ); + Ogre::MeshPtr & meshPtr( ){ return pMesh_; } + +protected: + //** geometric parameters + Ogre::Vector3 baseSize_; + Ogre::Real baseYaw_; + Ogre::Real basePitch_; + Ogre::Real baseRoll_; + Ogre::Real baseScale_; + + Ogre::MeshPtr pMesh_; + + std::string meshName_; +}; + +//! +/*!*/ +class Station : public MeshEntity{ +public: + Station( ) : MeshEntity(){ + rtti_ = STATION; + } + + virtual ~Station( ){} + + void readPropertiesFromXML( TiXmlHandle & hRoot ){ + MeshEntity::readPropertiesFromXML( hRoot ); + } + +protected: +}; + +} // namespace OpenGate + +#endif //_OPENGATE_ENTITY_H + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2009-12-31 15:50:22
|
Revision: 1168 http://opengate.svn.sourceforge.net/opengate/?rev=1168&view=rev Author: egore Date: 2009-12-31 14:53:50 +0000 (Thu, 31 Dec 2009) Log Message: ----------- Add some trivial documentation Modified Paths: -------------- trunk/src/Entity.h trunk/src/Moveable.h trunk/src/Vessel.h Modified: trunk/src/Entity.h =================================================================== --- trunk/src/Entity.h 2009-12-31 13:31:44 UTC (rev 1167) +++ trunk/src/Entity.h 2009-12-31 14:53:50 UTC (rev 1168) @@ -29,11 +29,6 @@ #include <OgreVector3.h> #include <OgreMesh.h> -// namespace Ogre{ -// class Vector3; -// class Real; -// } - namespace OpenGate{ enum EntityType{NONE,ENTITY,VESSEL,COMMODITY,POWERPLANT,ENGINE,RADAR,ECM,CAPACITOR,SHIELD,GUN,MISSILE,MODX,STATION}; @@ -59,7 +54,7 @@ // }; /*! - * \brief This class definies the basic structure of all entity templates. + * \brief This class definies the basic infrastructure for all entities. * * Opengate is able to load information about so called entities from XML files. * These information are loaded into so called templates. These aren't "real" @@ -75,7 +70,15 @@ virtual ~Entity(); virtual EntityType entityType() const { return rtti_; } - + + /*! + * \brief This method is capable of loading the entity from a XML + * definition. + * + * All entities must be able to be read from an XML file containing their + * definition. Each entity can do whatever is necessary here, to get all + * the data from the XML file. + */ virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); inline void setName( const std::string & name ) { name_ = name; } @@ -124,7 +127,9 @@ inline void setFactionName_( const std::string & name ) { factionName_ = name; } void loadImages_( ); + /*! A short and most likely unique name of this entity */ std::string name_; + std::string category_; /*! A rather long description of this component */ @@ -159,6 +164,13 @@ //std::vector < Property< class ValueType > * > properties_; }; +/*! + * \brief A MeshEntity is an entity that also has a mesh associated. + * + * Entities like vessels are mesh entities, as you can also see them flying + * around in space. Stuff like cargo, which does not have a 3d model (aka mesh) + * therefore is no MeshEntity, but an Entity. + */ class MeshEntity : public Entity{ public: MeshEntity(); @@ -205,7 +217,7 @@ Ogre::Real baseScale_; Ogre::MeshPtr pMesh_; - + std::string meshName_; }; Modified: trunk/src/Moveable.h =================================================================== --- trunk/src/Moveable.h 2009-12-31 13:31:44 UTC (rev 1167) +++ trunk/src/Moveable.h 2009-12-31 14:53:50 UTC (rev 1168) @@ -25,7 +25,12 @@ namespace OpenGate{ -/*!A movabeble entity has a mesh */ +/*! \brief A movabeble entity is a MeshEntity that is capable of being moved. + * + * The best example of a movable entity is the players vessel. The game would + * not be fun if the player could not move around in space. Other stuff like + * stations or planets are immovable and therefore not in this class hierarchie. + */ class Movable : public MeshEntity{ public: Movable(); @@ -42,7 +47,7 @@ inline float yaw( ) const { return yaw_; } - //** degree /second + //** degree /second inline void setPitch( float pitch ){ pitch_ = pitch; if ( pitch_ < 1.0 ) pitch_ = 1000.0 * ( 180.0 * pitch_ ) / 3.141592; } Modified: trunk/src/Vessel.h =================================================================== --- trunk/src/Vessel.h 2009-12-31 13:31:44 UTC (rev 1167) +++ trunk/src/Vessel.h 2009-12-31 14:53:50 UTC (rev 1168) @@ -27,7 +27,7 @@ #include <vector> namespace OpenGate{ - + class PowerPlant; class Engine; class Radar; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-31 13:31:54
|
Revision: 1167 http://opengate.svn.sourceforge.net/opengate/?rev=1167&view=rev Author: spom_spom Date: 2009-12-31 13:31:44 +0000 (Thu, 31 Dec 2009) Log Message: ----------- try fixin radar image Modified Paths: -------------- trunk/data/materials/planet.material trunk/data/textures/radarBackground.png Added Paths: ----------- trunk/data/textures/clouds_600.png Modified: trunk/data/materials/planet.material =================================================================== --- trunk/data/materials/planet.material 2009-12-31 12:34:21 UTC (rev 1166) +++ trunk/data/materials/planet.material 2009-12-31 13:31:44 UTC (rev 1167) @@ -171,7 +171,8 @@ } texture_unit { - texture clouds_1275.jpg + texture clouds_600.png +// texture clouds_1275.jpg // texture clouds_2500x1250.jpg } } @@ -188,7 +189,8 @@ scene_blend add texture_unit { - texture clouds_1275.jpg + texture clouds_600.png + //texture clouds_1275.jpg } } } Added: trunk/data/textures/clouds_600.png =================================================================== (Binary files differ) Property changes on: trunk/data/textures/clouds_600.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/data/textures/radarBackground.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-31 13:31:52
|
Revision: 1166 http://opengate.svn.sourceforge.net/opengate/?rev=1166&view=rev Author: spom_spom Date: 2009-12-31 12:34:21 +0000 (Thu, 31 Dec 2009) Log Message: ----------- reset station windows Modified Paths: -------------- trunk/data/materials/station.material Modified: trunk/data/materials/station.material =================================================================== --- trunk/data/materials/station.material 2009-12-31 12:20:57 UTC (rev 1165) +++ trunk/data/materials/station.material 2009-12-31 12:34:21 UTC (rev 1166) @@ -192,7 +192,7 @@ set_texture_alias ImageFallback TausetiStationBackground.png } -material Sta/TS/Window +material Sta/TS/Window1 { technique { @@ -220,7 +220,7 @@ } } -material Sta/TS/Window1 : StationNormSpec +material Sta/TS/Window : StationNormSpec { set_texture_alias Image TausetiStationWindow.png set_texture_alias ImageNormMap TausetiStationWindowBM.png This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-31 12:43:21
|
Revision: 1165 http://opengate.svn.sourceforge.net/opengate/?rev=1165&view=rev Author: spom_spom Date: 2009-12-31 12:20:57 +0000 (Thu, 31 Dec 2009) Log Message: ----------- Add missing xml-key for cegui-layout files Modified Paths: -------------- branches/ogEditor/ogEditor/apps/opengate/ceguiLayoutApp.py branches/ogEditor/ogEditor/apps/opengate/opengateedit.py branches/ogEditor/ogEditor/apps/opengate/test/testOpengate.py branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py trunk/data/gui/layouts/dialogs/ConfigControlKey.layout trunk/data/gui/layouts/dialogs/ConfigDialog.layout trunk/data/gui/layouts/dialogs/MarketDialog.layout trunk/data/gui/layouts/dialogs/MarketItemShortDialog.layout trunk/data/gui/layouts/dialogs/ShipConfigDialog.layout trunk/data/gui/layouts/dialogs/ShipConfigEquipmentButton.layout trunk/data/gui/layouts/opengateConsole.layout trunk/data/gui/layouts/opengateDocked.layout trunk/data/gui/layouts/opengateUnDocked.layout trunk/data/materials/planet.cg trunk/data/materials/planet.material trunk/data/materials/station.material trunk/data/misc/test.sector trunk/data/ships/octavius/apteryx/apteryx.material trunk/data/skybox/skybox.material trunk/src/SectorEnvironmentObject.cpp trunk/src/SectorStationObject.cpp Modified: branches/ogEditor/ogEditor/apps/opengate/ceguiLayoutApp.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/ceguiLayoutApp.py 2009-12-28 21:29:43 UTC (rev 1164) +++ branches/ogEditor/ogEditor/apps/opengate/ceguiLayoutApp.py 2009-12-31 12:20:57 UTC (rev 1165) @@ -291,7 +291,9 @@ outfile = open( self.fullFileName, "w" ) xml = XMLSerializer( outfile ) + xml.openTag( 'GUILayout' ) self.window.writeXML( xml ) + xml.closeTag( ) outfile.close() self.toolBar_.EnableTool( self.tbSave.GetId(), False ) self.toolBar_.Refresh() Modified: branches/ogEditor/ogEditor/apps/opengate/opengateedit.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-28 21:29:43 UTC (rev 1164) +++ branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-31 12:20:57 UTC (rev 1165) @@ -33,9 +33,10 @@ def toOgreColour( colour ): return ogre.ColourValue( colour[0]/255.0, colour[1]/255.0, colour[2]/255.0) +def toWxColour( colour ): return wx.Colour( int( colour[0]*255.0 ), int( colour[1]*255.0 ), int( colour[2]*255.0) ) +def toList( vec ): return [vec[0], vec[1], vec[2] ]; +def toOgreVector3( string ): v = string[1:-1].split(','); return ogre.Vector3( float( v[ 0 ] ), float( v[ 1 ] ), float( v[2] ) ) -def toWxColour( colour ): print colour; return wx.Colour( int( colour[0]*255.0 ), int( colour[1]*255.0 ), int( colour[2]*255.0) ) - class OgreMoveableItem( AppResource ): def __init__( self, parent, rendererSlot, propertyInspectorSlot ): AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) @@ -89,28 +90,24 @@ panel.append( prop, None ) prop = wxpg.ColourProperty( name = mat.getName() + "Tech"+str(i)+"P"+str( j )+"setAmbient" , label = "setAmbient", value = toWxColour( pas.getAmbient() ) ) - panel.append( prop, cback = [self.setColour, pas.setAmbient ] + panel.append( prop, cback = ( pas.setAmbient, toOgreColour ) , toolTip = "Sets the ambient colour reflectance properties for every Pass in every Technique.") prop = wxpg.ColourProperty( name = mat.getName() + "Tech"+str(i)+"P"+str( j )+"setDiffuse" , label = "setDiffuse", value = toWxColour( pas.getDiffuse() ) ) - panel.append( prop, cback = [self.setColour, pas.setDiffuse ] + panel.append( prop, cback = ( pas.setDiffuse, toOgreColour ) , toolTip = "Sets the diffuse colour reflectance properties of every Pass in every Technique.") prop = wxpg.ColourProperty( name = mat.getName() + "Tech"+str(i)+"P"+str( j )+"setSpecular" , label = "setSpecular", value = toWxColour( pas.getSpecular() ) ) - panel.append( prop, cback = [self.setColour, pas.setSpecular ] + panel.append( prop, cback = ( pas.setSpecular, toOgreColour ) , toolTip = "Sets the specular colour reflectance properties of every Pass in every Technique." ) prop = wxpg.ColourProperty( name = mat.getName() + "Tech"+str(i)+"P"+str( j )+"setSelfIllumination" , label = "setSelfIllumination", value = toWxColour( pas.getSelfIllumination() ) ) - panel.append( prop, cback = [self.setColour, pas.setSelfIllumination ] + panel.append( prop, cback = ( pas.setSelfIllumination, toOgreColour ) , toolTip = "Sets the amount of self-illumination an object has." ) - def setColour( self, name, value, string, args ): - print "setColour", name, value, string, args - args[ 1 ]( toOgreColour( value ) ) - def setMovable( self, obj ): self.obj_ = obj if hasattr( obj, 'getMovableType' ): @@ -134,6 +131,46 @@ self.node_ = node self.dumpSceneNode_( node ) + def createPropertyPanel( self, parent ): + if not HAVE_PROPGRID: + return wx.Panel( parent ) + + panel = wxPropGridWrapper( parent ) + panel.Append( wxpg.PropertyCategory( "Ogre.SceneNode" ) ) + + node = self.node_ + prop = wxpg.StringProperty( name = node.getName() + "Name" + , label = "Name", value = node.getName() ) + panel.append( prop, None, toolTip = "Name of the node" ) + + prop = wxpg.BoolProperty( name = node.getName() + "Visibility", label = "Visibile" ) + prop.DoSetAttribute( 'UseCheckbox', 1 ) + prop.DoSetAttribute( 'UseDClickCycling', 1 ) + panel.append( prop, node.setVisible, toolTip = "Make all objects attached to this node become visible / invisible." ) + + prop = wxpg.BoolProperty( name = node.getName() + "ShowBoundingbox", label = "BoundingBox" + , value = node.getShowBoundingBox() ) + prop.DoSetAttribute( 'UseCheckbox', 1 ) + prop.DoSetAttribute( 'UseDClickCycling', 1 ) + panel.append( prop, node.showBoundingBox, toolTip = "Allows the showing of the node's bounding box" ) + + prop = wxpg.StringProperty( name = node.getName() + "Position" + , label = "Position", value = str( toList( node.getPosition() ) ) ) + panel.append( prop, cback = ( node.setPosition, toOgreVector3 ), toolTip = "Sets the position of the node relative to it's parent." ) + + prop = wxpg.StringProperty( name = node.getName() + "Scale" + , label = "Scale", value = str( toList( node.getScale() ) ) ) + panel.append( prop, cback = ( node.setScale, toOgreVector3 ), toolTip = "Sets the scaling factor applied to this node." ) + + #node.setPosition( [2000.0, 0.0, 4000.0 ]) + #setScale (const Vector3 &scale) + + #yaw (const Radian &angle, TransformSpace relativeTo=TS_LOCAL) + #roll (const Radian &angle, TransformSpace relativeTo=TS_LOCAL) + #pitch (const Radian &angle, TransformSpace relativeTo=TS_LOCAL) + return panel + + def dumpSceneNode_( self, scenenode ): tree = self.parent.resourceTree; if scenenode is None: Modified: branches/ogEditor/ogEditor/apps/opengate/test/testOpengate.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/test/testOpengate.py 2009-12-28 21:29:43 UTC (rev 1164) +++ branches/ogEditor/ogEditor/apps/opengate/test/testOpengate.py 2009-12-31 12:20:57 UTC (rev 1165) @@ -17,4 +17,5 @@ print foo.vec() foo.setNode( node ) print foo.node().getName() -print dir(og) \ No newline at end of file +print dir(og) + Modified: branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py =================================================================== --- branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py 2009-12-28 21:29:43 UTC (rev 1164) +++ branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py 2009-12-31 12:20:57 UTC (rev 1165) @@ -35,11 +35,16 @@ print "GetValue", p.GetValue() #print "GetValueRef", p.GetValueRef() if p.GetClientData(): - if type( p.GetClientData() ) == list: + if type( p.GetClientData() ) == tuple: + p.GetClientData()[0]( p.GetClientData()[1]( p.GetValue() ) ) + elif type( p.GetClientData() ) == list: p.GetClientData()[0]( name = p.GetName(), value = p.GetValue(), string = p.GetValueAsString() , args = p.GetClientData() ) else: try: - p.GetClientData()( name = p.GetName(), value = p.GetValue(), string = p.GetValueAsString() ) + p.GetClientData()( p.GetValue() ) except: - p.GetClientData()( name = p.GetName(), value = p.GetValue() ) \ No newline at end of file + try: + p.GetClientData()( name = p.GetName(), value = p.GetValue(), string = p.GetValueAsString() ) + except: + p.GetClientData()( name = p.GetName(), value = p.GetValue() ) \ No newline at end of file Modified: trunk/data/gui/layouts/dialogs/ConfigControlKey.layout =================================================================== --- trunk/data/gui/layouts/dialogs/ConfigControlKey.layout 2009-12-28 21:29:43 UTC (rev 1164) +++ trunk/data/gui/layouts/dialogs/ConfigControlKey.layout 2009-12-31 12:20:57 UTC (rev 1165) @@ -1,73 +1,79 @@ <?xml version="1.0" encoding="UTF-8"?> -<Window Type="opengate/StaticFrame" Name="Config/Controls/Key" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Image" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> - <Property Name="UnifiedSize" Value="{{0,400},{0,30}}" /> - <Window Type="opengate/StaticTextLabel" Name="Config/Controls/Key/Name" > +<GUILayout > + <Window Type="opengate/StaticFrame" Name="Config/Controls/Key" > <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="KeyName" /> + <Property Name="Text" Value="" /> <Property Name="Disabled" Value="False" /> <Property Name="RiseOnClick" Value="True" /> <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-14" /> - <Property Name="NormalTextColour" Value="FF88D997" /> - <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="CentreAligned" /> - <Property Name="HorzLabelFormatting" Value="LeftAligned" /> - <Property Name="UnifiedPosition" Value="{{0,10},{0,0}}" /> - <Property Name="UnifiedSize" Value="{{1,-210},{1,0}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/Controls/Key/KeyButton1" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="Key 1" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="NormalTextColour" Value="FFFFFFFF" /> - <Property Name="HoverTextColour" Value="FFFFFFFF" /> - <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="CentreAligned" /> - <Property Name="HorzLabelFormatting" Value="CentreAligned" /> - <Property Name="HoverImage" Value="" /> - <Property Name="NormalImage" Value="" /> - <Property Name="PushedImage" Value="" /> - <Property Name="UnifiedPosition" Value="{{1,-205},{0,5}}" /> - <Property Name="UnifiedSize" Value="{{0,100},{1,-10}}" /> + <Property Name="Image" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{0,400},{0,30}}" /> + <Window Type="opengate/StaticTextLabel" Name="Config/Controls/Key/Name" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="KeyName" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-14" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="LeftAligned" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,10},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,-210},{1,0}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/Controls/Key/KeyButton1" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Key 1" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="HoverTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{1,-205},{0,5}}" /> + <Property Name="UnifiedSize" Value="{{0,100},{1,-10}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/Controls/Key/KeyButton2" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Key 2" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="HoverTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{1,-100},{0,5}}" /> + <Property Name="UnifiedSize" Value="{{0,100},{1,-10}}" /> + </Window> </Window> - <Window Type="opengate/Button" Name="Config/Controls/Key/KeyButton2" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="Key 2" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="NormalTextColour" Value="FFFFFFFF" /> - <Property Name="HoverTextColour" Value="FFFFFFFF" /> - <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="CentreAligned" /> - <Property Name="HorzLabelFormatting" Value="CentreAligned" /> - <Property Name="HoverImage" Value="" /> - <Property Name="NormalImage" Value="" /> - <Property Name="PushedImage" Value="" /> - <Property Name="UnifiedPosition" Value="{{1,-100},{0,5}}" /> - <Property Name="UnifiedSize" Value="{{0,100},{1,-10}}" /> - </Window> -</Window> \ No newline at end of file +</GUILayout> \ No newline at end of file Modified: trunk/data/gui/layouts/dialogs/ConfigDialog.layout =================================================================== --- trunk/data/gui/layouts/dialogs/ConfigDialog.layout 2009-12-28 21:29:43 UTC (rev 1164) +++ trunk/data/gui/layouts/dialogs/ConfigDialog.layout 2009-12-31 12:20:57 UTC (rev 1165) @@ -1,283 +1,239 @@ <?xml version="1.0" encoding="UTF-8"?> -<Window Type="opengate/StaticImage" Name="Config/Main" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Property Name="InheritsAlpha" Value="False" /> - <Property Name="BackgroundEnabled" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Image" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> - <Property Name="UnifiedSize" Value="{{1,0},{1,0}}" /> - <Window Type="opengate/StaticImage" Name="Config/WindowFrameLeft" > +<GUILayout > + <Window Type="opengate/StaticImage" Name="Config/Main" > <Property Name="Visible" Value="True" /> <Property Name="Text" Value="" /> <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="False" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Image" Value="set:opengateConfigWindow image:ConfigWindowFrameLeft" /> - <Property Name="UnifiedPosition" Value="{{0,20},{0,20}}" /> - <Property Name="UnifiedSize" Value="{{0,122},{0,705}}" /> - </Window> - <Window Type="opengate/StaticImage" Name="Config/WindowFrameMiddle" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="False" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Image" Value="set:opengateConfigWindow image:ConfigWindowFrameMiddle" /> - <Property Name="UnifiedPosition" Value="{{0,142},{0,20}}" /> - <Property Name="UnifiedSize" Value="{{1,-417},{0,705}}" /> - </Window> - <Window Type="opengate/StaticImage" Name="Config/WindowFrameRight" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="False" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Image" Value="set:opengateConfigWindow image:ConfigWindowFrameRight" /> - <Property Name="UnifiedPosition" Value="{{1,-275},{0,20}}" /> - <Property Name="UnifiedSize" Value="{{0,255},{0,705}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/ConnectButton" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="Connection" /> - <Property Name="Disabled" Value="True" /> <Property Name="RiseOnClick" Value="True" /> <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="NormalTextColour" Value="FFFFFFFF" /> - <Property Name="HoverTextColour" Value="FFFFFFFF" /> - <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="CentreAligned" /> - <Property Name="HorzLabelFormatting" Value="CentreAligned" /> - <Property Name="HoverImage" Value="" /> - <Property Name="NormalImage" Value="" /> - <Property Name="PushedImage" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,100},{0,150}}" /> - <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/VideoButton" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="Video" /> - <Property Name="Disabled" Value="True" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="NormalTextColour" Value="FFFFFFFF" /> - <Property Name="HoverTextColour" Value="FFFFFFFF" /> - <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="CentreAligned" /> - <Property Name="HorzLabelFormatting" Value="CentreAligned" /> - <Property Name="HoverImage" Value="" /> - <Property Name="NormalImage" Value="" /> - <Property Name="PushedImage" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,190},{0,150}}" /> - <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/GraphicButton" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="Graphics" /> - <Property Name="Disabled" Value="True" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="NormalTextColour" Value="FFFFFFFF" /> - <Property Name="HoverTextColour" Value="FFFFFFFF" /> - <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="CentreAligned" /> - <Property Name="HorzLabelFormatting" Value="CentreAligned" /> - <Property Name="HoverImage" Value="" /> - <Property Name="NormalImage" Value="" /> - <Property Name="PushedImage" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,280},{0,150}}" /> - <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/SoundButton" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="Sound" /> - <Property Name="Disabled" Value="True" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="NormalTextColour" Value="FFFFFFFF" /> - <Property Name="HoverTextColour" Value="FFFFFFFF" /> - <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="CentreAligned" /> - <Property Name="HorzLabelFormatting" Value="CentreAligned" /> - <Property Name="HoverImage" Value="" /> - <Property Name="NormalImage" Value="" /> - <Property Name="PushedImage" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,460},{0,150}}" /> - <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/ControlsButton" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="Controls" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="NormalTextColour" Value="FFFFFFFF" /> - <Property Name="HoverTextColour" Value="FFFFFFFF" /> - <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="CentreAligned" /> - <Property Name="HorzLabelFormatting" Value="CentreAligned" /> - <Property Name="HoverImage" Value="" /> - <Property Name="NormalImage" Value="" /> - <Property Name="PushedImage" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,370},{0,150}}" /> - <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/CreditsButton" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="Credits" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="True" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="NormalTextColour" Value="FFFFFFFF" /> - <Property Name="HoverTextColour" Value="FFFFFFFF" /> - <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="CentreAligned" /> - <Property Name="HorzLabelFormatting" Value="CentreAligned" /> - <Property Name="HoverImage" Value="" /> - <Property Name="NormalImage" Value="" /> - <Property Name="PushedImage" Value="" /> - <Property Name="UnifiedPosition" Value="{{1,-150},{0,150}}" /> - <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/QuitButton" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="Quit" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="True" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="NormalTextColour" Value="FFFFFFFF" /> - <Property Name="HoverTextColour" Value="FFFFFFFF" /> - <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="CentreAligned" /> - <Property Name="HorzLabelFormatting" Value="CentreAligned" /> - <Property Name="HoverImage" Value="" /> - <Property Name="NormalImage" Value="" /> - <Property Name="PushedImage" Value="" /> - <Property Name="UnifiedPosition" Value="{{1,-150},{0,670}}" /> - <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/BackButton" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="Back" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="True" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="NormalTextColour" Value="FFFFFFFF" /> - <Property Name="HoverTextColour" Value="FFFFFFFF" /> - <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="CentreAligned" /> - <Property Name="HorzLabelFormatting" Value="CentreAligned" /> - <Property Name="HoverImage" Value="" /> - <Property Name="NormalImage" Value="" /> - <Property Name="PushedImage" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,100},{0,670}}" /> - <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> - </Window> - <Window Type="opengate/StaticFrame" Name="Config/Credits" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> <Property Name="FrameEnabled" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="False" /> + <Property Name="BackgroundEnabled" Value="True" /> <Property Name="MousePassThroughEnabled" Value="False" /> <Property Name="Font" Value="BlueHighway-12" /> <Property Name="Image" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,100},{0,200}}" /> - <Property Name="UnifiedSize" Value="{{1,-180},{0,450}}" /> - <Window Type="opengate/StaticTextLabel" Name="Config/Credits/Header" > + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{1,0}}" /> + <Window Type="opengate/StaticImage" Name="Config/WindowFrameLeft" > <Property Name="Visible" Value="True" /> <Property Name="Text" Value="" /> <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="False" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="set:opengateConfigWindow image:ConfigWindowFrameLeft" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,20},{0,20}}" /> + <Property Name="UnifiedSize" Value="{{0,122},{0,705}}" /> + </Window> + <Window Type="opengate/StaticImage" Name="Config/WindowFrameMiddle" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="False" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="set:opengateConfigWindow image:ConfigWindowFrameMiddle" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,142},{0,20}}" /> + <Property Name="UnifiedSize" Value="{{1,-417},{0,705}}" /> + </Window> + <Window Type="opengate/StaticImage" Name="Config/WindowFrameRight" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="False" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="set:opengateConfigWindow image:ConfigWindowFrameRight" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{1,-275},{0,20}}" /> + <Property Name="UnifiedSize" Value="{{0,255},{0,705}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/ConnectButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Connection" /> + <Property Name="Disabled" Value="True" /> <Property Name="RiseOnClick" Value="True" /> <Property Name="AlwaysOnTop" Value="False" /> <Property Name="InheritsAlpha" Value="True" /> <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-18" /> - <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="HoverTextColour" Value="FFFFFFFF" /> <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="LeftAligned" /> - <Property Name="HorzLabelFormatting" Value="TopAligned" /> - <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> - <Property Name="UnifiedSize" Value="{{1,0},{0,30}}" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,150}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> </Window> - <Window Type="opengate/ConsoleListbox" Name="Config/Credits/Body" > + <Window Type="opengate/Button" Name="Config/VideoButton" > <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="" /> + <Property Name="Text" Value="Video" /> + <Property Name="Disabled" Value="True" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="HoverTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,190},{0,150}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/GraphicButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Graphics" /> + <Property Name="Disabled" Value="True" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="HoverTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,280},{0,150}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/SoundButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Sound" /> + <Property Name="Disabled" Value="True" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="HoverTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,460},{0,150}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/ControlsButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Controls" /> <Property Name="Disabled" Value="False" /> <Property Name="RiseOnClick" Value="True" /> <Property Name="AlwaysOnTop" Value="False" /> <Property Name="InheritsAlpha" Value="True" /> <Property Name="MousePassThroughEnabled" Value="False" /> <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="UnifiedPosition" Value="{{0,0},{0,35}}" /> - <Property Name="UnifiedSize" Value="{{1,0},{1,-35}}" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="HoverTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,370},{0,150}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> </Window> - </Window> - <Window Type="opengate/StaticFrame" Name="Config/Controls" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Image" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,100},{0,200}}" /> - <Property Name="UnifiedSize" Value="{{1,-180},{0,450}}" /> - <Window Type="opengate/StaticFrame" Name="Config/Controls/Header" > + <Window Type="opengate/Button" Name="Config/CreditsButton" > <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Credits" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="True" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="HoverTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{1,-150},{0,150}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/QuitButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Quit" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="True" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="HoverTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{1,-150},{0,670}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/BackButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Back" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="True" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="HoverTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,670}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/StaticFrame" Name="Config/Credits" > + <Property Name="Visible" Value="True" /> <Property Name="Text" Value="" /> <Property Name="Disabled" Value="False" /> <Property Name="RiseOnClick" Value="True" /> @@ -288,10 +244,41 @@ <Property Name="MousePassThroughEnabled" Value="False" /> <Property Name="Font" Value="BlueHighway-12" /> <Property Name="Image" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> - <Property Name="UnifiedSize" Value="{{1,0},{0,35}}" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,200}}" /> + <Property Name="UnifiedSize" Value="{{1,-180},{0,450}}" /> + <Window Type="opengate/StaticTextLabel" Name="Config/Credits/Header" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-18" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{0,30}}" /> + </Window> + <Window Type="opengate/ConsoleListbox" Name="Config/Credits/Body" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,35}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{1,-35}}" /> + </Window> </Window> - <Window Type="opengate/StaticFrame" Name="Config/Controls/Body" > + <Window Type="opengate/StaticFrame" Name="Config/Controls" > <Property Name="Visible" Value="True" /> <Property Name="Text" Value="" /> <Property Name="Disabled" Value="False" /> @@ -303,8 +290,41 @@ <Property Name="MousePassThroughEnabled" Value="False" /> <Property Name="Font" Value="BlueHighway-12" /> <Property Name="Image" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,0},{0,35}}" /> - <Property Name="UnifiedSize" Value="{{1,0},{1,-35}}" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,200}}" /> + <Property Name="UnifiedSize" Value="{{1,-180},{0,450}}" /> + <Window Type="opengate/StaticFrame" Name="Config/Controls/Header" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{0,35}}" /> + </Window> + <Window Type="opengate/StaticFrame" Name="Config/Controls/Body" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,35}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{1,-35}}" /> + </Window> </Window> </Window> -</Window> \ No newline at end of file +</GUILayout> \ No newline at end of file Modified: trunk/data/gui/layouts/dialogs/MarketDialog.layout =================================================================== --- trunk/data/gui/layouts/dialogs/MarketDialog.layout 2009-12-28 21:29:43 UTC (rev 1164) +++ trunk/data/gui/layouts/dialogs/MarketDialog.layout 2009-12-31 12:20:57 UTC (rev 1165) @@ -1,113 +1,37 @@ <?xml version="1.0" encoding="UTF-8"?> -<Window Type="opengate/StaticGreenImage" Name="MarketDialog" > - <Property Name="Visible" Value="True" /> - <Property Name="Text" Value="Market" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="FrameEnabled" Value="True" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="BackgroundEnabled" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="True" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Image" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,100},{0,115}}" /> - <Property Name="UnifiedSize" Value="{{1,-167},{1,-217}}" /> - <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView" > - <Property Name="Visible" Value="False" /> - <Property Name="Text" Value="" /> +<GUILayout > + <Window Type="opengate/StaticGreenImage" Name="MarketDialog" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Market" /> <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> <Property Name="AlwaysOnTop" Value="False" /> <Property Name="FrameEnabled" Value="True" /> <Property Name="InheritsAlpha" Value="True" /> <Property Name="BackgroundEnabled" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="True" /> <Property Name="Font" Value="BlueHighway-12" /> <Property Name="Image" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,220},{0,10}}" /> - <Property Name="UnifiedSize" Value="{{1,-230},{1,-170}}" /> - <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/TopLeft" > + <Property Name="MouseCursorImage" Value="set:opengateCursor image:Cursor1" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,115}}" /> + <Property Name="UnifiedSize" Value="{{1,-167},{1,-217}}" /> + <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView" > <Property Name="Visible" Value="False" /> <Property Name="Text" Value="" /> <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> + <Property Name="RiseOnClick" Value="False" /> <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> + <Property Name="FrameEnabled" Value="True" /> <Property Name="InheritsAlpha" Value="True" /> - <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="BackgroundEnabled" Value="True" /> <Property Name="MousePassThroughEnabled" Value="False" /> <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Image" Value="set:opengate image:StaticGreenTopLeft" /> - <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> - <Property Name="UnifiedSize" Value="{{0,31},{0,31}}" /> - </Window> - <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/Top" > - <Property Name="Visible" Value="False" /> - <Property Name="Text" Value="" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Image" Value="set:opengate image:StaticGreenTop" /> - <Property Name="UnifiedPosition" Value="{{0,31},{0,0}}" /> - <Property Name="UnifiedSize" Value="{{1,-62},{0,31}}" /> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/Top/Title" > - <Property Name="Visible" Value="False" /> - <Property Name="Text" Value="Would you like to purchase this item?" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="False" /> - <Property Name="AlwaysOnTop" Value="True" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-16" /> - <Property Name="NormalTextColour" Value="FF88D997" /> - <Property Name="HoverTextColour" Value="00000000" /> - <Property Name="DisabledTextColour" Value="FF7F7F7F" /> - <Property Name="VertLabelFormatting" Value="LeftAligned" /> - <Property Name="HorzLabelFormatting" Value="TopAligned" /> - <Property Name="HoverImage" Value="" /> - <Property Name="NormalImage" Value="" /> - <Property Name="PushedImage" Value="" /> - <Property Name="UnifiedPosition" Value="{{0,10},{0,10}}" /> - <Property Name="UnifiedSize" Value="{{1,0},{0,20}}" /> - </Window> - </Window> - <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/TopRight" > - <Property Name="Visible" Value="False" /> - <Property Name="Text" Value="" /> - <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> - <Property Name="AlwaysOnTop" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Property Name="InheritsAlpha" Value="True" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="MousePassThroughEnabled" Value="False" /> - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Image" Value="set:opengate image:StaticGreenTopRight" /> - <Property Name="UnifiedPosition" Value="{{1,-31},{0,0}}" /> - <Property Name="UnifiedSize" Value="{{0,31},{0,31}}" /> - </Window> - <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/Image/Frame" > - <Property Name="Visible" Value="False" /> - <Property Name="Text" Value="" /> - <Property Name="Disable... [truncated message content] |
From: <spo...@us...> - 2009-12-28 21:29:53
|
Revision: 1164 http://opengate.svn.sourceforge.net/opengate/?rev=1164&view=rev Author: spom_spom Date: 2009-12-28 21:29:43 +0000 (Mon, 28 Dec 2009) Log Message: ----------- add global light source (Sun) and fixed planet rendering Modified Paths: -------------- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py trunk/data/materials/advancedMaterials.material trunk/data/materials/planet.material trunk/data/materials/planets.material trunk/data/materials/station.material trunk/data/misc/misc.material trunk/src/AiObject.h trunk/src/Sector.cpp trunk/src/SectorEnvironmentObject.cpp trunk/src/SectorEnvironmentObject.h trunk/src/UnDockedState.cpp trunk/src/common.cpp trunk/src/common.h trunk/src/commonWithOgre.cpp trunk/src/networkClient.cpp trunk/src/networkClient.h Added Paths: ----------- branches/ogEditor/ogEditor/resources/icons/arrow-right.png branches/ogEditor/ogEditor/resources/icons/process-stop.png Removed Paths: ------------- trunk/src/Projectile.cpp trunk/src/Projectile.h Modified: branches/ogEditor/ogEditor/apps/opengate/opengateedit.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-26 20:44:55 UTC (rev 1163) +++ branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-28 21:29:43 UTC (rev 1164) @@ -32,6 +32,10 @@ print "no python bindung for opengate lib found" +def toOgreColour( colour ): return ogre.ColourValue( colour[0]/255.0, colour[1]/255.0, colour[2]/255.0) + +def toWxColour( colour ): print colour; return wx.Colour( int( colour[0]*255.0 ), int( colour[1]*255.0 ), int( colour[2]*255.0) ) + class OgreMoveableItem( AppResource ): def __init__( self, parent, rendererSlot, propertyInspectorSlot ): AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) @@ -79,10 +83,34 @@ panel.append( prop, None ) for j in range( tech.getNumPasses() ): pas = tech.getPass( j ) + prop = wxpg.StringProperty( name = mat.getName() + "Technique"+str(i)+"Pass"+str( j ) , label = "Pass", value = pas.getName() ) panel.append( prop, None ) + prop = wxpg.ColourProperty( name = mat.getName() + "Tech"+str(i)+"P"+str( j )+"setAmbient" + , label = "setAmbient", value = toWxColour( pas.getAmbient() ) ) + panel.append( prop, cback = [self.setColour, pas.setAmbient ] + , toolTip = "Sets the ambient colour reflectance properties for every Pass in every Technique.") + prop = wxpg.ColourProperty( name = mat.getName() + "Tech"+str(i)+"P"+str( j )+"setDiffuse" + , label = "setDiffuse", value = toWxColour( pas.getDiffuse() ) ) + panel.append( prop, cback = [self.setColour, pas.setDiffuse ] + , toolTip = "Sets the diffuse colour reflectance properties of every Pass in every Technique.") + + prop = wxpg.ColourProperty( name = mat.getName() + "Tech"+str(i)+"P"+str( j )+"setSpecular" + , label = "setSpecular", value = toWxColour( pas.getSpecular() ) ) + panel.append( prop, cback = [self.setColour, pas.setSpecular ] + , toolTip = "Sets the specular colour reflectance properties of every Pass in every Technique." ) + + prop = wxpg.ColourProperty( name = mat.getName() + "Tech"+str(i)+"P"+str( j )+"setSelfIllumination" + , label = "setSelfIllumination", value = toWxColour( pas.getSelfIllumination() ) ) + panel.append( prop, cback = [self.setColour, pas.setSelfIllumination ] + , toolTip = "Sets the amount of self-illumination an object has." ) + + def setColour( self, name, value, string, args ): + print "setColour", name, value, string, args + args[ 1 ]( toOgreColour( value ) ) + def setMovable( self, obj ): self.obj_ = obj if hasattr( obj, 'getMovableType' ): @@ -134,9 +162,22 @@ self.camera_ = None def activate( self, active ): - print "activate( self, active ):", self - self.camera_.lookAt( self.obj_.mainNode().getPosition() ) + if active: + #currPos = self.camera_.getParentSceneNode().getPosition() + #currDir = self.camera_.getParentSceneNode().getOrientation() * ogre.Vector3( 0.0, 0.0, -1.0 ) + #currDir.normalise(); + #targetPos = self.obj_.mainNode().getPosition(); + #targetDir = targetPos - currPos; + #targetDir.normalise(); + + #rot = currDir.getRotationTo( targetDir ); + #rot.normalise(); + + #self.camera_.getParentSceneNode().rotate( rot ) + self.camera_.lookAt( self.obj_.mainNode().getPosition() ) + #self.camera_.getParentSceneNode().lookAt( self.obj_.mainNode().getPosition(), ogre.Node.TS_LOCAL ) + def setObject( self, obj, camera ): self.obj_ = obj self.camera_ = camera @@ -157,13 +198,60 @@ self.resourceManager_.ogreRoot = OgreWindow.ogreRoot self.resourceManager_.renderWindow = OgreWindow.renderWindow self.sceneManager_ = OgreWindow.sceneManager - self.camera_ = OgreWindow.camera + self.camera_ = OgreWindow.camera + self.toolBar_ = None + self.sectorUpdateTimer = wx.Timer() + self.updateTime_ = 33; + + self.sectorUpdateTimer.Bind( wx.EVT_TIMER, self.sectorUpdate ) #Bind the timer events to Ogre rendering + for res in OgreWindow.resourceLocations: self.resourceManager_.addResourceLocation( res[0], res[1] ) self.initOpenGateResources_() + def getToolBar( self, parent ): + if self.toolBar_ is None: + self.toolBar_ = aui.AuiToolBar( parent, -1, wx.DefaultPosition, wx.DefaultSize, + aui.AUI_TB_DEFAULT_STYLE | aui.AUI_TB_PLAIN_BACKGROUND ) + + self.toolBar_.SetName( "Opengate Toolbar" ) + + self.toolBar_.SetToolBitmapSize( wx.Size( 22, 22 ) ) + + self.tbStart = self.toolBar_.AddSimpleTool( wx.NewId(), "Start", loadIcon( "arrow-right.png" ) + , "Start sector update cycle" + ) + self.tbStart.SetDisabledBitmap( MakeDisabledBitmap( loadIcon( "arrow-right.png" ) ) ) + + self.tbStop = self.toolBar_.AddSimpleTool( wx.NewId(), "Stop", loadIcon( "process-stop.png" ) + , "Stop sector update cycle" + ) + self.tbStop.SetDisabledBitmap( MakeDisabledBitmap( loadIcon( "process-stop.png" ) ) ) + + self.toolBar_.EnableTool( self.tbStop.GetId(), False ) + + wx.EVT_TOOL( self.toolBar_, self.tbStart.GetId(), self.onSectorUpdateStart ) + wx.EVT_TOOL( self.toolBar_, self.tbStop.GetId(), self.onSectorUpdateStop ) + + return self.toolBar_ + + def onSectorUpdateStart( self, event = None ): + self.sectorUpdateTimer.Start( self.updateTime_ ) + self.toolBar_.EnableTool( self.tbStart.GetId(), False ) + self.toolBar_.EnableTool( self.tbStop.GetId(), True ) + self.toolBar_.Refresh() + + def onSectorUpdateStop( self, event = None ): + self.sectorUpdateTimer.Stop( ) + self.toolBar_.EnableTool( self.tbStart.GetId(), True ) + self.toolBar_.EnableTool( self.tbStop.GetId(), False ) + self.toolBar_.Refresh() + + def sectorUpdate( self, event = None ): + self.sector_.update( self.updateTime_ / 50.0 ) + def createPropertyPanel( self, parent ): if not HAVE_PROPGRID: return wx.Panel( parent ) @@ -178,8 +266,7 @@ prop = wxpg.EnumProperty( "Shader scheme", labels = ( "Default", "vpfp" ), values = [1,2,3], value = 3 ) panel.append( prop, self.onShaderChange ) - self.sceneManager_.setAmbientLight( ogre.ColourValue( 10.0/256.0, 10.0/256.0, 10.0/256.0) ) - prop = wxpg.ColourProperty( "Ambient light", value = wx.Colour( 10, 10, 10 ) ) + prop = wxpg.ColourProperty( "Ambient light", value = toWxColour( self.sceneManager_.getAmbientLight() ) ) panel.append( prop, self.onAmbientLightChange ) return panel @@ -190,7 +277,7 @@ def onAmbientLightChange( self, name, value, string ): print "onAmbientLightChange( self, name, value, string ):", name, value, string - self.sceneManager_.setAmbientLight( ogre.ColourValue( value[0]/256.0, value[1]/256.0, value[2]/256.0) ) + self.sceneManager_.setAmbientLight( toOgreColour( value ) ) def initOpenGateResources_( self ): self.resourceManager_.loadGlobalIDs( "ids.xml" ) @@ -219,6 +306,10 @@ for category in categories: categoryNode = tree.AppendItem( ogEntityManagerNode, category ) + self.parent.resourceTree.Expand( self.treeItem ) + + self.parent.resourceTree.Expand( self.sectorTreeNode_ ) + def showSector( self, name ): self.sector_ = og.Sector( self.sceneManager_, None ) self.sector_.populate( name ) @@ -362,6 +453,7 @@ it.fullFileName = l[1] it.guiSystem = self.GUISystem + self.parent.resourceTree.Expand( root ) def findResources( self, filesystem, pattern ): for res in self.renderer_.resourceLocations: Added: branches/ogEditor/ogEditor/resources/icons/arrow-right.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/ogEditor/resources/icons/arrow-right.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/ogEditor/resources/icons/process-stop.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/ogEditor/resources/icons/process-stop.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py =================================================================== --- branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-26 20:44:55 UTC (rev 1163) +++ branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-28 21:29:43 UTC (rev 1164) @@ -312,6 +312,7 @@ validMove = self.moveKeyDict.get( event.m_keyCode, False ) if validMove: self.sceneEntities.cameraNode.translate( validMove, self.sceneEntities.cameraNode.TS_LOCAL ) + #self.sceneEntities.camera.translate( validMove ) #print ( "cam position %s, direction: %s" % ( toStr( self.sceneEntities.cameraNode.getPosition() ), #toStr( self.sceneEntities.camera.getDirection() ) ) ) @@ -333,8 +334,10 @@ dy = self.StartDragY -y self.StartDragX, self.StartDragY = x, y - self.sceneEntities.cameraNode.yaw( ogre.Degree( dx / 5.0 ), ogre.Node.TS_LOCAL ) - self.sceneEntities.cameraNode.pitch( ogre.Degree( dy / 5.0 ), ogre.Node.TS_LOCAL ) + #self.sceneEntities.cameraNode.yaw( ogre.Degree( dx / 5.0 ), ogre.Node.TS_LOCAL ) + #self.sceneEntities.cameraNode.pitch( ogre.Degree( dy / 5.0 ), ogre.Node.TS_LOCAL ) + self.sceneEntities.camera.yaw( ogre.Degree( dx / 5.0 ) ) + self.sceneEntities.camera.pitch( ogre.Degree( dy / 5.0 ) ) for l in self.listener: l.onMouseEvent( event ) Modified: branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py =================================================================== --- branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py 2009-12-26 20:44:55 UTC (rev 1163) +++ branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py 2009-12-28 21:29:43 UTC (rev 1164) @@ -25,6 +25,7 @@ self.Append( prop ) else: self.AppendIn( parent, prop ) + return prop def onPropGridChange(self, event): @@ -34,7 +35,11 @@ print "GetValue", p.GetValue() #print "GetValueRef", p.GetValueRef() if p.GetClientData(): - try: - p.GetClientData()( name = p.GetName(), value = p.GetValue(), string = p.GetValueAsString() ) - except: - p.GetClientData()( name = p.GetName(), value = p.GetValue() ) \ No newline at end of file + if type( p.GetClientData() ) == list: + p.GetClientData()[0]( name = p.GetName(), value = p.GetValue(), string = p.GetValueAsString() + , args = p.GetClientData() ) + else: + try: + p.GetClientData()( name = p.GetName(), value = p.GetValue(), string = p.GetValueAsString() ) + except: + p.GetClientData()( name = p.GetName(), value = p.GetValue() ) \ No newline at end of file Modified: trunk/data/materials/advancedMaterials.material =================================================================== --- trunk/data/materials/advancedMaterials.material 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/data/materials/advancedMaterials.material 2009-12-28 21:29:43 UTC (rev 1164) @@ -1,5 +1,5 @@ material OpenGate/BumpMapping -{ +{ // This is the preferred technique which uses both vertex and // fragment programs, supports coloured lights @@ -12,9 +12,9 @@ // base colours, not needed for rendering, but as information // to lighting pass categorisation routine // ambient 1 1 1 -// diffuse 0 0 9 -// specular 0 0 1 1 -// emissive 0 0 1 1 +// diffuse 0 0 9 +// specular 0 0 1 1 +// emissive 0 0 1 1 // Really basic vertex program // NB we don't use fixed function here because GL does not like // mixing fixed function and vertex programs, depth fighting can @@ -23,7 +23,7 @@ { param_named_auto ambient ambient_light_colour } - + } // Now do the lighting pass // NB we don't do decal texture here because this is repeated per light @@ -31,8 +31,8 @@ { // base colours, not needed for rendering, but as information // to lighting pass categorisation routine - ambient 0 0 1 - + ambient 0 0 1 + // do this for each light iteration once_per_light @@ -47,9 +47,9 @@ // Fragment program fragment_program_ref BumpMapFP { - param_named_auto lightDiffuse light_diffuse_colour 0 + param_named_auto lightDiffuse light_diffuse_colour 0 } - + // Base bump map texture_unit { @@ -64,7 +64,7 @@ tex_address_mode clamp } } - + // Decal pass pass { @@ -84,7 +84,7 @@ { texture_alias Image } - + } } @@ -99,7 +99,7 @@ // base colours, not needed for rendering, but as information // to lighting pass categorisation routine ambient 1 1 1 - diffuse 0 0 0 + diffuse 0 0 0 specular 0 0 0 0 // Really basic vertex program // NB we don't use fixed function here because GL does not like @@ -109,7 +109,7 @@ { param_named_auto ambient ambient_light_colour } - + } // Now do the lighting pass // NB we don't do decal texture here because this is repeated per light @@ -117,11 +117,11 @@ { // base colours, not needed for rendering, but as information // to lighting pass categorisation routine - ambient 0 0 0 + ambient 0 0 0 // do this for each light iteration once_per_light - + scene_blend add // Vertex program reference @@ -129,7 +129,7 @@ { param_named_auto lightPosition light_position_object_space 0 } - + // Base bump map texture_unit { @@ -146,7 +146,7 @@ colour_op_multipass_fallback dest_colour zero } } - + // Decal pass pass { @@ -162,11 +162,11 @@ scene_blend dest_colour zero texture_unit { - texture_alias Image + texture_alias Image } - + } - } + } // This is the fallback which cards which don't have fragment program and vertex program support technique fallback { @@ -178,16 +178,9 @@ emissive 0.500000 0.500000 0.500000 1.000000 texture_unit { - texture_alias ImageFallback + texture_alias ImageFallback } } } } -//material Sta/TS/Background : OpenGate/BumpMapping -//{ -// set_texture_alias Image TausetiStationBackgroundPlain.png -// set_texture_alias ImageBumpMap TausetiStationBackgroundBM.png -// set_texture_alias ImageFallback TausetiStationBackground.png -//} - Modified: trunk/data/materials/planet.material =================================================================== --- trunk/data/materials/planet.material 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/data/materials/planet.material 2009-12-28 21:29:43 UTC (rev 1164) @@ -2,16 +2,16 @@ { source planet.cg entry_point main_vp - //profiles arbvp1 vp20 vs_1_1 - profiles arbvp1 vs_1_1 + //profiles arbvp1 vp20 vs_1_1 + profiles arbvp1 vs_1_1 default_params { param_named_auto modelViewProjection worldviewproj_matrix - param_named lightPos float3 -50000.0 0.0 -40000.0 -// param_named_auto lightPos light_position_object_space 0 - param_named_auto camPos camera_position_object_space - } +// param_named lightPos float3 -50000.0 0.0 -40000.0 + param_named_auto lightPos light_position_object_space 0 + param_named_auto camPos camera_position_object_space + } } fragment_program FragmentPrograms/PlanetNormSpec cg @@ -22,23 +22,23 @@ profiles arbfp1 ps_1_1 default_params { - } + } } vertex_program VertexPrograms/PlanetCloud cg { source planet.cg entry_point cloud_vp - //profiles arbvp1 vp20 vs_1_1 - profiles arbvp1 vs_1_1 + //profiles arbvp1 vp20 vs_1_1 + profiles arbvp1 vs_1_1 default_params { param_named_auto modelViewProjection worldviewproj_matrix - param_named lightPos float4 -50000.0 0.0 -40000.0 0.0 -// param_named_auto lightPos light_position_object_space 0 +// param_named lightPos float4 -50000.0 0.0 -40000.0 0.0 + param_named_auto lightPos light_position_object_space 0 param_named_auto camPos camera_position_object_space - } + } } fragment_program FragmentPrograms/PlanetCloud cg @@ -49,23 +49,23 @@ profiles arbfp1 ps_1_1 default_params { - } + } } vertex_program VertexPrograms/PlanetAtmosphere cg { source planet.cg entry_point atmos_vp - //profiles arbvp1 vp20 vs_1_1 - profiles arbvp1 vs_1_1 + //profiles arbvp1 vp20 vs_1_1 + profiles arbvp1 vs_1_1 default_params { param_named_auto modelViewProjection worldviewproj_matrix - param_named lightPos float4 -50000.0 0.0 -40000.0 0.0 -// param_named_auto lightPos light_position_object_space 0 +// param_named lightPos float4 -50000.0 0.0 -40000.0 0.0 + param_named_auto lightPos light_position_object_space 0 param_named_auto camPos camera_position_object_space - } + } } fragment_program FragmentPrograms/PlanetAtmosphere cg @@ -76,11 +76,11 @@ profiles arbfp1 ps_1_1 default_params { - } + } } material PlanetNormSpec -{ +{ technique vpfp { scheme vpfp @@ -91,7 +91,7 @@ } fragment_program_ref FragmentPrograms/PlanetNormSpec { - param_named_auto lightDiffuse light_diffuse_colour 0 + param_named_auto lightDiffuse light_diffuse_colour 0 param_named_auto lightSpecular light_specular_colour 0 param_named lightAmbient float4 0.05 0.05 0.05 0.1 param_named exponent float 10 @@ -100,17 +100,17 @@ texture_unit { texture_alias Image - tex_coord_set 0 + tex_coord_set 0 } texture_unit { texture_alias ImageNormMap - tex_coord_set 1 + tex_coord_set 1 } texture_unit { texture_alias ImageSpecMap - tex_coord_set 2 + tex_coord_set 2 } texture_unit { @@ -139,7 +139,7 @@ { scheme Default pass - { + { ambient 0.500000 0.500000 0.500000 1.000000 diffuse 0.900000 0.900000 0.900000 1.000000 specular 0.900000 0.900000 0.900000 1.000000 @@ -147,7 +147,7 @@ texture_unit { texture_alias ImageFallback - tex_coord_set 0 + tex_coord_set 0 } } } @@ -180,7 +180,7 @@ { scheme Default pass - { + { specular 0.500000 0.500000 0.500000 0.5000000 emissive 1.000000 1.000000 1.000000 1.000000 depth_check on Modified: trunk/data/materials/planets.material =================================================================== --- trunk/data/materials/planets.material 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/data/materials/planets.material 2009-12-28 21:29:43 UTC (rev 1164) @@ -1,21 +1,3 @@ -material OpenGate/Star -{ - technique - { - pass - { - lighting on - scene_blend add - depth_write off - - texture_unit - { - texture textures/star.png - } - } - } -} - material OpenGate/RedPlanet { technique Modified: trunk/data/materials/station.material =================================================================== --- trunk/data/materials/station.material 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/data/materials/station.material 2009-12-28 21:29:43 UTC (rev 1164) @@ -2,13 +2,13 @@ { source station.cg entry_point main_vp - profiles arbvp1 vp20 vs_1_1 + profiles arbvp1 vp20 vs_1_1 default_params { param_named_auto modelViewProjection worldviewproj_matrix param_named_auto camPos camera_position_object_space - } + } } fragment_program FragmentPrograms/StationNormSpec cg @@ -18,11 +18,11 @@ profiles arbfp1 fp20 ps_1_1 default_params { - } + } } material StationNormSpec -{ +{ technique vpfp { scheme vpfp @@ -45,7 +45,7 @@ } fragment_program_ref FragmentPrograms/StationNormSpec { - param_named_auto lightDiffuse light_diffuse_colour 0 + param_named_auto lightDiffuse light_diffuse_colour 0 param_named_auto lightSpecular light_specular_colour 0 // param_named lightDiffuse float4 0.6 0.6 0.6 1.0 // param_named lightSpecular float4 0.2 0.2 0.2 1.0 @@ -56,17 +56,17 @@ texture_unit { texture_alias Image - tex_coord_set 0 + tex_coord_set 0 } texture_unit { texture_alias ImageNormMap - tex_coord_set 1 + tex_coord_set 1 } texture_unit { texture_alias ImageSpecMap - tex_coord_set 2 + tex_coord_set 2 } texture_unit { @@ -82,7 +82,7 @@ { scheme Default pass - { + { ambient 0.500000 0.500000 0.500000 1.000000 diffuse 0.900000 0.900000 0.900000 1.000000 specular 0.900000 0.900000 0.900000 1.000000 @@ -90,7 +90,7 @@ texture_unit { texture_alias ImageFallback - tex_coord_set 0 + tex_coord_set 0 } } } @@ -169,7 +169,7 @@ material OpenGate/SingleTexture { receive_shadows on - technique + technique { pass { @@ -178,7 +178,7 @@ emissive 0.500000 0.500000 0.500000 1.000000 texture_unit { - texture_alias Image + texture_alias Image } } } @@ -208,7 +208,7 @@ material Flashlight/Red { technique - { + { pass { lighting off @@ -218,7 +218,7 @@ emissive 1.000000 0.000000 0.000000 1.000000 texture_unit { - texture flare.png + texture flare.png } } } Modified: trunk/data/misc/misc.material =================================================================== --- trunk/data/misc/misc.material 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/data/misc/misc.material 2009-12-28 21:29:43 UTC (rev 1164) @@ -22,13 +22,38 @@ { pass { + emissive 0.6 0.6 0.6 1.0 + scene_blend add - lighting off + lighting on depth_check off depth_write off texture_unit { + texture textures/star.png + } + } + } +} + +material OpenGate/Sun +{ + technique + { + + + pass + { + emissive 1.0 0.95 0.90 1.0 + + scene_blend add + lighting on + depth_check off + depth_write on + + texture_unit + { texture textures/flare.png } } Modified: trunk/src/AiObject.h =================================================================== --- trunk/src/AiObject.h 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/src/AiObject.h 2009-12-28 21:29:43 UTC (rev 1164) @@ -29,8 +29,6 @@ #include <queue> #include <iostream> -#include <boost/thread.hpp> - namespace Ogre{ class Timer; class Vector3; @@ -65,7 +63,7 @@ void setName ( const std::string & name ){ name_ = name; } - std::string name() const { return name_; } + inline const std::string & name() const { return name_; } uint id() const { return id_;} Deleted: trunk/src/Projectile.cpp =================================================================== --- trunk/src/Projectile.cpp 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/src/Projectile.cpp 2009-12-28 21:29:43 UTC (rev 1164) @@ -1,240 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 "Projectile.h" - -#include "Equipment.h" -#include "GunObject.h" -#include "LogManager.h" -#include "OpcodeWrapper.h" -#include "ResourceManager.h" -#include "Sector.h" - -#include <OgreBillboard.h> -#include <OgreBillboardSet.h> -#include <OgreManualObject.h> -#include <OgreRibbonTrail.h> -#include <OgreSceneManager.h> -#include <OgreVector3.h> - -namespace OpenGate{ - -Projectile::Projectile( BaseObject * parent, long shotCount, Gun & gun, const Ogre::Vector3 & pos, const Ogre::Vector3 & vel ) - : BaseObject( parent->name() + "_" + toStr( shotCount ), parent->sector() ), parent_( parent ), - shotCount_( shotCount ), gun_( &gun ), damage_( gun.damage() ), maxLifeTime_( gun.lifeTime() ), vel_( vel ){ - - selectable_ = false; - beam_ = NULL; - bullet_ = NULL; - shape_ = NULL; - trail_ = NULL; - - maxRange_ = gun.speed() * maxLifeTime_; - - fire( pos ); -} - -Projectile::Projectile( BaseObject * parent, long shotCounter, const GunObject & gun, const Ogre::Vector3 & mountPoint ) - : BaseObject( parent->name() + "_" + toStr( shotCounter ), parent->sector() ), - parent_( parent ), shotCount_( shotCounter), gun_( gun.gun() ), - damage_( gun.gun()->damage() ), maxLifeTime_( gun.gun()->lifeTime() ){ - selectable_ = false; - - beam_ = NULL; - bullet_ = NULL; - shape_ = NULL; - trail_ = NULL; - - maxRange_ = gun.gun()->speed() * maxLifeTime_; - - Ogre::Quaternion direction( parent_->mainNode()->getOrientation() ); - - vel_ = gun.gun()->speed() * -direction.zAxis().normalisedCopy() + parent->velocity(); - - Ogre::Vector3 relGunPos( ( gun.sceneNode().getParentSceneNode()->getOrientation() * gun.sceneNode().getPosition() ) * - gun.sceneNode().getParentSceneNode()->getParentSceneNode()->getScale() ); - - Ogre::Vector3 pos( gun.sceneNode()._getDerivedPosition() - direction.zAxis() * relGunPos[ 2 ] ); - -// std::cout << parent_->name() << std::endl; -// std::cout << pos << " " << relGunPos << std::endl; - fire( pos, relGunPos ); -} - -Projectile::~Projectile() { - if ( bullet_ ){ - mainNode_->detachObject( bullet_ ); - sceneMgr_->destroyBillboardSet( bullet_ ); - } - - if ( beam_ ){ - if ( shape_ ) { - shape_->detachObject( beam_ ); - mainNode_->removeAndDestroyChild( shape_->getName() ); - // sceneMgr_->destroySceneNode( shape_ ); - } - sceneMgr_->destroyManualObject( beam_ ); - } - if ( trail_ ) { - if ( shape_ ) { - trailNode_->detachObject( trail_ ); - sceneMgr_->getRootSceneNode()->removeAndDestroyChild( trailNode_->getName() ); - mainNode_->removeAndDestroyChild( shape_->getName() ); - } - sceneMgr_->destroyRibbonTrail( trail_ ); - } - - // mainNode_->detachObject( chain_ ); - // sceneMgr_->destroyBillboardChain( chain_ ); -} - -void Projectile::fire( const Ogre::Vector3 & pos, const Ogre::Vector3 & relGunPos ){ - Ogre::String bulletName( name_ + "_" + toStr( shotCount_ ) ); - - Ogre::Quaternion direction( parent_->mainNode()->getOrientation() ); - mainNode_->setOrientation( direction ); - mainNode_->setPosition( pos ); - //mainNode_->_update( true, true ); - - lifeTime_ = 0.0; - oldTime_ = 0.0; - ammoHit_ = false; - - switch ( gun_->type() ){ - case BULLET:{ - int maxBB = 20; - bullet_ = sceneMgr_->createBillboardSet( bulletName + "_BBS", maxBB ); - bullet_->setMaterialName("Bullet"); - - Ogre::Billboard *bb; - // bb = bullet_->createBillboard( Ogre::Vector3::ZERO, Ogre::ColourValue( 1.0f, 1.0f, 1.0f) ); - // bb->setDimensions( 1.0, 0.2 ); - // bb->setRotation ( Ogre::Radian( 0 ) ); - - for ( int i = 0; i < maxBB; i ++ ){ - bb = bullet_->createBillboard( Ogre::Vector3::ZERO, Ogre::ColourValue( 0.5f, 0.5f, 0.5f) ); - bb->setDimensions( 1.0 - i * 1.0/maxBB* 0.5 , 1.0 - i * 1.0/maxBB * 0.5 ); - bb->setRotation ( Ogre::Radian( i*10.0 ) ); - bb->setPosition( direction.zAxis().normalisedCopy() * i * 0.5 ); - } - mainNode_->attachObject( bullet_ ); - } break; - case LASER:{ - bool manuObject = false; - shape_ = mainNode_->createChildSceneNode( bulletName + "_transform" ); - if ( fabs( relGunPos[ 0 ] ) > 1e-3 ){ - shape_->roll( Ogre::Degree( 0.0 ) ); - } else { - shape_->roll( Ogre::Radian( atan( relGunPos[ 1 ] / relGunPos[ 0 ] ) ) ); - } - - if ( manuObject ){ -// std::cout << "createManualObject" << std::endl; - beam_ = sceneMgr_->createManualObject( bulletName + "_ManualObj" ); - Ogre::Real width = 0.25; - beam_->begin( "BeamGreen", Ogre::RenderOperation::OT_TRIANGLE_LIST); - beam_->position( 0.0, -width, 0.0 ); beam_->textureCoord( 0, 0 ); - beam_->position( 0.0, width, 0.0 ); beam_->textureCoord( 1, 0 ); - beam_->position( 0.0, width, 1.0 ); beam_->textureCoord( 1, 1 ); - beam_->position( 0.0, -width, 1.0 ); beam_->textureCoord( 0, 1 ); - beam_->quad( 0, 1, 2, 3 ); - beam_->quad( 0, 3, 2, 1 ); - beam_->end(); - shape_->attachObject( beam_ ); - } else { -// std::cout << "createRibbonTrail" << std::endl; - trail_ = sceneMgr_->createRibbonTrail( bulletName + "_RibbonTrail"); - trail_->setMaterialName( "BeamGreen" ); - trail_->setTrailLength( maxRange_ ); - trail_->setWidthChange( 0, 2.0 ); - trail_->setMaxChainElements( 1000 ); - trail_->setInitialWidth( 0, 1.0 ); - trail_->addNode( mainNode_ ); - trailNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode(); - trailNode_->attachObject( trail_ ); - } - } break; - case MININGLASER: { - } break; - case UNKNOWN: { - LogManager::getSingleton().warn( "guntype unknown: " + toStr( gun_->type() ) + " Forced bullet." ); - } break; - - } //switch gun_->type -} - -void Projectile::collide( BaseObject * object ){ - if ( name_ != object->name() ){ - - //** show us a small visible feedback; - if ( bullet_ ){ - vel_ *= 0.0; - bullet_->getBillboard( 0 )->setColour( Ogre::ColourValue(0.0, 1.0, 0.0) ); - bullet_->getBillboard( 0 )->setDimensions( 5, 5 ); - lifeTime_ = max( lifeTime_, maxLifeTime_ - 0.1f ); - } - } - ammoHit_ = true; - // sector_->sendVesselAmmoHit( *this, object ); -} - -bool Projectile::update( Ogre::Real elapsedTime ){ - if ( elapsedTime < 0.001 ) return true; - - lifeTime_ += elapsedTime; - if ( lifeTime_ >= maxLifeTime_ ) return false; - - if ( vel_.length() > 0.1 ){ - - if ( !ammoHit_ ){ - - Ogre::Ray bulletRay( mainNode_->getPosition(), vel_.normalisedCopy() ); - - if ( !ResourceManager::getSingleton().collisionManager->checkCollideRay( this, bulletRay, (vel_ * elapsedTime).length() ) ){ - mainNode_->translate( vel_ * elapsedTime ); - Ogre::Real beamLength = min( (vel_ * lifeTime_).length(), maxRange_ / 2.0f ); - Ogre::Real beamWidthScale = 1.0; - - if ( beam_ ){ -// if ( beamLength > 299.0f ) beamWidthScale = 1; - shape_->scale( 1.0, beamWidthScale, beamLength / shape_->getScale()[2] ); - } - if ( trail_ ){ - // trail_->setTrailLength( beamLength ); - } - } - } else { // if not ammoHit_ - Ogre::Real beamLength = min( (vel_ * lifeTime_).length(), maxRange_ / 2.0f ); - beamLength -= ( parent_->mainNode()->_getDerivedPosition() + ( vel_ * lifeTime_ ) - - mainNode_->_getDerivedPosition() ).length(); - - if ( beam_ ){ - if ( beamLength > 0 ){ - shape_->scale( 1.0, 1.0, beamLength / shape_->getScale()[ 2 ] ); - } - } else if ( trail_ ){ - trail_->setTrailLength( beamLength ); - } - } - } - return true; -} - -} //namespace OpenGate{ Deleted: trunk/src/Projectile.h =================================================================== --- trunk/src/Projectile.h 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/src/Projectile.h 2009-12-28 21:29:43 UTC (rev 1164) @@ -1,91 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 _OPENGATE_PROJECTILE__H -#define _OPENGATE_PROJECTILE__H - -#include "SectorObject.h" -#include <OgrePrerequisites.h> - -namespace OpenGate{ - -class GunObject; - -class Projectile : public BaseObject { -public: - Projectile( BaseObject * parent, long shotCount, Gun & gun, const Ogre::Vector3 & pos, const Ogre::Vector3 & vel ); - - Projectile( BaseObject * parent, long shotCount, const GunObject & gun, const Ogre::Vector3 & mountPoint ); - - virtual ~Projectile(); - - inline virtual long rtti() const { return PROJECTILE_RTTI; } - - //** taking default arg here, breaks pythonogre-generation, leads to TypeError: No to_python (by-value) converter found for C++ type: Ogre::Vector3 - void fire( const Ogre::Vector3 & pos, const Ogre::Vector3 & relGunPos ); - - void fire( const Ogre::Vector3 & pos ){ return fire( pos, Ogre::Vector3::ZERO ); } - - virtual void collide( BaseObject * object ); - - inline Uint32 damage( ) const { return damage_; } - - virtual bool update( Ogre::Real elapsedTime ); - - BaseObject * parent( ) { return parent_; } - - BaseObject & parent( ) const { return *parent_; } - - Ogre::Vector3 velocity() const { return vel_; } - - Ogre::Real lifeTime() const { return maxLifeTime_; } - - Uint16 shotCount() const { return shotCount_; } - - Gun * gun() const { return gun_; } - -protected: - - BaseObject * parent_; - Uint16 shotCount_; - Gun * gun_; - - Uint32 damage_; - Ogre::Real maxLifeTime_; - Ogre::Vector3 vel_; - - // Ogre::BillboardChain * chain_; - Ogre::BillboardSet * bullet_; - Ogre::ManualObject * beam_; - Ogre::RibbonTrail * trail_; - Ogre::SceneNode * trailNode_; - - Ogre::SceneNode * shape_; - - Ogre::Real oldTime_; - Ogre::Real maxRange_; - bool ammoHit_; -}; - - -} // namespace OpenGate - - -#endif // _OPENGATE_PROJECTILE__H Modified: trunk/src/Sector.cpp =================================================================== --- trunk/src/Sector.cpp 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/src/Sector.cpp 2009-12-28 21:29:43 UTC (rev 1164) @@ -415,15 +415,21 @@ //! create Planet SectorPlanetObject *planet = new SectorPlanetObject( "planet", this ); - //, Ogre::Vector3( 0000.0, 0000.0, 50000 ), 15000.0f, 64 ); - //planet_->lighting( true ); sectorEnvironment_.insert( planet ); - SectorSpaceDustObject *spaceDust = new SectorSpaceDustObject( this, listener()->mainCameraNode() ); - sectorEnvironment_.insert( spaceDust ); + //planet_->lighting( true ); + if ( listener_ ) { + SectorSpaceDustObject *spaceDust = new SectorSpaceDustObject( this, listener_->mainCameraNode() ); + sectorEnvironment_.insert( spaceDust ); + } + SectorStarfieldObject *starfield = new SectorStarfieldObject( this ); sectorEnvironment_.insert( starfield ); + + SectorSunObject *sun = new SectorSunObject( this ); + sectorEnvironment_.insert( sun ); + return; } Modified: trunk/src/SectorEnvironmentObject.cpp =================================================================== --- trunk/src/SectorEnvironmentObject.cpp 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/src/SectorEnvironmentObject.cpp 2009-12-28 21:29:43 UTC (rev 1164) @@ -79,18 +79,10 @@ cloudNode_->attachObject( cloudEntity_ ); cloudNode_->scale(1.015, 1.015, 1.015); - light_ = sector_->sceneManager()->createLight( name + "-light"); - light_->setDiffuseColour( 0.1, 0.1, 0.1 ); - light_->setSpecularColour( 0.4, 0.4, 0.4 ); - mainNode_->attachObject( light_ ); - light_->setVisible( true ); } SectorPlanetObject::~SectorPlanetObject( ){ - mainNode_->detachObject( light_ ); - sector_->sceneManager()->destroyLight( light_->getName() ); - if ( cloudNode_ ){ if ( cloudEntity_ ){ cloudNode_->detachObject( cloudEntity_ ); @@ -325,7 +317,9 @@ } bool SectorStarfieldObject::update( Ogre::Real elapsedTime ){ - mainNode_->setPosition( sector_->avatarObject()->mainNode()->getPosition() ); + if ( sector_->avatarObject() ){ + mainNode_->setPosition( sector_->avatarObject()->mainNode()->getPosition() ); + } return true; } @@ -370,6 +364,43 @@ return true; } +SectorSunObject::SectorSunObject( Sector * sector, Ogre::SceneNode * parentNode ) + : SectorEnvironmentObject( "Sun", sector, parentNode ){ + + lightNode_ = mainNode_->createChildSceneNode( "Sun/LightNode" ); + bs_ = sector_->sceneManager()->createBillboardSet( "Sun" ); + bs_->setMaterialName( "OpenGate/Sun" ); + //bs_->setRenderQueueGroup( Ogre::RENDER_QUEUE_BACKGROUND ); + bs_->setRenderQueueGroup( Ogre::RENDER_QUEUE_SKIES_EARLY ); + Ogre::Billboard *bb = bs_->createBillboard( Ogre::Vector3::ZERO, Ogre::ColourValue( 1.0f, 1.0f, 1.0f) ); + bb->setDimensions( 10000.0, 10000.0 ); + + light_ = sector_->sceneManager()->createLight( "Sun-light"); + light_->setDiffuseColour( 0.1, 0.1, 0.1 ); + light_->setSpecularColour( 0.4, 0.4, 0.4 ); + light_->setVisible( true ); + + lightNode_->attachObject( bs_ ); + lightNode_->attachObject( light_ ); + + lightNode_->setPosition( 50000.0, 0.0, 0.0 ); + //bs_->setPosition( 5000.0, 0.0, 0.0 ); +} + +SectorSunObject::~SectorSunObject( ){ + lightNode_->detachObject( light_ ); + lightNode_->getCreator()->destroyLight( light_->getName() ); + lightNode_->detachObject( bs_ ); + lightNode_->getCreator()->destroyBillboardSet( bs_ ); + mainNode_->removeAndDestroyChild( lightNode_->getName() ); +} + +bool SectorSunObject::update( Ogre::Real elapsedTime ){ + mainNode_->roll( Ogre::Degree( 0.2 * elapsedTime ) ); + return true; +} + + // if ( !1 ) { // planetNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode( "PlanetNode" ); // Modified: trunk/src/SectorEnvironmentObject.h =================================================================== --- trunk/src/SectorEnvironmentObject.h 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/src/SectorEnvironmentObject.h 2009-12-28 21:29:43 UTC (rev 1164) @@ -60,7 +60,6 @@ Ogre::SceneNode * cloudNode_; Ogre::Entity * cloudEntity_; Ogre::Entity * entity_; - Ogre::Light * light_; }; class SectorEclipticObject : public SectorEnvironmentObject{ @@ -102,6 +101,24 @@ Ogre::BillboardSet * bs_; }; + +class SectorSunObject : public SectorEnvironmentObject{ +public: + SectorSunObject( Sector * sector, Ogre::SceneNode * parentNode = NULL ); + + ~SectorSunObject( ); + + virtual bool update( Ogre::Real elapsedTime ); + + Ogre::Light * light( ) { return light_; } + +protected: + Ogre::SceneNode * lightNode_; + Ogre::BillboardSet * bs_; + Ogre::Light * light_; +}; + + // class SectorSpaceDecorationObject : public SectorEnvironmentObject{ // }; Modified: trunk/src/UnDockedState.cpp =================================================================== --- trunk/src/UnDockedState.cpp 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/src/UnDockedState.cpp 2009-12-28 21:29:43 UTC (rev 1164) @@ -81,10 +81,10 @@ //** create Ogre sceneManager sceneMgr_ = root_->createSceneManager( Ogre::ST_GENERIC, "UnDockedSceneManagerInstance" ); - + //** initialise collosion Manager resources_->collisionManager->init( sceneMgr_ ); - + //** create cameras mainCamera_ = sceneMgr_->createCamera( "MainCamera" ); mainCamera_->setNearClipDistance( 1 ); @@ -93,8 +93,8 @@ secondCamera_ = sceneMgr_->createCamera( "SecondCamera" ); secondCamera_->setNearClipDistance( 1 ); - overlayRootWindow_ = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"opengateUnDocked.layout"); - + overlayRootWindow_ = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"opengateUnDocked.layout"); + //** this should be directly associated to the sector, MOVE this soundBackround_ = OpenALSoundManager::getSingleton().createSoundSourceFromRessource( "sounds/undocked/defaultMusic", "sectorBackground", true, true ); @@ -113,35 +113,35 @@ log_->info( "Entering " + this->name() ); try { //** load CEGUI-HUD layout - + resources_->guiRenderer->setTargetSceneManager( sceneMgr_ ); if ( overlayRootWindow_ ){ resources_->guiSystem->setGUISheet( overlayRootWindow_ ); overlayRootWindow_->show(); } - + sector_ = new Sector( sceneMgr_, network_ ); sector_->setListener( this ); sector_->populate( "test.sector" ); sector_->createAvatarObject( resources_->avatar ); - + hud_ = new Hud( overlayRootWindow_, sector_->avatarObject() ); radar_ = new RadarObject( sector_, hud_ ); - - + + } catch( Ogre::Exception& e ) { log_->fatal( e.getFullDescription().c_str() ); } catch( ... ){ - LogManager::getSingleton().warn( "UnDockedState::enter() -- Unknown exception" ); + LogManager::getSingleton().warn( "UnDockedState::enter() -- Unknown exception" ); } - - + + // CEGUI::MouseCursor::getSingleton().hide(); windowsWidth_ = resources_->renderWindow->getWidth( ); windowsHeight_ = resources_->renderWindow->getHeight( ); windowsHalfWidth_ = (int)( windowsWidth_ * 0.5 ); - windowsHalfHeight_ = (int)( windowsHeight_ * 0.5 ); - + windowsHalfHeight_ = (int)( windowsHeight_ * 0.5 ); + flightCursor_ = CEGUI::WindowManager::getSingleton().getWindow( "HUDFlightCursor" ); flightCursorHalfWidth_ = 10; flightCursorHalfHeight_ = 10; @@ -176,34 +176,34 @@ cameraRotateY_ = 0.0; cameraZoom_ = 75.0; cameraViewKey_ = 1; - - ambientLight_ = 2; + + ambientLight_ = 0; setAmbientLight_(); - schemeIdx_ = 0; + schemeIdx_ = 1; setScheme_(); aniso_ = 1; // filtering_ = Ogre::TFO_BILINEAR; - + if ( resources_->console ){ CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"ConsoleList__auto_vscrollbar__")->hide(); } setupEventHandlers(); - + if ( soundBackround_ ) soundBackround_->play(); minimiseConsole( ); toggleNextCamera_( 0 ); enterDockedState_ = false; - + this->showHud(); - + //** start update SceneManager, if not set this leeds to strange behaviour by switching states //** opengateclient: OgreRenderQueueSortingGrouping.cpp:355: void Ogre::QueuedRenderableCollection::addRenderable(Ogre::Pass*, Ogre::Renderable*): Assertion `retPair.second && "Error inserting new pass entry into PassGroupRenderableMap"' failed. - if ( resources_->ogreRoot() && - ( Ogre::Pass::getDirtyHashList().size() != 0 || + if ( resources_->ogreRoot() && + ( Ogre::Pass::getDirtyHashList().size() != 0 || Ogre::Pass::getPassGraveyard().size() != 0 ) ) { Ogre::SceneManagerEnumerator::SceneManagerIterator scenesIter = resources_->ogreRoot()->getSceneManagerIterator(); @@ -234,22 +234,21 @@ CEGUI::PushButton::EventClicked ) ; hideHud(); - + if ( resources_->console ) resources_->console->stop(); CEGUI::MouseCursor::getSingleton().show(); - + resources_->renderWindow->removeAllViewports(); - + resources_->inputManager->removeKeyListener( "SectorClientKeyListener" ); resources_->inputManager->removeMouseListener( "SectorClientMouseListener" ); resources_->inputManager->removeJoystickListener( "SectorClientJoystickListener" ); - + if ( radar_ ) { delete radar_; radar_ = NULL; } if ( hud_ ) { delete hud_; hud_ = NULL; } if ( sector_ ) { delete sector_; sector_ = NULL; } - - + overlayRootWindow_->hide(); resources_->guiRenderer->setTargetSceneManager( NULL ); // resources_->guiRenderer->setTargetSceneManager( sceneMgr_ ); @@ -265,7 +264,7 @@ if ( window_->isClosed() ) return false; timeSinceLastSectorUpdate_ += evt.timeSinceLastFrame; - + // max 1000 sector-updates/second if ( timeSinceLastSectorUpdate_ > 0.001 ){ sector_->update( timeSinceLastSectorUpdate_ * timeZoom_ ); @@ -274,9 +273,9 @@ //** update my camera; updateCamera_( evt.timeSinceLastFrame ); - + if ( radar_ ) radar_->update( evt.timeSinceLastFrame ); - + if ( hud_ ) hud_->update( evt.timeSinceLastFrame ); return true; @@ -297,7 +296,7 @@ configMode_ = resources_->gameStateRoot->configDialog()->isVisible(); if ( configMode_ ){ - + this->hideHud(); overlayRootWindow_->show(); CEGUI::MouseCursor::getSingleton().show(); @@ -328,8 +327,8 @@ } if ( !chatMode_ && !configMode_ ){ - if ( (this->*resources_->keymap()->unDockedKeyAction( e ))( true ) ) return true; - + if ( (this->*resources_->keymap()->unDockedKeyAction( e ))( true ) ) return true; + if ( e.key == OIS::KC_RETURN ) { CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"ConsoleEdit")->activate(); // hudOverlay_->getChild( overlayName_ + "/ChatIn" )->show( ); @@ -357,7 +356,7 @@ bool UnDockedState::keyReleased( const OIS::KeyEvent & e ){ if ( !configMode_ ){ if ( sector_->avatarObject() != NULL ){ - if ( ( this->*resources_->keymap()->unDockedKeyAction( e ) )( false ) ) return true; + if ( ( this->*resources_->keymap()->unDockedKeyAction( e ) )( false ) ) return true; } } return true; @@ -365,8 +364,11 @@ bool UnDockedState::mouseMoved( const OIS::MouseEvent & e ){ if ( !configMode_ ){ - - + + if ( fabs( e.state.X.rel > 10 ) || fabs( e.state.Y.rel > 10 ) ) { + timeZoom_ = 1.0; + } + flightCursorPos_[ 0 ] += e.state.X.rel; flightCursorPos_[ 1 ] += e.state.Y.rel; @@ -377,7 +379,7 @@ flightCursorPos_[ 1 ] = max ( flightCursorPos_[ 1 ], -flightCursorHalfHeight_ ); flightCursor_->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0, flightCursorPos_[ 0 ] ), - CEGUI::UDim( 0.0, flightCursorPos_[ 1 ] ) ) ); + CEGUI::UDim( 0.0, flightCursorPos_[ 1 ] ) ) ); // mousePointer_->setLeft( mousePointer_->getLeft( ) + e.state.X.rel ); // mousePointer_->setTop( mousePointer_->getTop( ) + e.state.Y.rel ); @@ -395,7 +397,7 @@ if ( sector_->avatarObject() != NULL ){ // std::cout << "X" << e.state.X.abs << " " << e.state.X.rel << std::endl; // std::cout << "Y" << e.state.Y.abs << " " << e.state.Y.rel << std::endl; - + // std::cout << "X" << e.state.X.abs << " " << e.state.X.rel << " " << mousePointer_->getLeft( ) << std::endl; // std::cout << "Y" << e.state.Y.abs << " " << e.state.Y.rel << " " << mousePointer_->getTop( ) << std::endl; // std::cout << "Z" << e.state.Z.abs << " " << e.state.Z.rel<< std::endl; @@ -413,22 +415,23 @@ double minRadius = ( windowsHeight_ / 2.0 ) * minActiveZonePercent / 100; double maxRadius = ( windowsHeight_ / 2.0 ) * maxActiveZonePercent / 100; - Ogre::Real yaw = 0, pitch = 0; - if ( relativToMidPointX < 0 ) { - yaw = (relativToMidPointX+minRadius) / (maxRadius - minRadius); - } else { - yaw = (relativToMidPointX-minRadius) / (maxRadius - minRadius); - } - if ( relativToMidPointY < 0 ) { - pitch = (relativToMidPointY + minRadius) / (maxRadius - minRadius); - } else { - pitch = (relativToMidPointY - minRadius) / (maxRadius - minRadius); - } + Ogre::Real yaw = 0, pitch = 0; + if ( relativToMidPointX < 0 ) { + yaw = (relativToMidPointX+minRadius) / (maxRadius - minRadius); + } else { + yaw = (relativToMidPointX-minRadius) / (maxRadius - minRadius); + } - if ( fabs( relativToMidPointX ) < minRadius ) yaw = 0.0; - if ( fabs( relativToMidPointY ) < minRadius ) pitch = 0.0; + if ( relativToMidPointY < 0 ) { + pitch = (relativToMidPointY + minRadius) / (maxRadius - minRadius); + } else { + pitch = (relativToMidPointY - minRadius) / (maxRadius - minRadius); + } - yaw = min( yaw, 1.0f ); yaw = max( yaw, -1.0f ); + if ( fabs( relativToMidPointX ) < minRadius ) yaw = 0.0; + if ( fabs( relativToMidPointY ) < minRadius ) pitch = 0.0; + + yaw = min( yaw, 1.0f ); yaw = max( yaw, -1.0f ); pitch = min( pitch, 1.0f ); pitch = max( pitch, -1.0f ); // std::cout << ( String("Mouse rel: ") + StringConverter::toString( e.state.X.rel ) + @@ -462,12 +465,12 @@ if ( sector_->avatarObject() != NULL ){ switch ( id ){ case OIS::MB_Left: - sector_->avatarObject()->setFirePressed( true ); + sector_->avatarObject()->setFirePressed( true ); break; - case OIS::MB_Middle: + case OIS::MB_Middle: sector_->avatarObject()->fireMissile( ResourceManager::getSingleton().entityManager->missile( "Firefly" ), radar_->target() ); break; - case OIS::MB_Right: + case OIS::MB_Right: sector_->avatarObject()->fireMissile( ResourceManager::getSingleton().entityManager->missile( "bee" ), radar_->target() ); break; default: @@ -614,7 +617,7 @@ if ( sector_->avatarObject() != NULL ){ Ogre::Vector3 avatarPos( sector_->avatarObject()->mainNode()->getPosition() ); Ogre::Quaternion avatarOrient( sector_->avatarObject()->mainNode()->getOrientation() ); - + Ogre::Vector3 targetPos( 0.0, 0.0, 0.0 ); if ( radar_->target() != NULL ){ targetPos = radar_->target()->mainNode()->getPosition() ; @@ -703,7 +706,7 @@ // if ( sector_->avatarObject() ) sector_->avatarObject()->setTarget( target_ ); //if ( oldTarget ) sector_->avatarObject()->looseTarget( oldTarget ); - + // if ( hudTarget_->numChildren() > 0 ){ // hudTarget_->removeAllChildren( );// hudTarget_->getChild( "TargetTrans" ) ); // mainCamera_->getSceneManager()->destroyEntity( "TargetShape" ); @@ -795,7 +798,7 @@ minimiseConsole(); } } - return true; + return true; } bool UnDockedState::keyActionAvatarIncreaseYaw( bool pressed ){ @@ -868,14 +871,14 @@ bool UnDockedState::keyActionAvatarBreakPressed( bool pressed ){ if ( sector_->avatarObject() != NULL ){ - sector_->avatarObject()->setBrakePressed( pressed ); + sector_->avatarObject()->setBrakePressed( pressed ); } return true; } bool UnDockedState::keyActionAvatarAfterburnerPressed( bool pressed ){ if ( sector_->avatarObject() != NULL ){ - sector_->avatarObject()->setAfterburnerPressed( pressed ); + sector_->avatarObject()->setAfterburnerPressed( pressed ); } return true; } @@ -931,40 +934,40 @@ bool UnDockedState::keyActionCameraNormal( bool pressed ){ if ( pressed ){ - if ( cameraMode_ == 0 ) showHud(); - cameraViewKey_ = 1; + if ( cameraMode_ == 0 ) showHud(); + cameraViewKey_ = 1; } return true; } bool UnDockedState::keyActionCameraLeft( bool pressed ){ if ( pressed ){ - hideHud(); - cameraViewKey_ = 2; + hideHud(); + cameraViewKey_ = 2; } return true; } bool UnDockedState::keyActionCameraRight( bool pressed ){ if ( pressed ){ - hideHud(); - cameraViewKey_ = 3; + hideHud(); + cameraViewKey_ = 3; } return true; } bool UnDockedState::keyActionCameraUp( bool pressed ){ if ( pressed ){ - hideHud(); - cameraViewKey_ = 4; + hideHud(); + cameraViewKey_ = 4; } return true; } bool UnDockedState::keyActionCameraDown( bool pressed ){ if ( pressed ){ - hideHud(); - cameraViewKey_ = 5; + hideHud(); + cameraViewKey_ = 5; } return true; } @@ -1064,7 +1067,7 @@ } bool UnDockedState::keyActionAvatarChangeDockedState_DEV( bool pressed ){ - if ( pressed ) changeToDockedState(); + if ( pressed ) changeToDockedState(); return true; } @@ -1104,7 +1107,7 @@ // std::find_if( c.begin(),c.end(), std::compose1( std::mem_fun( &class::meth ), std::bind2nd( std::equal_to< T>(), Tcomp ) ) ); // std::find_if( c.begin(),c.end(), boost::bind( std::equal_to< T >(), Tcomp, boost::bind( &class::meth, _1 ) ) ); // std::find_if( c.begin(),c.end(), boost::bind( &class::meth, _1 ) == Tcomp ); - + //it = std::find_if( se.begin(), se.end(), boost::bind( std::equal_to< std::string >(), "planet", boost::bind(&SectorEnvironmentObject::name,_1 ) ) ); it = std::find_if( se.begin(), se.end(), boost::bind( &SectorEnvironmentObject::name, _1 ) == "planet" ); std::cout << "search planet" << std::endl; @@ -1132,11 +1135,11 @@ std::cout << " scale cloud 1/1.005 " << std::endl; dynamic_cast< SectorPlanetObject * >(*it)->cloudNode()->scale( 1./ 1.005, 1./1.005, 1./1.005 ) ; } - + } return true; } - + bool UnDockedState::maximiseConsole( ){ if ( overlayRootWindow_ ){ CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"UnDocked/MainWindow/ConsoleFrame")-> @@ -1168,8 +1171,7 @@ Ogre::Viewport * vp = window_->getViewport( i ); switch ( schemeIdx_ ){ case 0: vp->setMaterialScheme( "Default" ); break; - case 1: vp->setMaterialScheme( "vpOnly" ); break; - case 2: vp->setMaterialScheme( "vpfp" ); break; + case 1: vp->setMaterialScheme( "vpfp" ); break; } } Modified: trunk/src/common.cpp =================================================================== --- trunk/src/common.cpp 2009-12-26 20:44:55 UTC (rev 1163) +++ trunk/src/common.cpp 2009-12-28 21:29:43 UTC (rev 1164) @@ -21,7 +21,7 @@ #include "common.h" namespace OpenGate{ - + void myMSleep( int ms ) { #ifdef WIN32 Sleep( ms ); @@ -31,39 +31,39 @@ } std::vector < std::string > getSubstrings( const std::string & str ){ - std::vector < std::string > subStrings; - std::istringstream is( str ); - std::string tmp; - while ( is >> tmp ) subStrings.push_back( tmp ); - return subStrings; + std::vector < std::string > subStrings; + std::istringstream is( str ); + std::string tmp; + while ( is >> tmp ) subStrings.push_back( tmp ); + return subStrings; } std::vector < std::string > getRowSubstrings( std::fstream & file, char comment ){ - std::vector < std::string > subStrings; - std::string str, tmp; - getline( file, str ); + std::vector < std::string > subStrings; + std::string str, tmp; + getline( file, str ); - std::istringstream is( str.substr( 0, str.find( comment ) ) ); - while ( is >> tmp ) subStrings.push_back( tmp ); - return subStrings; + std::istringstream is( str.substr( 0, str.find( comment ) ) ); + while ( is >> tmp ) subStrings.push_back( tmp ); + return subStrings; } std::vector < float > toVector3( const std::string & vecStr, const char delimiter ){ std::vector < float > vect( 3, 0.0 ); int pos = 0, nextPos = 0, count = 0; - std::string str; + std::string str; while ( ( nextPos = vecStr.find( delimiter, pos ) ) != (int)std::string::npos ){ str = vecStr.substr( pos, nextPos-pos ); if ( str.size() > 0 ){ - vect[ co... [truncated message content] |
From: <spo...@us...> - 2009-12-26 20:45:07
|
Revision: 1163 http://opengate.svn.sourceforge.net/opengate/?rev=1163&view=rev Author: spom_spom Date: 2009-12-26 20:44:55 +0000 (Sat, 26 Dec 2009) Log Message: ----------- ogedit add: opengate scene view Modified Paths: -------------- branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg branches/ogEditor/ogEditor/apps/opengate/opengateedit.py branches/ogEditor/ogEditor/apps/opengate/pyopengate/Makefile branches/ogEditor/ogEditor/apps/opengate/pyopengate/generate_code.py branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate.h branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py branches/ogEditor/plugins_linux.cfg Modified: branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg 2009-12-25 14:57:07 UTC (rev 1162) +++ branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg 2009-12-26 20:44:55 UTC (rev 1163) @@ -28,5 +28,5 @@ Zip=../../trunk/data/skybox/simpleSkybox.zip -#FileSystem=../../trunk/data/MediaFromOgre -#FileSystem=../../trunk/data/MediaFromOgre/AdvancedMaterials +FileSystem=../../trunk/data/MediaFromOgre +FileSystem=../../trunk/data/MediaFromOgre/AdvancedMaterials Modified: branches/ogEditor/ogEditor/apps/opengate/opengateedit.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-25 14:57:07 UTC (rev 1162) +++ branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-26 20:44:55 UTC (rev 1163) @@ -32,20 +32,166 @@ print "no python bindung for opengate lib found" -class OpengateHandler( ): - def __init__( self, OgreWindow ): +class OgreMoveableItem( AppResource ): + def __init__( self, parent, rendererSlot, propertyInspectorSlot ): + AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) + self.obj_ = None + self.type_ = None + + def createPropertyPanel( self, parent ): + if not HAVE_PROPGRID: + return wx.Panel( parent ) + + panel = wxPropGridWrapper( parent ) + panel.Append( wxpg.PropertyCategory( self.type_ ) ) + + if hasattr( self.obj_, "getMaterial" ): + self.fillPGWithMaterial( panel, self.obj_ ) + + if self.type_ == 'SubEntity': + pass + + elif self.type_ == 'Entity': + if self.obj_.getNumSubEntities() == 1: + self.fillPGWithMaterial( panel, self.obj_.getSubEntity( 0 ) ) + + return panel + + def fillPGWithMaterial( self, panel, subentity ): + + mat = subentity.getMaterial() + + prop = wxpg.StringProperty( "Material", value = mat.getName() ) + panel.append( prop, None ) + + prop = wxpg.StringProperty( name = mat.getName()+ "Technique used" + , label = "Technique used" + , value = subentity.getTechnique().getName() ) + panel.append( prop, None ) + + for i in range( mat.getNumTechniques() ): + tech = mat.getTechnique( i ) + prop = wxpg.StringProperty( name = mat.getName()+ "Technique"+str(i) + , label = "Technique", value = tech.getName() ) + panel.append( prop, None ) + prop = wxpg.StringProperty( name = mat.getName()+ "Scheme"+str(i) + , label = "Scheme", value = tech.getSchemeName() ) + panel.append( prop, None ) + for j in range( tech.getNumPasses() ): + pas = tech.getPass( j ) + prop = wxpg.StringProperty( name = mat.getName() + "Technique"+str(i)+"Pass"+str( j ) + , label = "Pass", value = pas.getName() ) + panel.append( prop, None ) + + def setMovable( self, obj ): + self.obj_ = obj + if hasattr( obj, 'getMovableType' ): + self.type_ = str( self.obj_.getMovableType() ) + if self.type_ == 'Entity': + if obj.getNumSubEntities() > 1: + for i in range( 0, obj.getNumSubEntities() ): + item = self.createChildItem( OgreMoveableItem, 'SubEntity: ' + obj.getSubEntity( i ).getMaterialName() ) + item.setMovable( obj.getSubEntity( i ) ) + else: + self.type_ = 'SubEntity' + + self.parent.resourceTree.Expand( self.treeItem) + +class OgreNodeItem( AppResource ): + def __init__( self, parent, rendererSlot, propertyInspectorSlot ): + AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) + self.node_ = None + + def setNode( self, node ): + self.node_ = node + self.dumpSceneNode_( node ) + + def dumpSceneNode_( self, scenenode ): + tree = self.parent.resourceTree; + if scenenode is None: + return + + for i in range( scenenode.numAttachedObjects() ): + obj = scenenode.getAttachedObject( i ) + + item = self.createChildItem( OgreMoveableItem, obj.getMovableType() + ': ' + obj.getName() ) + item.setMovable( obj ) + + for i in range( scenenode.numChildren() ): + nextnode = scenenode.getChild( i ) + item = self.createChildItem( OgreNodeItem, "SceneNode: " + nextnode.getName() ) + item.setNode( nextnode ) + + self.parent.resourceTree.Expand( self.treeItem) + +class OpengateSectorObjectItem( AppResource ): + def __init__( self, parent, rendererSlot, propertyInspectorSlot ): + AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) + self.window = None + self.childWindows = [] + self.layout = None + self.obj_ = None + self.camera_ = None + + def activate( self, active ): + print "activate( self, active ):", self + self.camera_.lookAt( self.obj_.mainNode().getPosition() ) + + def setObject( self, obj, camera ): + self.obj_ = obj + self.camera_ = camera + node = self.createChildItem( OgreNodeItem, "SceneNode: " + obj.mainNode().getName() ) + node.setNode( obj.mainNode() ) + + + +class OpengateHandler( AppResource ): + def __init__( self, parent, rendererSlot, propertyInspectorSlot ): + AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) + self.sectorTreeNode_ = None + + def init( self, OgreWindow ): self.resourceManager_ = og.ResourceManager() self.resourceManager_.logManager = og.LogManager() self.resourceManager_.entityManager = og.EntityManager( ) self.resourceManager_.ogreRoot = OgreWindow.ogreRoot self.resourceManager_.renderWindow = OgreWindow.renderWindow self.sceneManager_ = OgreWindow.sceneManager + self.camera_ = OgreWindow.camera for res in OgreWindow.resourceLocations: self.resourceManager_.addResourceLocation( res[0], res[1] ) self.initOpenGateResources_() + def createPropertyPanel( self, parent ): + if not HAVE_PROPGRID: + return wx.Panel( parent ) + + panel = wxPropGridWrapper( parent ) + panel.Append( wxpg.PropertyCategory("Opengate") ) + + prop = wxpg.StringProperty( "Sector", value = "test.sector" ) + panel.append( prop, None ) + + self.resourceManager_.renderWindow.getViewport( 0 ).setMaterialScheme( "vpfp" ) + prop = wxpg.EnumProperty( "Shader scheme", labels = ( "Default", "vpfp" ), values = [1,2,3], value = 3 ) + panel.append( prop, self.onShaderChange ) + + self.sceneManager_.setAmbientLight( ogre.ColourValue( 10.0/256.0, 10.0/256.0, 10.0/256.0) ) + prop = wxpg.ColourProperty( "Ambient light", value = wx.Colour( 10, 10, 10 ) ) + panel.append( prop, self.onAmbientLightChange ) + + return panel + + def onShaderChange( self, name, value, string ): + #print "onShaderChange", name, value, string + self.resourceManager_.renderWindow.getViewport( 0 ).setMaterialScheme( string ) + + def onAmbientLightChange( self, name, value, string ): + print "onAmbientLightChange( self, name, value, string ):", name, value, string + self.sceneManager_.setAmbientLight( ogre.ColourValue( value[0]/256.0, value[1]/256.0, value[2]/256.0) ) + def initOpenGateResources_( self ): self.resourceManager_.loadGlobalIDs( "ids.xml" ) entityManager = self.resourceManager_.entityManager @@ -60,14 +206,14 @@ entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "missiles" ); entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "ships" ); entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "stations" ); + self.fillResourcesTree() - def fillResourcesTree( self, tree, node ): - self.sceneTree_ = tree; - if self.resourceManager_: - ogResManNode = tree.AppendItem( node, "OpenGate resource manager" ) + def fillResourcesTree( self ): + tree = self.parent.resourceTree + self.sectorTreeNode_ = tree.AppendItem( self.treeItem, "Sector" ) if self.resourceManager_.entityManager: - ogEntityManagerNode = tree.AppendItem( ogResManNode, "Entity manager" ) + ogEntityManagerNode = tree.AppendItem( self.treeItem, "Entity manager" ) categories = self.resourceManager_.entityManager.categories(); for category in categories: @@ -77,40 +223,32 @@ self.sector_ = og.Sector( self.sceneManager_, None ) self.sector_.populate( name ) + tree = self.parent.resourceTree + sectorObjectsItem = tree.AppendItem( self.sectorTreeNode_, "SectorObjects" ) + + for obj in self.sector_.sectorMeshObjects(): + item = self.createChildItem( OpengateSectorObjectItem, obj.name(), sectorObjectsItem ) + item.setObject( obj, self.camera_ ) + + sectorEnvironmentItem = tree.AppendItem( self.sectorTreeNode_, "SectorEnvironment" ) + + for obj in self.sector_.sectorEnvironment(): + item = self.createChildItem( OpengateSectorObjectItem, obj.name(), sectorEnvironmentItem ) + item.setObject( obj, self.camera_ ) + class OpengateEditor( AppResource ): def __init__( self, parent, rendererSlot, propertyInspectorSlot ): AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) # set the name of this application that appears to the resource tree - self.setName("Opengate") + self.setName("Opengate editor") self.sceneManager = None self.GUIRenderer = None self.GUISystem = None self.parentResource = self self.opengateHandler = None - pass - - def postCreate( self ): - pass - - #def createPropertyPanel( self, parent ): - #""" - #Define and return panel that is shown in the property-inspector (PI) - #The panel will post created at the first call - #""" - - ## create a Notebook for the PI and add the content for the panel with the name piTestApplication defined in testapp.xrc - #panel = self.createPropertyInspectorNoteBookPanel( parent, 'piTestApplication', title = 'TestApplication' ) - - ## define property behaviour - #self.titleTextProp.setCtrl( ctrl = wx.xrc.XRCCTRL( panel, 'TitleTextCtrl' ) # name of the control in xrc - #, ctrlEvent = wx.EVT_TEXT # the event that should observed - #, targetFunct = self.setTitle ) # the callback when the event is called - - #return panel - def getRenderer( self, slot = None): if not self.renderer_ and slot is not None: self.renderer_ = OgreWindow( slot, resourceFile = os.path.join( os.path.dirname(__file__), 'opengate-resources.cfg' ) ) @@ -122,7 +260,9 @@ rootNode = self.sceneManager.getRootSceneNode() if HAVE_PYOPENGATE: - self.opengateHandler = OpengateHandler( self.renderer_ ) + self.opengateHandler = self.createChildItem( OpengateHandler, "Opengate" ) + self.opengateHandler.init( self.renderer_ ) + self.opengateHandler.showSector( "test.sector" ) else: apty = self.sceneManager.createEntity('apteryx', 'apteryx.mesh') node = rootNode.createChildSceneNode("apteryx_node", ogre.Vector3(0, 0, -100)) @@ -181,10 +321,6 @@ tree = self.parent.resourceTree root = self.treeItem - if self.opengateHandler is not None: - self.opengateHandler.fillResourcesTree( tree, root ) - self.opengateHandler.showSector( "test.sector" ) - #resManNode = tree.AppendItem( root, "Ogre resource manager" ) ### Insert resources group managers (Material, Mesh, Texture etc. ) Modified: branches/ogEditor/ogEditor/apps/opengate/pyopengate/Makefile =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/pyopengate/Makefile 2009-12-25 14:57:07 UTC (rev 1162) +++ branches/ogEditor/ogEditor/apps/opengate/pyopengate/Makefile 2009-12-26 20:44:55 UTC (rev 1163) @@ -20,7 +20,7 @@ default: $(TARGET) .cpp.o: - g++ $(COPT) $(DEFINES) -c -o $(patsubst %.cpp,%.o, $<) -I ./ $(CONTAINERSUITE) $(BOOSTINC) $(OPENGATEINC) $(PYTHONINC) $(OGREGEN) $(OGREINC) $< + g++ $(COPT) $(DEFINES) -c -o $(patsubst %.cpp,%.o, $<) -I ./ -I generated $(BOOSTINC) $(OPENGATEINC) $(PYTHONINC) $(OGREGEN) $(OGREINC) $< $(TARGET): $(OBJECTS) g++ -o generated/$(TARGET).so -Wl,-rpath=\/../../lib `pkg-config --libs OGRE` --strip-all -lstdc++ -shared \ Modified: branches/ogEditor/ogEditor/apps/opengate/pyopengate/generate_code.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/pyopengate/generate_code.py 2009-12-25 14:57:07 UTC (rev 1162) +++ branches/ogEditor/ogEditor/apps/opengate/pyopengate/generate_code.py 2009-12-26 20:44:55 UTC (rev 1163) @@ -104,7 +104,8 @@ include_paths = [settings.opengate_path, settings.python_include_path, settings.ogreopcode_include_path, settings.ogre_include_path], define_symbols = defined_symbols, - indexing_suite_version = 1 ) + indexing_suite_version = 2 + ) ## This module depends on Ogre #mb.register_module_dependency( '/home/carsten/local/python-ogre-ebuild/python-ogre/generated/ogre_1.6.4' ) Modified: branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate.h 2009-12-25 14:57:07 UTC (rev 1162) +++ branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate.h 2009-12-26 20:44:55 UTC (rev 1163) @@ -118,15 +118,16 @@ //First we create a magic namespace to hold all our aliases namespace pyplusplus { namespace aliases { -// typedef ::std::vector < ::std::string > stdVectorString; -// typedef ::std::vector < OpenGate::Entity * > stdVectorEntity; -// typedef ::std::vector < OpenGate::Triangle > stdVectorTriangle; -// typedef ::std::set < ::std::string > stdSetString; -// typedef ::std::set< ::OpenGate::Entity * > stdSetEntity; -// typedef ::std::set< OpenGate::SectorObject * > stdSetSectorObject; -// typedef ::std::set< OpenGate::Vessel * > stdSetVessel; -// typedef ::std::map< int, ::std::vector< Ogre::Vector3 > > stdMapIntVector3; -// typedef ::std::list< std::deque< OpenGate::Entity * > > stdListEntityDeque; +typedef ::std::vector < ::std::string > stdVectorString; +typedef ::std::vector < OpenGate::Entity * > stdVectorEntity; +typedef ::std::vector < OpenGate::Triangle > stdVectorTriangle; +typedef ::std::set < ::std::string > stdSetString; +typedef ::std::set< ::OpenGate::Entity * > stdSetEntity; +typedef ::std::set< OpenGate::SectorMeshObject * > stdSetSectorMeshObject; +typedef ::std::set< OpenGate::SectorEnvironmentObject * > stdSetSectorEnvironmentObject; +typedef ::std::set< OpenGate::Vessel * > stdSetVessel; +typedef ::std::map< int, ::std::vector< Ogre::Vector3 > > stdMapIntVector3; +typedef ::std::list< std::deque< OpenGate::Entity * > > stdListEntityDeque; } } // then we exposed everything needed (and more) to ensure GCCXML makes them visible to Py++ Modified: branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py =================================================================== --- branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-25 14:57:07 UTC (rev 1162) +++ branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-26 20:44:55 UTC (rev 1163) @@ -1,24 +1,24 @@ # -*- coding: iso-8859-1 -*- -import wx +import wx import os import os.path import string import time try: - import ogre.renderer.OGRE as ogre + import ogre.renderer.OGRE as ogre except Exception, e: print e print "no python-ogre installation found" print "download version 1.6.4 from http://sourceforge.net/projects/python-ogre/files/" - + def toStr( vec ): return ("%g, %g, %g"%(vec.x, vec.y, vec.z)) def getPluginPath(): - """Return the absolute path to a valid plugins.cfg file.""" + """Return the absolute path to a valid plugins.cfg file.""" import sys - + paths = [ os.path.join( os.getcwd(), 'plugins.cfg'), os.path.join( os.path.dirname( os.path.abspath( __file__ ) ), 'plugins.cfg'), '/etc/OGRE/plugins.cfg' ] @@ -34,27 +34,27 @@ "** Warning: working plugins.cfg file to the current directory.\n\n") raise ogre.Exception(0, "can't locate the 'plugins.cfg' file", "") -class Struct: - "simple dummy class to regroup scene entities in a single parameter" - pass +class Struct: + "simple dummy class to regroup scene entities in a single parameter" + pass baseClass = wx.PyWindow if os.name == "posix": import wx.glcanvas baseClass = wx.glcanvas.GLCanvas - + class OgreWindow( baseClass ): - """wx.Frame subclass to embed an Ogre window in wxPython - It is somewhat inspired from SampleFramework.py""" + """wx.Frame subclass to embed an Ogre window in wxPython + It is somewhat inspired from SampleFramework.py""" - def __init__( self, parent, ID = -1, size = wx.Size( 1280, 1024 ), renderSystem = "OpenGL", **kwargs ): + def __init__( self, parent, ID = -1, size = wx.Size( 1280, 1024 ), renderSystem = "OpenGL", **kwargs ): if 'resourceFile' in kwargs: self.resourceFile = kwargs[ 'resourceFile' ] del kwargs[ 'resourceFile' ] else: self.resourceFile = 'resources.cfg' - + if os.name == "posix": wx.glcanvas.GLCanvas.__init__( self, parent , size = parent.GetSize() @@ -62,46 +62,46 @@ , style = wx.NO_FULL_REPAINT_ON_RESIZE , attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER] ) else: - wx.PyWindow.__init__( self, parent, ID, size = size, **kwargs ) - + wx.PyWindow.__init__( self, parent, ID, size = size, **kwargs ) + # print self.resourceFile - - self.parent = parent + + self.parent = parent self.parent.Show() - #all animation states included in this dictionary will be automatically updated at each render - self.animStates = {} #the values have to be (AnimationState, SpeedFactor) tuples - - #namespace for holding a reference to the entities you create. You can comment it out - #if you don't like the idea - self.sceneEntities = Struct() - - #Timer creation - self.timer = wx.Timer() - self.timer.SetOwner( self ) #Sets the timer to notify self: binding the timer event is not enough + #all animation states included in this dictionary will be automatically updated at each render + self.animStates = {} #the values have to be (AnimationState, SpeedFactor) tuples + #namespace for holding a reference to the entities you create. You can comment it out + #if you don't like the idea + self.sceneEntities = Struct() + + #Timer creation + self.timer = wx.Timer() + self.timer.SetOwner( self ) #Sets the timer to notify self: binding the timer event is not enough + self.renderWindow = None self.ogreRoot = None self.listener = [] - - #Ogre Initialisation + + #Ogre Initialisation self.weu = ogre.WindowEventUtilities() - self._OgreInit( size, renderSystem ) - self.SceneInitialisation() - self.UpdateRender() - self.SetFocus() #Gives KeyboardFocus - + self._OgreInit( size, renderSystem ) + self.SceneInitialisation() + self.UpdateRender() + self.SetFocus() #Gives KeyboardFocus + self.__handle = 0 - - #Event bindings - self.Bind( wx.EVT_CLOSE, self._OnCloseWindow) - self.Bind( wx.EVT_SIZE, self._OnSize) - self.Bind( wx.EVT_TIMER, self.UpdateRender) #Bind the timer events to Ogre rendering - self.Bind( wx.EVT_ERASE_BACKGROUND, self._OnEraseBackground) + #Event bindings + self.Bind( wx.EVT_CLOSE, self._OnCloseWindow) + self.Bind( wx.EVT_SIZE, self._OnSize) + self.Bind( wx.EVT_TIMER, self.UpdateRender) #Bind the timer events to Ogre rendering + self.Bind( wx.EVT_ERASE_BACKGROUND, self._OnEraseBackground) + def AddResources( self, resourceFile ): - config = ogre.ConfigFile() - config.load( resourceFile ) + config = ogre.ConfigFile() + config.load( resourceFile ) self.resourceLocations = [] section_iter = config.getSectionIterator() @@ -111,7 +111,7 @@ for key, path in settings: ogre.ResourceGroupManager.getSingleton().addResourceLocation( path, key, section_name, False) self.resourceLocations.append( (path, section_name ) ) - + def GetHandle( self ): lastValid = self.parent parent = lastValid @@ -119,13 +119,13 @@ lastValid = parent lastValid.Show( True ) parent = lastValid.GetParent() - + #print "windowhandle = ", handle if os.name == 'posix': handle = wx.glcanvas.GLCanvas.GetHandle( self ) else: handle = wx.PyWindow.GetHandle( self ) - + if handle == 0: try: import wxogre_util as wxHandle @@ -134,95 +134,95 @@ except Exception, e: print "external getHandle call failed: ", e, handle handle = 0 - + if handle == "No window found": print "No window found: ", handle handle = 0 - + #return str( 0 ) return str(handle ) - - def _OgreInit(self,size,renderSystem): + + def _OgreInit(self,size,renderSystem): #Root creation - self.ogreRoot = ogre.Root( getPluginPath(), "ogre.cfg" ) - - # setup resources + self.ogreRoot = ogre.Root( getPluginPath(), "ogre.cfg" ) + + # setup resources self.AddResources( self.resourceFile ); renList = self.ogreRoot.getAvailableRenderers() - + bFound = False for r in renList: if string.find(r.getName(),renderSystem) != -1 and bFound==False: self.ogreRoot.setRenderSystem ( r ) bFound = True - + if os.path.exists( "ogre.cfg" ): self.ogreRoot.restoreConfig() else: - carryOn = self.ogreRoot.showConfigDialog() - if not carryOn: - sys.exit('Quit from Config Dialog') - + carryOn = self.ogreRoot.showConfigDialog() + if not carryOn: + sys.exit('Quit from Config Dialog') + self.ogreRoot.initialise(False) renderParameters = ogre.NameValuePairList() renderParameters['FSAA'] = "0" self.__handle = self.GetHandle() renderParameters['externalWindowHandle'] = self.__handle - + self.renderWindow = self.ogreRoot.createRenderWindow( 'wxPython render window' , self.GetSize()[ 0 ], self.GetSize()[ 1 ] - , False, renderParameters ) - self.renderWindow.active = True + , False, renderParameters ) + self.renderWindow.active = True self.ogreRoot.renderOneFrame() - ogre.ResourceGroupManager.getSingleton().initialiseAllResourceGroups() + ogre.ResourceGroupManager.getSingleton().initialiseAllResourceGroups() - def _OnSize(self, event): + def _OnSize(self, event): if self.renderWindow is not None: # print self.GetSize(), self.parent.GetSize() self.renderWindow.resize( self.GetSize()[ 0 ], self.GetSize()[ 1 ] ); self.renderWindow.windowMovedOrResized() - self.UpdateRender() - + self.UpdateRender() + # print "ren", self.renderWindow.getWidth(), self.renderWindow.getHeight() - + for l in self.listener: l.onResize( self.GetSize() ) - - event.Skip() - def _OnEraseBackground(self, event): - pass # Do nothing, to avoid flashing on MSW. + event.Skip() - def _OnCloseWindow(self, event): - self.Destroy() + def _OnEraseBackground(self, event): + pass # Do nothing, to avoid flashing on MSW. - def AcceptsFocus(self): - return True - - def StartRendering(self,interval=33): - "Activates the timer. A rendering will be triggered at each interval (default :33ms)" - self.timer.Start(interval) - - def OnFrameStarted(self,event): - "SubClass and fill in this declaration if you want something done before each rendering" - pass - - def OnFrameEnded(self,event): - "SubClass and fill in this declaration if you want something done after each rendering" - pass - - def UpdateRender(self,event=None): - """Method that can be called manually or by a wx.Timer - If the method is called by timer, the animation states contained in - the self.animStates variable get updated before rendering the frame""" - - #Enables the user to define actions to be undertaken before the frame is started - + def _OnCloseWindow(self, event): + self.Destroy() + + def AcceptsFocus(self): + return True + + def StartRendering(self,interval=33): + "Activates the timer. A rendering will be triggered at each interval (default :33ms)" + self.timer.Start(interval) + + def OnFrameStarted(self,event): + "SubClass and fill in this declaration if you want something done before each rendering" + pass + + def OnFrameEnded(self,event): + "SubClass and fill in this declaration if you want something done after each rendering" + pass + + def UpdateRender(self,event=None): + """Method that can be called manually or by a wx.Timer + If the method is called by timer, the animation states contained in + the self.animStates variable get updated before rendering the frame""" + + #Enables the user to define actions to be undertaken before the frame is started + #handle = wxHandle.get_window_handle_str( self ) - #print "Update Render call: ", handle - + #print "Update Render call: ", handle + # unfortunally ogre propably cant remap the windowhandle #if self.__handle is not self.GetHandle(): #print "handle change:", self.__handle, self.GetHandle() @@ -231,112 +231,112 @@ #self.__handle = self.GetHandle() #renderParameters['externalWindowHandle'] = self.__handle #self.renderWindow() - + self.weu.messagePump() if self.renderWindow.isActive(): self.ogreRoot.renderOneFrame() - #self.OnFrameStarted(event) - - #if hasattr(event ,"GetInterval"): #Timer Events have a GetInterval method that returns the time interval between events - #for anim,speed in self.animStates.itervalues(): - #anim.addTime(speed*event.GetInterval()/1000.0) #updates the animations - - #self.ogreRoot.renderOneFrame()#Asks Ogre to render a frame - - ##Enables the user to define actions to be undertaken after the frame has been drawn - #self.OnFrameEnded(event) - - def SceneInitialisation(self): - """This method can be replaced completely to suit your needs or you can - subclass only the helper methods such as self._CreateCamera""" - self._ChooseSceneManager() - self._CreateCamera() - self._CreateViewport() - self._PopulateScene() - self._MouseAndKeysBindings() - - #You will want to subclass the following methods to suit your needs - - def _ChooseSceneManager(self): - "choose SceneManager" + #self.OnFrameStarted(event) + + #if hasattr(event ,"GetInterval"): #Timer Events have a GetInterval method that returns the time interval between events + #for anim,speed in self.animStates.itervalues(): + #anim.addTime(speed*event.GetInterval()/1000.0) #updates the animations + + #self.ogreRoot.renderOneFrame()#Asks Ogre to render a frame + + ##Enables the user to define actions to be undertaken after the frame has been drawn + #self.OnFrameEnded(event) + + def SceneInitialisation(self): + """This method can be replaced completely to suit your needs or you can + subclass only the helper methods such as self._CreateCamera""" + self._ChooseSceneManager() + self._CreateCamera() + self._CreateViewport() + self._PopulateScene() + self._MouseAndKeysBindings() + + #You will want to subclass the following methods to suit your needs + + def _ChooseSceneManager(self): + "choose SceneManager" self.sceneManager = self.ogreRoot.createSceneManager(ogre.ST_GENERIC,"ExampleSMInstance") - - def _CreateCamera(self): - "create a Camera" - self.camera = self.sceneManager.createCamera('Camera') - self.camera.lookAt(ogre.Vector3(0, 0, 0)) - self.camera.nearClipDistance = 1 - self.camera.setAutoAspectRatio( True ) - - # create the camera nodes & attach camera - cameraNode = self.sceneManager.getRootSceneNode().createChildSceneNode( self.camera.getName(), ogre.Vector3( 0, 0, 0 ) ) - cameraNode.attachObject( self.camera ) - - self.sceneEntities.camera = self.camera - self.sceneEntities.cameraNode = cameraNode - - def _CreateViewport(self): - "create a Viewport" - viewport = self.renderWindow.addViewport( self.camera, 0, 0.0, 0.0, 1.0, 1.0) - viewport.backgroundColour = ogre.ColourValue(0, 0, 0) - - def _PopulateScene(self): - "Implement this method to put entities in your scene" - pass - - def _MouseAndKeysBindings(self): - "Some Additional mouse and keys bindings" - d=10.0 #displacement for key strokes - self.moveKeyDict={ ord('W') :ogre.Vector3( 0.0, 0.0, -d), - ord('S') :ogre.Vector3( 0.0, 0.0, d), - ord('A') :ogre.Vector3( -d, 0.0, 0.0), - ord('D') :ogre.Vector3( d, 0.0, 0.0), + + def _CreateCamera(self): + "create a Camera" + self.camera = self.sceneManager.createCamera('Camera') + self.camera.lookAt(ogre.Vector3(0, 0, 0)) + self.camera.nearClipDistance = 1 + self.camera.setAutoAspectRatio( True ) + + # create the camera nodes & attach camera + cameraNode = self.sceneManager.getRootSceneNode().createChildSceneNode( self.camera.getName(), ogre.Vector3( 0, 0, 0 ) ) + cameraNode.attachObject( self.camera ) + + self.sceneEntities.camera = self.camera + self.sceneEntities.cameraNode = cameraNode + + def _CreateViewport(self): + "create a Viewport" + viewport = self.renderWindow.addViewport( self.camera, 0, 0.0, 0.0, 1.0, 1.0) + viewport.backgroundColour = ogre.ColourValue(0, 0, 0) + + def _PopulateScene(self): + "Implement this method to put entities in your scene" + pass + + def _MouseAndKeysBindings(self): + "Some Additional mouse and keys bindings" + d=10.0 #displacement for key strokes + self.moveKeyDict={ ord('W') :ogre.Vector3( 0.0, 0.0, d), + ord('S') :ogre.Vector3( 0.0, 0.0, -d), + ord('A') :ogre.Vector3( d, 0.0, 0.0), + ord('D') :ogre.Vector3( -d, 0.0, 0.0), ord('R') :ogre.Vector3( 0.0, d, 0.0), ord('F') :ogre.Vector3( 0.0, -d, 0.0), - wx.WXK_LEFT :ogre.Vector3( -d, 0.0, 0.0), - wx.WXK_RIGHT :ogre.Vector3( d, 0.0, 0.0), - wx.WXK_UP :ogre.Vector3( 0.0, 0.0, -d), - wx.WXK_DOWN :ogre.Vector3( 0.0, 0.0, d), - wx.WXK_PAGEUP :ogre.Vector3( 0.0, d, 0.0), - wx.WXK_PAGEDOWN :ogre.Vector3( 0.0, -d, 0.0)} + wx.WXK_LEFT :ogre.Vector3( -d, 0.0, 0.0), + wx.WXK_RIGHT :ogre.Vector3( d, 0.0, 0.0), + wx.WXK_UP :ogre.Vector3( 0.0, 0.0, -d), + wx.WXK_DOWN :ogre.Vector3( 0.0, 0.0, d), + wx.WXK_PAGEUP :ogre.Vector3( 0.0, d, 0.0), + wx.WXK_PAGEDOWN :ogre.Vector3( 0.0, -d, 0.0)} #ord('Q') :ogre.Vector3( 0.0, d, 0.0), #ord('E') :ogre.Vector3( 0.0, -d, 0.0), - - self.Bind( wx.EVT_KEY_DOWN, self._DefaultKeyDownManager ) - self.Bind( wx.EVT_MOUSE_EVENTS, self._DefaultMouseEventManager) + + self.Bind( wx.EVT_KEY_DOWN, self._DefaultKeyDownManager ) + self.Bind( wx.EVT_MOUSE_EVENTS, self._DefaultMouseEventManager) ##self.Bind(wx.EVT_ENTER_WINDOW,lambda evt : self.SetFocus()) - - def _DefaultKeyDownManager( self, event ): - "If you want to implement a similar callback function, do not forget the event.Skip() at the end" - validMove = self.moveKeyDict.get( event.m_keyCode, False ) - if validMove: + + def _DefaultKeyDownManager( self, event ): + "If you want to implement a similar callback function, do not forget the event.Skip() at the end" + validMove = self.moveKeyDict.get( event.m_keyCode, False ) + if validMove: self.sceneEntities.cameraNode.translate( validMove, self.sceneEntities.cameraNode.TS_LOCAL ) - - #print ( "cam position %s, direction: %s" % ( toStr( self.sceneEntities.cameraNode.getPosition() ), + + #print ( "cam position %s, direction: %s" % ( toStr( self.sceneEntities.cameraNode.getPosition() ), #toStr( self.sceneEntities.camera.getDirection() ) ) ) - event.Skip() - + event.Skip() + def addListener( self, listener ): self.listener.append( listener ) - - def _DefaultMouseEventManager( self, event ): - "If you want to implement a similar callback function, do not forget the event.Skip() at the end" - self.SetFocus() #Gives Keyboard focus to the window - - if event.RightDown(): #Precedes dragging - self.StartDragX, self.StartDragY = event.GetPosition() #saves position of initial click - - if event.Dragging() and event.RightIsDown(): #Dragging with RMB - x,y = event.GetPosition() + + def _DefaultMouseEventManager( self, event ): + "If you want to implement a similar callback function, do not forget the event.Skip() at the end" + self.SetFocus() #Gives Keyboard focus to the window + + if event.RightDown(): #Precedes dragging + self.StartDragX, self.StartDragY = event.GetPosition() #saves position of initial click + + if event.Dragging() and event.RightIsDown(): #Dragging with RMB + x,y = event.GetPosition() dx = self.StartDragX -x dy = self.StartDragY -y - self.StartDragX, self.StartDragY = x, y - - self.sceneEntities.cameraNode.yaw( ogre.Degree( dx / 5.0 ), ogre.Node.TS_LOCAL ) + self.StartDragX, self.StartDragY = x, y + + self.sceneEntities.cameraNode.yaw( ogre.Degree( dx / 5.0 ), ogre.Node.TS_LOCAL ) self.sceneEntities.cameraNode.pitch( ogre.Degree( dy / 5.0 ), ogre.Node.TS_LOCAL ) - + for l in self.listener: l.onMouseEvent( event ) - - event.Skip() + + event.Skip() Modified: branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py =================================================================== --- branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py 2009-12-25 14:57:07 UTC (rev 1162) +++ branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py 2009-12-26 20:44:55 UTC (rev 1163) @@ -10,23 +10,23 @@ # Show help as tooltips self.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) self.proxyList = [] - + self.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) self.Bind( wxpg.EVT_PG_CHANGED, self.onPropGridChange ) - + def append( self, prop, cback = None, toolTip = None, parent = None ): prop.SetClientData( cback ) if toolTip: prop.SetHelpString( toolTip ) else: prop.SetHelpString( "no help for this" ) - + if not parent: self.Append( prop ) else: self.AppendIn( parent, prop ) return prop - + def onPropGridChange(self, event): p = event.GetProperty() if p: @@ -34,4 +34,7 @@ print "GetValue", p.GetValue() #print "GetValueRef", p.GetValueRef() if p.GetClientData(): - p.GetClientData()( name = p.GetName(), value = p.GetValue() ) \ No newline at end of file + try: + p.GetClientData()( name = p.GetName(), value = p.GetValue(), string = p.GetValueAsString() ) + except: + p.GetClientData()( name = p.GetName(), value = p.GetValue() ) \ No newline at end of file Modified: branches/ogEditor/plugins_linux.cfg =================================================================== --- branches/ogEditor/plugins_linux.cfg 2009-12-25 14:57:07 UTC (rev 1162) +++ branches/ogEditor/plugins_linux.cfg 2009-12-26 20:44:55 UTC (rev 1163) @@ -3,6 +3,4 @@ PluginFolder=/usr/lib/OGRE Plugin=RenderSystem_GL Plugin=Plugin_ParticleFX -#Plugin=Plugin_BSPSceneManager -#Plugin=Plugin_OctreeSceneManager Plugin=Plugin_CgProgramManager This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-25 14:57:15
|
Revision: 1162 http://opengate.svn.sourceforge.net/opengate/?rev=1162&view=rev Author: spom_spom Date: 2009-12-25 14:57:07 +0000 (Fri, 25 Dec 2009) Log Message: ----------- revive python-opengate bindings Modified Paths: -------------- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py branches/ogEditor/ogEditor/apps/opengate/pyopengate/Makefile branches/ogEditor/ogEditor/apps/opengate/pyopengate/build.sh branches/ogEditor/ogEditor/apps/opengate/pyopengate/environment.py branches/ogEditor/ogEditor/apps/opengate/pyopengate/generate_code.py branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate.h Added Paths: ----------- branches/ogEditor/ogEditor/apps/opengate/ceguiLayoutApp.py branches/ogEditor/ogEditor/apps/opengate/pyopengate/ branches/ogEditor/ogEditor/apps/opengate/pyopengate/tmp/ branches/ogEditor/ogEditor/apps/opengate/pyopengate/tmp/__array_1.pypp.hpp branches/ogEditor/ogEditor/apps/opengate/pyopengate/tmp/__call_policies.pypp.hpp branches/ogEditor/ogEditor/apps/opengate/test/ branches/ogEditor/ogEditor/apps/opengate/test/testOpengate.py Removed Paths: ------------- branches/ogEditor/ogEditor/apps/opengate/opengate/ branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate_aliases.h branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate_sizeof.h Added: branches/ogEditor/ogEditor/apps/opengate/ceguiLayoutApp.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/ceguiLayoutApp.py (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/ceguiLayoutApp.py 2009-12-25 14:57:07 UTC (rev 1162) @@ -0,0 +1,299 @@ +# -*- coding: iso-8859-1 -*- + +import wx + +from ogEditor.base import AppResource + +from ogEditor.wxOgre import ogre, OgreWindow +from ogEditor.wxOgre.CEGUI_framework import * + +import ogre.gui.CEGUI as CEGUI + +try: + from agw import aui + from agw.aui import aui_switcherdialog as ASD +except ImportError: # if it's not there locally, try the wxPython lib. + import wx.lib.agw.aui as aui + from wx.lib.agw.aui import aui_switcherdialog as ASD + +from ogEditor.resources import loadIcon, MakeDisabledBitmap + +from ogEditor.wxpg import wxpg, HAVE_PROPGRID, wxPropGridWrapper + +class XMLSerializer(): + """ + based on CEGUI::XMLSerializer since there are some "No to_python (by-value) converter found for C++ type" + """ + def __init__( self, fi, indentSpace = 4 ): + self.fi = fi + self.indentSpace_ = indentSpace + self.tagCount_ = 0 + self.fi.write( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ) + self.needClose_ = False + self.lastIsText_ = False + self.depth_ = 0 + self.tagStack_ = [] + + def __del__( self ): + self.fi.close() + + def openTag( self, name ): + self.tagCount_ += 1 + if self.needClose_: self.fi.write( '>') + + if not self.lastIsText_: + self.fi.write( '\n') + self.indentLine(); + + self.fi.write( '<' + str( name ) + ' ' ) + self.tagStack_.append( name ) + self.depth_ += 1 + self.needClose_ = True + self.lastIsText_ = False + + return self + + def closeTag( self ): + back = self.tagStack_.pop( -1 ) + + self.depth_ -= 1; + if self.needClose_: + self.fi.write( "/>" ) + elif not self.lastIsText_: + self.fi.write( "\n" ) + self.indentLine(); + self.fi.write( "</" + str( back )+ '>' ); + else: + self.fi.write( "</" + str( back )+ '>' ); + + self.lastIsText_ = False + self.needClose_ = False; + + return self + + def attribute( self, name, value): + if not self.needClose_: + pass + else: + self.fi.write( str( name ) + '="' + str( value ) + '" ' ); + + self.lastIsText_ = False + return self + + def text( self, text ): + if self.needClose_: + self.fi.write( '>' ) + self.needClose_ = False; + + self.fi.write( str( text ) ) + self.lastIsText_ = True; + + return self + + def getTagCount( self ): return self.tagCount_ + + def indentLine( self ): + for i in range( self.depth_ * self.indentSpace_ ): + self.fi.write( ' ' ) + + +class CEGUIWindow( AppResource ): + props = [ [ "Visible", bool ] + , [ "Text", str ] + , [ "Disabled", bool ] + , [ "RiseOnClick", bool ] + , [ "AlwaysOnTop", bool ] + , [ "FrameEnabled", bool ] + , [ "InheritsAlpha", bool ] + , [ "BackgroundEnabled", bool ] + , [ "MousePassThroughEnabled", bool ] + , [ "Font", str ] + , [ "NormalTextColour", str ] + , [ "SelectedTextColour", str ] + , [ "ActiveSelectionColour", str ] + , [ "InactiveSelectionColour", str ] + , [ "HoverTextColour", str ] + , [ "DisabledTextColour", str ] + , [ "VertLabelFormatting", str ] + , [ "HorzLabelFormatting", str ] + , [ "Image", str ] + , [ "HoverImage", str ] + , [ "NormalImage", str ] + , [ "PushedImage", str ] + , [ "MouseCursorImage", str ] + #, [ "UnifiedAreaRect", str ] + , [ "UnifiedPosition", str ] + , [ "UnifiedSize", str ] + ] + + def __init__( self, parent, rendererSlot, propertyInspectorSlot ): + AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) + self.window = None + self.childWindows = [] + self.layout = None + + def getToolBar( self, parent ): return self.layout.getToolBar( parent ) + + def createPropertyPanel( self, parent ): + if not HAVE_PROPGRID: + return wx.Panel( parent ) + + panel = wxPropGridWrapper( parent ) + panel.Append( wxpg.PropertyCategory("CEGUI.Window") ) + + prop = wxpg.StringProperty( "Name", value = str( self.window.getName() ) ) + panel.append( prop, self.onNameChanged ) + prop = wxpg.StringProperty( "Type", value = str( self.window.getType() ) ) + panel.append( prop, self.onTypeChanged ) + + self.fillPG( panel, self.window, self.onWindowPropertyChanged ) + return panel + + def fillPG( self, panel, obj, target ): + #self.window.getIterator lacks python converter :( + + for k in self.props: + name = k[0] + typ = k[1] + + if obj.isPropertyPresent( name ): + val = obj.getProperty( name ) + if typ == bool: + if val == 'True': + prop = wxpg.BoolProperty( name, value = True ) + else: + prop = wxpg.BoolProperty( name, value = False ) + + prop.DoSetAttribute( 'UseCheckbox', 1 ) + prop.DoSetAttribute( 'UseDClickCycling', 1 ) + + elif typ == str: + prop = wxpg.StringProperty( name, value = str( val ) )#str( val ) ) + + panel.append( prop, self.onWindowPropertyChanged ) #, toolTip = obj.__getattribute__( att ).__doc__ ) + + + def onWindowPropertyChanged( self, name, value ): + print "onWindowPropertyChanged:", name, value + self.window.setProperty( name, str( value ) ) + #getattr( self.axes, name )( value ) + if self.layout is not None: + try: + self.layout.toolBar_.EnableTool( self.layout.tbSave.GetId(), True ) + self.layout.toolBar_.Refresh() + except: + pass + + def onNameChanged( self, name ): + print "onNameChanged:", name + + def onTypeChanged( self, name ): + print "onTypeChanged:", name + + def expand( self ): + self.childWindows = [] + for c in range( self.window.ChildCount ): + if '__auto_' not in str( self.window.getChildAtIdx( c ).getName() ): + it = self.createChildItem( CEGUIWindow, str( self.window.getChildAtIdx( c ).getName() ) ) + it.window = self.window.getChildAtIdx( c ) + it.layout = self.layout + it.expand() + self.childWindows.append( it ) + + self.parent.resourceTree.Expand( self.treeItem ) + + def writeXML( self, xml ): + xml.openTag( 'Window' ) + xml.attribute( "Type", self.window.getType()); + xml.attribute( "Name", self.window.getName()); + for p in self.props: + name = p[0] + typ = p[1] + if self.window.isPropertyPresent( name ): + val = self.window.getProperty( name ) + xml.openTag( 'Property' ) + xml.attribute( "Name", name ); + xml.attribute( "Value", str( val ) ); + xml.closeTag( ) + + for c in self.childWindows: + c.writeXML( xml ) + + xml.closeTag( ) + +class CEGUILayout( AppResource ): + def __init__( self, parent, rendererSlot, propertyInspectorSlot ): + AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) + + self.fullFileName = None + self.layoutName = None + self.guiSystem = None + self.layout = None + self.toolBar_ = None + self.window = None + + def activate( self, active ): + self.activateToolBar_( self.getToolBar( self.parent ), active ) + if active: + if self.layout is None: + self.load( ) + self.guiSystem.setGUISheet( self.layout ) + + def getToolBar( self, parent ): + if self.toolBar_ is None: + self.toolBar_ = aui.AuiToolBar( parent, -1, wx.DefaultPosition, wx.DefaultSize, + aui.AUI_TB_DEFAULT_STYLE | aui.AUI_TB_PLAIN_BACKGROUND ) + + self.toolBar_.SetName( "CEGUI-layout Toolbar" ) + + self.toolBar_.SetToolBitmapSize( wx.Size( 22, 22 ) ) + + self.tbSave = self.toolBar_.AddSimpleTool( wx.NewId(), "Save", loadIcon( "document-save.png" ) + , "Save current project" + ) + self.tbSave.SetDisabledBitmap( MakeDisabledBitmap( loadIcon( "document-save.png" ) ) ) + + self.tbReload = self.toolBar_.AddSimpleTool( wx.NewId(), "Reload", loadIcon( "view-refresh.png" ) + , "Reload the current layout" + ) + + self.toolBar_.EnableTool( self.tbSave.GetId(), False ) + + wx.EVT_TOOL( self.toolBar_, self.tbReload.GetId(), self.onReload ) + wx.EVT_TOOL( self.toolBar_, self.tbSave.GetId(), self.onSave ) + + return self.toolBar_ + + def load( self ): + self.layout = CEGUI.WindowManager.getSingleton().loadWindowLayout( self.layoutName ) + + self.parent.resourceTree.DeleteChildren( self.treeItem ) + + self.window = self.createChildItem( CEGUIWindow, str( self.layout.getName() ) ) + + self.window.window = self.layout + self.window.layout = self + self.window.expand() + + def onReload( self, event = None ): + if self.layout is not None: + CEGUI.WindowManager.getSingleton().destroyWindow( self.layout ) + #CEGUI.SchemeManager.getSingleton().unloadScheme("opengate") + #CEGUI.SchemeManager.getSingleton().loadScheme("opengate.scheme") + self.load() + self.guiSystem.setGUISheet( self.layout ) + self.parent.statusBar.setStatusMessage( "reloaded: " + self.fullFileName ) + + def onSave( self, event = None ): + + #outfile = std.ostream( "test-layout.xml" ) + #CEGUI.WindowManager.getSingleton().writeWindowLayoutToStream( self.layout, outfile) + outfile = open( self.fullFileName, "w" ) + + xml = XMLSerializer( outfile ) + self.window.writeXML( xml ) + outfile.close() + self.toolBar_.EnableTool( self.tbSave.GetId(), False ) + self.toolBar_.Refresh() + print "wrote: ", self.fullFileName + self.parent.statusBar.setStatusMessage( "wrote: " + self.fullFileName ) Modified: branches/ogEditor/ogEditor/apps/opengate/opengateedit.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-23 19:54:13 UTC (rev 1161) +++ branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-25 14:57:07 UTC (rev 1162) @@ -21,297 +21,80 @@ from ogEditor.wxpg import wxpg, HAVE_PROPGRID, wxPropGridWrapper -class XMLSerializer(): - """ - based on CEGUI::XMLSerializer since there are some "No to_python (by-value) converter found for C++ type" - """ - def __init__( self, fi, indentSpace = 4 ): - self.fi = fi - self.indentSpace_ = indentSpace - self.tagCount_ = 0 - self.fi.write( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ) - self.needClose_ = False - self.lastIsText_ = False - self.depth_ = 0 - self.tagStack_ = [] - - def __del__( self ): - self.fi.close() - - def openTag( self, name ): - self.tagCount_ += 1 - if self.needClose_: self.fi.write( '>') - - if not self.lastIsText_: - self.fi.write( '\n') - self.indentLine(); +from ceguiLayoutApp import CEGUILayout - self.fi.write( '<' + str( name ) + ' ' ) - self.tagStack_.append( name ) - self.depth_ += 1 - self.needClose_ = True - self.lastIsText_ = False - - return self - - def closeTag( self ): - back = self.tagStack_.pop( -1 ) - - self.depth_ -= 1; - if self.needClose_: - self.fi.write( "/>" ) - elif not self.lastIsText_: - self.fi.write( "\n" ) - self.indentLine(); - self.fi.write( "</" + str( back )+ '>' ); - else: - self.fi.write( "</" + str( back )+ '>' ); - - self.lastIsText_ = False - self.needClose_ = False; - - return self - - def attribute( self, name, value): - if not self.needClose_: - pass - else: - self.fi.write( str( name ) + '="' + str( value ) + '" ' ); - - self.lastIsText_ = False - return self - - def text( self, text ): - if self.needClose_: - self.fi.write( '>' ) - self.needClose_ = False; - - self.fi.write( str( text ) ) - self.lastIsText_ = True; - - return self - - def getTagCount( self ): return self.tagCount_ - - def indentLine( self ): - for i in range( self.depth_ * self.indentSpace_ ): - self.fi.write( ' ' ) +HAVE_PYOPENGATE = False +try: + import pyopengate as og + HAVE_PYOPENGATE = True +except Exception, e: + print e + print "no python bindung for opengate lib found" -class CEGUIWindow( AppResource ): - props = [ [ "Visible", bool ] - , [ "Text", str ] - , [ "Disabled", bool ] - , [ "RiseOnClick", bool ] - , [ "AlwaysOnTop", bool ] - , [ "FrameEnabled", bool ] - , [ "InheritsAlpha", bool ] - , [ "BackgroundEnabled", bool ] - , [ "MousePassThroughEnabled", bool ] - , [ "Font", str ] - , [ "NormalTextColour", str ] - , [ "HoverTextColour", str ] - , [ "DisabledTextColour", str ] - , [ "VertLabelFormatting", str ] - , [ "HorzLabelFormatting", str ] - , [ "Image", str ] - , [ "HoverImage", str ] - , [ "NormalImage", str ] - , [ "PushedImage", str ] - #, [ "UnifiedAreaRect", str ] - , [ "UnifiedPosition", str ] - , [ "UnifiedSize", str ] - ] - - def __init__( self, parent, rendererSlot, propertyInspectorSlot ): - AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) - self.window = None - self.childWindows = [] - self.layout = None - - def getToolBar( self, parent ): return self.layout.getToolBar( parent ) - - def createPropertyPanel( self, parent ): - if not HAVE_PROPGRID: - return wx.Panel( parent ) - - panel = wxPropGridWrapper( parent ) - panel.Append( wxpg.PropertyCategory("CEGUI.Window") ) - - prop = wxpg.StringProperty( "Name", value = str( self.window.getName() ) ) - panel.append( prop, self.onNameChanged ) - prop = wxpg.StringProperty( "Type", value = str( self.window.getType() ) ) - panel.append( prop, self.onTypeChanged ) - - self.fillPG( panel, self.window, self.onWindowPropertyChanged ) - return panel +class OpengateHandler( ): + def __init__( self, OgreWindow ): + self.resourceManager_ = og.ResourceManager() + self.resourceManager_.logManager = og.LogManager() + self.resourceManager_.entityManager = og.EntityManager( ) + self.resourceManager_.ogreRoot = OgreWindow.ogreRoot + self.resourceManager_.renderWindow = OgreWindow.renderWindow + self.sceneManager_ = OgreWindow.sceneManager - def fillPG( self, panel, obj, target ): - #self.window.getIterator lacks python converter :( - - for k in self.props: - name = k[0] - typ = k[1] - - if obj.isPropertyPresent( name ): - val = obj.getProperty( name ) - if typ == bool: - if val == 'True': - prop = wxpg.BoolProperty( name, value = True ) - else: - prop = wxpg.BoolProperty( name, value = False ) - - prop.DoSetAttribute( 'UseCheckbox', 1 ) - prop.DoSetAttribute( 'UseDClickCycling', 1 ) - - elif typ == str: - prop = wxpg.StringProperty( name, value = str( val ) )#str( val ) ) + for res in OgreWindow.resourceLocations: + self.resourceManager_.addResourceLocation( res[0], res[1] ) - panel.append( prop, self.onWindowPropertyChanged ) #, toolTip = obj.__getattribute__( att ).__doc__ ) - - - def onWindowPropertyChanged( self, name, value ): - print "onWindowPropertyChanged:", name, value - self.window.setProperty( name, str( value ) ) - #getattr( self.axes, name )( value ) - if self.layout is not None: - try: - self.layout.toolBar_.EnableTool( self.layout.tbSave.GetId(), True ) - self.layout.toolBar_.Refresh() - except: - pass - - def onNameChanged( self, name ): - print "onNameChanged:", name - - def onTypeChanged( self, name ): - print "onTypeChanged:", name - - def expand( self ): - self.childWindows = [] - for c in range( self.window.ChildCount ): - if '__auto_' not in str( self.window.getChildAtIdx( c ).getName() ): - it = self.createChildItem( CEGUIWindow, str( self.window.getChildAtIdx( c ).getName() ) ) - it.window = self.window.getChildAtIdx( c ) - it.layout = self.layout - it.expand() - self.childWindows.append( it ) - - self.parent.resourceTree.Expand( self.treeItem ) - - def writeXML( self, xml ): - xml.openTag( 'Window' ) - xml.attribute( "Type", self.window.getType()); - xml.attribute( "Name", self.window.getName()); - for p in self.props: - name = p[0] - typ = p[1] - if self.window.isPropertyPresent( name ): - val = self.window.getProperty( name ) - xml.openTag( 'Property' ) - xml.attribute( "Name", name ); - xml.attribute( "Value", str( val ) ); - xml.closeTag( ) - - for c in self.childWindows: - c.writeXML( xml ) - - xml.closeTag( ) + self.initOpenGateResources_() -class CEGUILayout( AppResource ): - def __init__( self, parent, rendererSlot, propertyInspectorSlot ): - AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) + def initOpenGateResources_( self ): + self.resourceManager_.loadGlobalIDs( "ids.xml" ) + entityManager = self.resourceManager_.entityManager + entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "commodities" ); + entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "engines" ); + entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "capacitors" ); + entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "radars" ); + entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "shields" ); + entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "ecms" ); + entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "power_plants" ); + entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "guns" ); + entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "missiles" ); + entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "ships" ); + entityManager.load( self.resourceManager_.resourceLocations( "Opengate" ), "stations" ); - self.fullFileName = None - self.layoutName = None - self.guiSystem = None - self.layout = None - self.toolBar_ = None - self.window = None - - def activate( self, active ): - self.activateToolBar_( self.getToolBar( self.parent ), active ) - if active: - if self.layout is None: - self.load( ) - self.guiSystem.setGUISheet( self.layout ) - - def getToolBar( self, parent ): - if self.toolBar_ is None: - self.toolBar_ = aui.AuiToolBar( parent, -1, wx.DefaultPosition, wx.DefaultSize, - aui.AUI_TB_DEFAULT_STYLE | aui.AUI_TB_PLAIN_BACKGROUND ) - - self.toolBar_.SetName( "CEGUI-layout Toolbar" ) - - self.toolBar_.SetToolBitmapSize( wx.Size( 22, 22 ) ) - - self.tbSave = self.toolBar_.AddSimpleTool( wx.NewId(), "Save", loadIcon( "document-save.png" ) - , "Save current project" - ) - self.tbSave.SetDisabledBitmap( MakeDisabledBitmap( loadIcon( "document-save.png" ) ) ) - - self.tbReload = self.toolBar_.AddSimpleTool( wx.NewId(), "Reload", loadIcon( "view-refresh.png" ) - , "Reload the current layout" - ) - - self.toolBar_.EnableTool( self.tbSave.GetId(), False ) + def fillResourcesTree( self, tree, node ): + self.sceneTree_ = tree; + if self.resourceManager_: + ogResManNode = tree.AppendItem( node, "OpenGate resource manager" ) - wx.EVT_TOOL( self.toolBar_, self.tbReload.GetId(), self.onReload ) - wx.EVT_TOOL( self.toolBar_, self.tbSave.GetId(), self.onSave ) - - return self.toolBar_ - - def load( self ): - self.layout = CEGUI.WindowManager.getSingleton().loadWindowLayout( self.layoutName ) - - self.parent.resourceTree.DeleteChildren( self.treeItem ) - - self.window = self.createChildItem( CEGUIWindow, str( self.layout.getName() ) ) - - self.window.window = self.layout - self.window.layout = self - self.window.expand() - - def onReload( self, event = None ): - if self.layout is not None: - CEGUI.WindowManager.getSingleton().destroyWindow( self.layout ) - #CEGUI.SchemeManager.getSingleton().unloadScheme("opengate") - #CEGUI.SchemeManager.getSingleton().loadScheme("opengate.scheme") - self.load() - self.guiSystem.setGUISheet( self.layout ) - self.parent.statusBar.setStatusMessage( "reloaded: " + self.fullFileName ) - - def onSave( self, event = None ): - - #outfile = std.ostream( "test-layout.xml" ) - #CEGUI.WindowManager.getSingleton().writeWindowLayoutToStream( self.layout, outfile) - outfile = open( self.fullFileName, "w" ) - - xml = XMLSerializer( outfile ) - self.window.writeXML( xml ) - outfile.close() - self.toolBar_.EnableTool( self.tbSave.GetId(), False ) - self.toolBar_.Refresh() - print "wrote: ", self.fullFileName - self.parent.statusBar.setStatusMessage( "wrote: " + self.fullFileName ) - + if self.resourceManager_.entityManager: + ogEntityManagerNode = tree.AppendItem( ogResManNode, "Entity manager" ) + categories = self.resourceManager_.entityManager.categories(); + + for category in categories: + categoryNode = tree.AppendItem( ogEntityManagerNode, category ) + + def showSector( self, name ): + self.sector_ = og.Sector( self.sceneManager_, None ) + self.sector_.populate( name ) + class OpengateEditor( AppResource ): def __init__( self, parent, rendererSlot, propertyInspectorSlot ): AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) - + # set the name of this application that appears to the resource tree - + self.setName("Opengate") self.sceneManager = None self.GUIRenderer = None self.GUISystem = None self.parentResource = self - + self.opengateHandler = None + pass - + def postCreate( self ): pass - + #def createPropertyPanel( self, parent ): #""" #Define and return panel that is shown in the property-inspector (PI) @@ -320,48 +103,51 @@ ## create a Notebook for the PI and add the content for the panel with the name piTestApplication defined in testapp.xrc #panel = self.createPropertyInspectorNoteBookPanel( parent, 'piTestApplication', title = 'TestApplication' ) - + ## define property behaviour #self.titleTextProp.setCtrl( ctrl = wx.xrc.XRCCTRL( panel, 'TitleTextCtrl' ) # name of the control in xrc #, ctrlEvent = wx.EVT_TEXT # the event that should observed #, targetFunct = self.setTitle ) # the callback when the event is called - + #return panel - + def getRenderer( self, slot = None): if not self.renderer_ and slot is not None: self.renderer_ = OgreWindow( slot, resourceFile = os.path.join( os.path.dirname(__file__), 'opengate-resources.cfg' ) ) #self.renderer_.SetMinSize( wx.Size( 800, 600 ) ) self.renderer_.StartRendering() - + self.sceneManager = self.renderer_.sceneManager self.sceneManager.setAmbientLight(ogre.ColourValue(1, 1, 1)) rootNode = self.sceneManager.getRootSceneNode() - ninja = self.sceneManager.createEntity('apteryx', 'apteryx.mesh') - node = rootNode.createChildSceneNode("apteryx_node", ogre.Vector3(0, 0, -100)) - node.attachObject(ninja) - + if HAVE_PYOPENGATE: + self.opengateHandler = OpengateHandler( self.renderer_ ) + else: + apty = self.sceneManager.createEntity('apteryx', 'apteryx.mesh') + node = rootNode.createChildSceneNode("apteryx_node", ogre.Vector3(0, 0, -100)) + node.attachObject(apty) + if CEGUI.Version__.startswith ("0.6"): - self.GUIRenderer = CEGUI.OgreCEGUIRenderer(self.renderer_.renderWindow, - ogre.RENDER_QUEUE_OVERLAY, False, 3000, self.sceneManager) - self.GUISystem = CEGUI.System(self.GUIRenderer) + self.GUIRenderer = CEGUI.OgreCEGUIRenderer(self.renderer_.renderWindow, + ogre.RENDER_QUEUE_OVERLAY, False, 3000, self.sceneManager) + self.GUISystem = CEGUI.System(self.GUIRenderer) else: self.GUIRenderer = CEGUI.OgreRenderer.bootstrapSystem() self.GUISystem = CEGUI.System.getSingleton() - + logger = CEGUI.Logger.getSingleton() level = CEGUI.Insane - logger.setLoggingLevel(level) - + logger.setLoggingLevel(level) + CEGUI.SchemeManager.getSingleton().loadScheme("opengate.scheme") self.GUISystem.setDefaultMouseCursor("opengateCursor", "Cursor1") self.GUISystem.setDefaultFont("BlueHighway-12") - + self.renderer_.addListener( wxCEGUIListener( self.GUIRenderer ) ) - + ############################## - # hackish parsing CEGUI.log for reading of CEGUI Factory content until CEGUI.*.getIterator() lacks python converter + # hackish parsing CEGUI.log for reading of CEGUI Factory content until CEGUI.*.getIterator() lacks python converter ############################## self.ceguiWindowFactories = [] self.ceguiWindowRendererFactories = [] @@ -375,59 +161,63 @@ f = line.split("'") #if CEGUI.WindowFactoryManager.getSingleton().isFactoryPresent( f[ 1 ] ): self.ceguiWindowRendererFactories.append( f[ 1 ] ) - + print self.ceguiWindowRendererFactories fi.close() ############################## - + #self.frameListener = GuiFrameListener( self.renderer_.renderWindow, self.renderer_.camera, self.GUIRenderer) #self.sceneManager) #self.frameListener.MenuMode = True # this stop the camera moving with the mouse cursor.. #self.renderer_.ogreRoot.addFrameListener(self.frameListener) #self.frameListener.showDebugOverlay(False) - + self.buildResourceTree( ) - + return self.renderer_ - + def buildResourceTree( self ): - + tree = self.parent.resourceTree root = self.treeItem - + + if self.opengateHandler is not None: + self.opengateHandler.fillResourcesTree( tree, root ) + self.opengateHandler.showSector( "test.sector" ) + #resManNode = tree.AppendItem( root, "Ogre resource manager" ) ### Insert resources group managers (Material, Mesh, Texture etc. ) ogreResourceGroupManager = ogre.ResourceGroupManager.getSingleton() - + ## Insert resources sorted by resource groups resGroupManNode = tree.addItem( ogreResourceGroupManager, "Ogre resource groups", root ) - + resGroups = ogreResourceGroupManager.getResourceGroups( ) - - # this don't work it throws strange exception 'get' + + # this don't work it throws strange exception 'get' # for resGroupName in resGroups ): - + for i in range( 0, len( resGroups ) ): resGroupName = resGroups[ i ] resGroupNode = tree.addItem( None, resGroupName, resGroupManNode ) - + resManIter = ogreResourceGroupManager.getResourceManagerIterator() while resManIter.hasMoreElements(): resManNodeIter = tree.addItem( resManIter.peekNextValue(), resManIter.peekNextKey(), resGroupNode ) resIter = resManIter.peekNextValue().getResourceIterator() - + while resIter.hasMoreElements(): if resIter.peekNextValue().getGroup() == resGroupName: tree.addItem( resIter.peekNextValue(), resIter.peekNextValue().getName(), resManNodeIter ) - + resIter.getNext() resManIter.getNext() - + ceguiNode = tree.addItem( None, 'CEGUI', root ) layouts = self.findResources( 'gui/layouts', '.layout' ) - + if layouts: layoutNode = tree.addItem( None, 'layouts', ceguiNode, True ) for l in layouts: @@ -435,17 +225,17 @@ it.layoutName = l[0] it.fullFileName = l[1] it.guiSystem = self.GUISystem - - + + def findResources( self, filesystem, pattern ): for res in self.renderer_.resourceLocations: if res[ 1 ] == 'Opengate' and filesystem in res[ 0 ]: ret = [] - + def findFiles( path, pattern, ret, cummulativPath = ''): paths = os.listdir( path ) if len( paths ) == 0: return ret - + dirs = [] for p in paths: if p[-1] is not '~': @@ -456,19 +246,19 @@ for d in dirs: findFiles( os.path.join( path, d), pattern, ret, cummulativPath + d + '/' ) - + return ret - + return findFiles( res[ 0 ], pattern, ret ) return None - + def menuFunction( self, event = None ): """ do nothing here, just to show the technique """ pass - + def setTitle( self, title = None ): """ Set the title, either called manually or by callback Modified: branches/ogEditor/ogEditor/apps/opengate/pyopengate/Makefile =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/Makefile 2009-12-17 23:21:18 UTC (rev 1151) +++ branches/ogEditor/ogEditor/apps/opengate/pyopengate/Makefile 2009-12-25 14:57:07 UTC (rev 1162) @@ -1,32 +1,35 @@ BOOSTINC=-I /usr/include/boost -PYTHONINC=-I /usr/include/python2.5 +PYTHONINC=-I /usr/include/python2.6 OGREINC=`pkg-config --cflags OGRE gtk+-2.0 ogreopcode` -OPENGATEINC=-I $(HOME)/local/opengate/trunk/src +OPENGATEPATH=$(HOME)/local/opengate/trunk +OPENGATEINC=-I $(OPENGATEPATH)/src BOOSTLIB=-L /usr/lib64 -lboost_python-mt -lboost_thread -lboost_regex -lboost_system OGRELIB=`pkg-config --libs OGRE gtk+-2.0 ogreopcode CEGUI-OGRE CEGUI openal freealut OIS vorbisfile` -OGREGEN=-I /home/carsten/local/python-ogre-ebuild/python-ogre/generated/ogre_1.6.0 -TARGET=opengate +#OGREGEN=-I /home/carsten/local/python-ogre-ebuild/python-ogre/generated/ogre_1.6.4 +OGREGEN= +TARGET=_pyopengate_ COPT=-Os -fPIC -DBOOST_PYTHON_NO_PY_SIGNATURES -CONTAINERSUITE= -I ./indexing_suite_v2 -#CONTAINERSUITE= -I ./boost - CPPCFILES = $(wildcard generated/*.cpp) -OBJECTS = $(patsubst %.cpp,%.o,$(CPPCFILES)) -OPENGATEOBJ=$(wildcard $(HOME)/local/opengate/trunk/src/opengateclient*.o) +OBJECTS = $(patsubst %.cpp,%.o,$(CPPCFILES) ) +OPENGATELIB = $(OPENGATEPATH)/src/libopengate.a -default: $(TARGET) +default: $(TARGET) .cpp.o: g++ $(COPT) $(DEFINES) -c -o $(patsubst %.cpp,%.o, $<) -I ./ $(CONTAINERSUITE) $(BOOSTINC) $(OPENGATEINC) $(PYTHONINC) $(OGREGEN) $(OGREINC) $< - + $(TARGET): $(OBJECTS) - g++ -o generated/$(TARGET).so -Wl,-rpath=\/../../lib `pkg-config --libs OGRE` --strip-all -lstdc++ -shared $(OBJECTS) $(BOOSTLIB) $(OPENGATEOBJ) $(OGRELIB) + g++ -o generated/$(TARGET).so -Wl,-rpath=\/../../lib `pkg-config --libs OGRE` --strip-all -lstdc++ -shared \ + $(OBJECTS) $(OPENGATELIB) \ + $(BOOSTLIB) $(OGRELIB) strip -g -S -d --strip-debug -s generated/$(TARGET).so + mv generated/_pyopengate_.so ./ +# clean: rm -rf generated/* - rm -f *.so +# rm -f *.so rm -f *.cache Modified: branches/ogEditor/ogEditor/apps/opengate/pyopengate/build.sh =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/build.sh 2009-12-17 23:21:18 UTC (rev 1151) +++ branches/ogEditor/ogEditor/apps/opengate/pyopengate/build.sh 2009-12-25 14:57:07 UTC (rev 1162) @@ -1,4 +1,5 @@ #!/bin/bash +mkdir -p generated if [ $OSTYPE = "msys" ]; then echo "build for mingw" @@ -6,15 +7,13 @@ bjam toolset=gcc else echo "build for linux gcc" - mkdir -p generated MAKEOPTS=-j5 - make clean - sh build.wxogre_util.sh + make clean - if [ $# -lt 1 ]; then - python generate_code.py - make $MAKEOPTS - cp generated/opengate.so packages_2.5/opengate/OpenGate.so - + if [ $# -lt 1 ]; then + python generate_code.py + cp tmp/* generated/ + make $MAKEOPTS + #cp generated/_pyopengate_.so ./ fi fi Modified: branches/ogEditor/ogEditor/apps/opengate/pyopengate/environment.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/environment.py 2009-12-17 23:21:18 UTC (rev 1151) +++ branches/ogEditor/ogEditor/apps/opengate/pyopengate/environment.py 2009-12-25 14:57:07 UTC (rev 1162) @@ -1,4 +1,5 @@ #! /usr/bin/python +# -*- coding: iso-8859-1 -*- # Copyright 2004 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at @@ -6,8 +7,8 @@ import sys -class settings: - module_name = 'OpenGate' +class settings: + module_name = '_pyopengate_' #opengate_path = '../../trunc/src/' opengate_path = '/home/carsten/local/opengate/trunk/src/' opengate_cache_file ='python_opengate.cache' @@ -15,7 +16,7 @@ ogreopcode_include_path = '' boost_path = '' boost_libs_path = '' - gccxml_path = '' + gccxml_path = '' pygccxml_path = '' pyplusplus_path = '' python_libs_path = '' @@ -23,25 +24,25 @@ working_dir = '' unittests_dir = '' generated_files_dir = './generated' - opengate_defines = '' + opengate_defines = '__PYTHONOGRE_BUILD_CODE' def setup_environment(): print settings.pygccxml_path sys.path.append( settings.pygccxml_path ) sys.path.append( settings.pyplusplus_path ) setup_environment = staticmethod(setup_environment) - + if sys.platform == 'linux2': - settings.python_include_path = '/usr/include/python2.5' + settings.python_include_path = '/usr/include/python2.6' settings.ogre_include_path = '/usr/include/OGRE' settings.ogreopcode_include_path = '/usr/include/ogreopcode' - settings.gccxml_path = '/usr/bin' - settings.pygccxml_path = '/usr/lib64/python2.5/site-packages' - settings.pyplusplus_path = '/usr/lib64/python2.5/site-packages' - + settings.gccxml_path = '/usr/bin' + settings.pygccxml_path = '/usr/lib64/python2.6/site-packages' + settings.pyplusplus_path = '/usr/lib64/python2.6/site-packages' + elif sys.platform == 'win32': settings.pygccxml_path = 'c:/python25/Lib/site-packages/' settings.python_libs_path = 'c:/python25/libs' - settings.gccxml_path = 'c:/Programme/GCCXMLcomplete/bin' + settings.gccxml_path = 'c:/Programme/GCCXMLcomplete/bin' settings.opengate_defines ='MINGW' else: raise RuntimeError( 'There is no configuration for "%s" platform.' % sys.platform ) Modified: branches/ogEditor/ogEditor/apps/opengate/pyopengate/generate_code.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/generate_code.py 2009-12-17 23:21:18 UTC (rev 1151) +++ branches/ogEditor/ogEditor/apps/opengate/pyopengate/generate_code.py 2009-12-25 14:57:07 UTC (rev 1162) @@ -15,7 +15,7 @@ from pyplusplus import module_builder from pyplusplus.module_builder import call_policies -import common_utils.ogre_properties as ogre_properties +#import common_utils.ogre_properties as ogre_properties MAIN_NAMESPACE = 'OpenGate' @@ -38,14 +38,14 @@ self.prefix = prefix def __call__ (self, decl): return self.prefix in decl.name - + def excludeFreeFunctionsByReturn( mb, functs): for funct in functs: fun = mb.global_ns.free_functions( return_type=funct, allow_empty=True ) print "exclude", funct, len( fun ) for f in fun: f.exclude() - + def excludeFreeFunctionsByName( mb, functs): for funct in functs: fun = mb.global_ns.free_functions( name=funct, allow_empty=True ) @@ -71,7 +71,7 @@ fun = mb.global_ns.member_functions( return_type=funct, allow_empty=True ) print "exclude", funct, len( fun ) for f in fun: - f.exclude() + f.exclude() def excludeMemberOperators( mb, functs): for funct in functs: @@ -84,7 +84,7 @@ for ref in MemberRetRef: memFuns = mb.global_ns.member_functions( return_type=ref, allow_empty=True ) print ref, len(memFuns) - + for memFun in memFuns: if memFun.call_policies: continue @@ -97,48 +97,49 @@ settings.opengate_cache_file ) print xml_cached_fc - + defined_symbols.append( settings.opengate_defines ) mb = module_builder.module_builder_t( [xml_cached_fc], gccxml_path = settings.gccxml_path, working_directory = settings.opengate_path, - include_paths = [settings.opengate_path, settings.python_include_path, + include_paths = [settings.opengate_path, settings.python_include_path, settings.ogreopcode_include_path, settings.ogre_include_path], define_symbols = defined_symbols, indexing_suite_version = 1 ) ## This module depends on Ogre - #mb.register_module_dependency ( '/home/carsten/local/python-ogre/python-ogre/generated/ogre_1.4/' ) - mb.register_module_dependency( '/home/carsten/local/python-ogre-ebuild/python-ogre/generated/ogre_1.6.0' ) - + #mb.register_module_dependency( '/home/carsten/local/python-ogre-ebuild/python-ogre/generated/ogre_1.6.4' ) + global_ns = mb.global_ns global_ns.exclude() - + main_ns = global_ns.namespace( MAIN_NAMESPACE ) main_ns.include() - + global_ns.namespace( 'Ogre' ).class_('Vector3').include(already_exposed=True) hand_made_wrappers.apply( mb ) - + mb.BOOST_PYTHON_MAX_ARITY = 25 mb.classes().always_expose_using_scope = True - + set_call_policies( mb.global_ns.namespace ('OpenGate') ) set_call_policies( mb.global_ns.namespace ('Ogre') ) - + for cls in main_ns.classes(): print cls - cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) - + #cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) + mb.calldefs( access_type_matcher_t( 'protected' ) ).exclude() mb.calldefs( access_type_matcher_t( 'private' ) ).exclude() - + #mb.class_( '::std::set < ::std::string >' ).alias = 'stringSet'; - + excludeClass( mb, [ 'deletePtr' - ,'AiManager' - ,'GameStateListener' - ,'GameStateManager' + # ,'AiManager' + ,'Console' + ,'GameState' + ,'GameStateListener' + ,'GameStateManager' ,'Message' ,'MessageBodyBase' ,'MessageBodyDisconnect' @@ -157,54 +158,59 @@ ,'MessageBodyShipMovement' ,'MessageBodyConnectionRefused' ,'OpenALSoundSource' - ,'ServerUserObject_ptr' + ,'OpenALSoundManager' + ,'ShipConfigDialog' + # ,'ServerUserObject_ptr' ] ) - - setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' - ] - , call_policies.reference_existing_object ) - - setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' - ] - , call_policies.return_pointee_value ) - - setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' - ] - , call_policies.copy_const_reference ) - - setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' - ] - , call_policies.return_by_value ) - + + #setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' + #] + #, call_policies.reference_existing_object ) + + #setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' + #] + #, call_policies.return_pointee_value ) + + #setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' + #] + #, call_policies.copy_const_reference ) + + #setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' + #] + #, call_policies.return_by_value ) + + + + #excludeFreeFunctionsByName( mb, ['strReplaceBlankWithUnderscore' #'toStr', 'toInt', 'toFloat', 'toDouble', #'getRowSubstrings', 'getNonEmptyRow', 'getSubstrings' ] ) - + #excludeFreeFunctionsByReturn( mb, [ 'float *', 'float &' ] ) - + #excludeFreeOperatorsByReturn( mb, [ '::std::ostream &', '::std::istream &' ] ) - + #excludeMemberOperators( mb, ['++', '--', '*'] ) - - + + ## setMemberFunctionCallPolicie( mb, [''], call_policies.copy_non_const_reference ) - - ##setMemberFunctionCallPolicieByReturn( mb, ['::Ogre::Vector3' ], + + ##setMemberFunctionCallPolicieByReturn( mb, ['::Ogre::Vector3' ], ##call_policies.return_pointee_value ) - - #setMemberFunctionCallPolicieByReturn( mb, ['::std::string *', 'float *', 'double *'], + + #setMemberFunctionCallPolicieByReturn( mb, ['::std::string *', 'float *', 'double *'], #call_policies.return_pointee_value ) - - #setMemberFunctionCallPolicieByReturn( mb, ['::std::string &', 'double &' ], + + #setMemberFunctionCallPolicieByReturn( mb, ['::std::string &', 'double &' ], #call_policies.return_by_value ) - - + + # exclude all that does not match any predefined callpolicie excludeRest = True - + if excludeRest: mem_funs = mb.calldefs () - + for mem_fun in mem_funs: if mem_fun.call_policies: continue @@ -239,9 +245,9 @@ #mb.write_module( os.path.join( settings.generated_files_dir, settings.module_name + '.cpp') ) if __name__ == '__main__': - + defined_symbols = ['OPENGATE'] - + generate( defined_symbols ) print 'done' Modified: branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate.h 2009-12-17 23:21:18 UTC (rev 1151) +++ branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate.h 2009-12-25 14:57:07 UTC (rev 1162) @@ -9,33 +9,53 @@ namespace CEGUI{ class OgreCEGUIRenderer; } -// namespace OpenGate{ -// class Foo{ -// Ogre::Vector3 vec_; -// public: -// void setVec( Ogre::Vector3 & vec ) { vec_ = vec ;} -// std::vector < double > v() const { -// std::vector < double > t; -// return t; -// } -// std::list < double > s() const { -// std::list < double > t; -// return t; -// } -// }; -// -// class Bar{ -// public: -// std::vector < Foo * > f() const { -// std::vector < Foo * > t; -// return t; -// } -// }; -// } + +namespace OpenGate{ + class Foo{ + Ogre::Vector3 vec_; + Ogre::SceneNode * node_; + public: + + void setNode( Ogre::SceneNode * node ) { node_ = node; } + + Ogre::SceneNode * node() { return node_; } + + void setVec( Ogre::Vector3 & vec ) { vec_ = vec ;} + + Ogre::Vector3 & vec( ) { return vec_; } + + std::vector < double > v() const { + std::vector < double > t; + return t; + } + + std::list < double > s() const { + std::list < double > t; + return t; + } + }; + + class Bar{ + public: + std::vector < Foo * > f() const { + std::vector < Foo * > t; + return t; + } + }; + + class NetworkClient{}; + + class AiManager{}; + + class ClientUserObject{}; +} + #include <OgreOpcode.h> +#include "Opengate.h" + #include "AiCommands.h" -#include "AiManager.h" +//#include "AiManager.h" #include "AiObject.h" #include "Avatar.h" #include "BaseDialog.h" @@ -61,8 +81,6 @@ #include "Moveable.h" #include "OpcodeWrapper.h" #include "OpenALSoundManager.h" -#include "Opengate.h" -#include "Projectile.h" #include "RadarObject.h" #include "ResourceManager.h" #include "Sector.h" @@ -77,26 +95,22 @@ #include "SectorMeshObject.h" #include "SectorMissileObject.h" #include "SectorMovableObject.h" -#include "SectorObject.h" -#include "SectorObjectAvatar.h" -#include "SectorObjectMissile.h" -#include "SectorObjectMoveable.h" -#include "SectorObjectVessel.h" #include "SectorPadObject.h" #include "SectorProjectileObject.h" #include "SectorStationObject.h" #include "SectorStationPadObject.h" #include "SectorVesselObject.h" + #include "ShipConfigDialog.h" #include "UnDockedState.h" #include "Vessel.h" #include "common.h" #include "commonWithOgre.h" -#include "metaserver.h" -#include "networkClient.h" -#include "networkProtocol.h" -#include "networkServer.h" -#include "networkServerUser.h" +//#include "metaserver.h" +//#include "networkClient.h" +// #include "networkProtocol.h" +// #include "networkServer.h" +// #include "networkServerUser.h" namespace OpenGate{ //void foo ( std::vector< char >, std::vector < Ogre::Vector3 > ){} @@ -104,7 +118,15 @@ //First we create a magic namespace to hold all our aliases namespace pyplusplus { namespace aliases { -#include "python_opengate_aliases.h" +// typedef ::std::vector < ::std::string > stdVectorString; +// typedef ::std::vector < OpenGate::Entity * > stdVectorEntity; +// typedef ::std::vector < OpenGate::Triangle > stdVectorTriangle; +// typedef ::std::set < ::std::string > stdSetString; +// typedef ::std::set< ::OpenGate::Entity * > stdSetEntity; +// typedef ::std::set< OpenGate::SectorObject * > stdSetSectorObject; +// typedef ::std::set< OpenGate::Vessel * > stdSetVessel; +// typedef ::std::map< int, ::std::vector< Ogre::Vector3 > > stdMapIntVector3; +// typedef ::std::list< std::deque< OpenGate::Entity * > > stdListEntityDeque; } } // then we exposed everything needed (and more) to ensure GCCXML makes them visible to Py++ @@ -112,7 +134,13 @@ namespace python_opengate{ namespace details{ inline void instantiate(){ using namespace OpenGate; -#include "python_opengate_sizeof.h" +sizeof( size_t * ); +sizeof( uint * ); +// sizeof ( ::OpenGate::Message& ); +// sizeof ( ::OpenGate::MessageBodyBase& ); +// sizeof ( ::OpenGate::OpenALSoundSource* ); +// sizeof ( ::OpenGate::OpenALSoundSource& ); +// sizeof ( ::OpenGate::OpenALSoundSource ); } } } #endif // PYTHON_OPENGATE__H Deleted: branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate_aliases.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate_aliases.h 2009-12-17 23:21:18 UTC (rev 1151) +++ branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate_aliases.h 2009-12-25 14:57:07 UTC (rev 1162) @@ -1,10 +0,0 @@ -typedef ::std::vector < ::std::string > stdVectorString; -typedef ::std::vector < OpenGate::Entity * > stdVectorEntity; -typedef ::std::vector < OpenGate::Triangle > stdVectorTriangle; -typedef ::std::set < ::std::string > stdSetString; -typedef ::std::set< ::OpenGate::Entity * > stdSetEntity; -typedef ::std::set< OpenGate::SectorObject * > stdSetSectorObject; -typedef ::std::set< OpenGate::Vessel * > stdSetVessel; -typedef ::std::map< int, ::std::vector< Ogre::Vector3 > > stdMapIntVector3; -typedef ::std::list< std::deque< OpenGate::Entity * > > stdListEntityDeque; - Deleted: branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate_sizeof.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate_sizeof.h 2009-12-17 23:21:18 UTC (rev 1151) +++ branches/ogEditor/ogEditor/apps/opengate/pyopengate/python_opengate_sizeof.h 2009-12-25 14:57:07 UTC (rev 1162) @@ -1,7 +0,0 @@ -sizeof ( ::OpenGate::Message& ); -sizeof ( ::OpenGate::MessageBodyBase& ); -sizeof ( ::OpenGate::OpenALSoundSource* ); -sizeof ( ::OpenGate::OpenALSoundSource& ); -sizeof ( ::OpenGate::OpenALSoundSource ); - - Added: branches/ogEditor/ogEditor/apps/opengate/pyopengate/tmp/__array_1.pypp.hpp =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/pyopengate/tmp/__array_1.pypp.hpp (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/pyopengate/tmp/__array_1.pypp.hpp 2009-12-25 14:57:07 UTC (rev 1162) @@ -0,0 +1,183 @@ +// This file has been generated by Py++. + +// Copyright 2004-2008 Roman Yakovenko. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef __array_1_pyplusplus_hpp__ +#define __array_1_pyplusplus_hpp__ + +#include "boost/python.hpp" +#include "boost/mpl/if.hpp" +#include "boost/type_traits/is_same.hpp" +#include "boost/type_traits/is_fundamental.hpp" +#include "boost/python/converter/registry.hpp" + +#include <iostream> + +//1 - dimension +namespace pyplusplus{ namespace containers{ namespace static_sized{ + +inline void +raise_on_out_of_range( long unsigned int size, long unsigned int index ){ + if( size <= index ){ + throw std::out_of_range("index out of range"); + } +} + +namespace details{ + +template<class T> +struct is_immutable{ + BOOST_STATIC_CONSTANT( + bool + , value = ( boost::is_same< T, std::string >::value ) + || ( boost::is_same< T, std::wstring >::value ) + || ( boost::is_fundamental< T >::value ) + || ( boost::is_enum< T >::value ) + ); + +}; + +template<class T> +bool is_registered(){ + namespace bpl = boost::python; + bpl::handle<> class_obj( bpl::objects::registered_class_object( bpl::type_id< T >())); + return class_obj.get() ? true : false; +} + +template< class T > +void register_alias( const char* name ){ + namespace bpl = boost::python; + bpl::handle<> class_obj( bpl::objects::registered_class_object( bpl::type_id< T >())); + boost::python::scope().attr( name ) = bpl::object( class_obj ); +} + +}//details + +template< class TItemType, long unsigned int size > +struct const_array_1_t{ + + typedef BOOST_DEDUCED_TYPENAME boost::call_traits<const TItemType>::param_type param_type; + + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + details::is_immutable<TItemType>::value + , TItemType + , param_type + >::type reference_type; + + const_array_1_t( TItemType const * const data ) + : m_data( data ){ + if( !data ){ + throw std::runtime_error( "const_array_1_t: pointer to null has been recieved." ); + } + } + + long unsigned int len() const { + return size; + } + + reference_type item_ref( long unsigned int index ) const{ + raise_on_out_of_range( size, index ); + return m_data[index]; + } + +private: + + TItemType const * m_data; + +}; + +template< class TItemType, long unsigned int size > +struct array_1_t{ + + typedef BOOST_DEDUCED_TYPENAME boost::call_traits<const TItemType>::param_type param_type; + + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + details::is_immutable<TItemType>::value + , TItemType + , param_type + >::type reference_type; + + array_1_t( TItemType * data ) + : m_data( data ){ + if( !data ){ + throw std::runtime_error( "array_1_t: pointer to null has been recieved." ); + } + } + + long unsigned int len() const { + return size; + } + + reference_type item_ref( long unsigned int index ) const{ + raise_on_out_of_range( size, index ); + return m_data[index]; + } + + void + set_item( long unsigned int index, reference_type new_value ){ + raise_on_out_of_range( size, index ); + m_data[index] = new_value; + } + +private: + + TItemType* m_data; + +}; + +template< class TItemType + , long unsigned int size + , typename CallPolicies=boost::python::default_call_policies > +struct register_const_array_1{ + register_const_array_1(const char* name){ + namespace bpl = boost::python; + typedef const_array_1_t< TItemType, size > wrapper_t; + + if( details::is_registered< wrapper_t >() ){ + details::register_alias< wrapper_t >( name ); + } + else{ + bpl::class_< wrapper_t >( name, bpl::no_init ) + .def( "__getitem__" + , &wrapper_t::item_ref + , ( bpl::arg("index") ) + , CallPolicies() ) + .def( "__len__", &wrapper_t::len ); + } + } +}; + +template< class TItemType + , long unsigned int size + , typename CallPolicies=boost::python::default_call_policies > +struct register_array_1{ + register_array_1(const char* name){ + namespace bpl = boost::python; + typedef array_1_t< TItemType, size > wrapper_t; + if( details::is_registered< wrapper_t >() ){ + details::register_alias< wrapper_t >( name ); + } + else{ + bpl::class_< wrapper_t >( name, bpl::no_in... [truncated message content] |
From: <spo...@us...> - 2009-12-23 19:54:23
|
Revision: 1161 http://opengate.svn.sourceforge.net/opengate/?rev=1161&view=rev Author: spom_spom Date: 2009-12-23 19:54:13 +0000 (Wed, 23 Dec 2009) Log Message: ----------- client add some stars Modified Paths: -------------- trunk/data/misc/misc.material trunk/data/misc/misc.particle trunk/data/skybox/skybox.material trunk/src/Sector.cpp trunk/src/SectorEnvironmentObject.cpp trunk/src/SectorEnvironmentObject.h trunk/src/UnDockedState.h Modified: trunk/data/misc/misc.material =================================================================== --- trunk/data/misc/misc.material 2009-12-22 22:02:14 UTC (rev 1160) +++ trunk/data/misc/misc.material 2009-12-23 19:54:13 UTC (rev 1161) @@ -14,4 +14,23 @@ } } } +} + +material OpenGate/Star +{ + technique + { + pass + { + scene_blend add + lighting off + depth_check off + depth_write off + + texture_unit + { + texture textures/flare.png + } + } + } } \ No newline at end of file Modified: trunk/data/misc/misc.particle =================================================================== --- trunk/data/misc/misc.particle 2009-12-22 22:02:14 UTC (rev 1160) +++ trunk/data/misc/misc.particle 2009-12-23 19:54:13 UTC (rev 1161) @@ -1,35 +1,41 @@ particle_system OpenGate/Space/Dust { - material OpenGate/Space/Dust - particle_width 1 - particle_height 1 - cull_each false - quota 25000 - billboard_type point + material OpenGate/Space/Dust + particle_width 1 + particle_height 1 + cull_each true + quota 5000 + //billboard_type oriented_self + //billboard_rotation_type vertex - // Area emitter - emitter Ellipsoid{ - time_to_live 5 - colour 1.0 1.0 1.0 - //colour_range_start 0.0 0.0 0.0 - //colour_range_end 1 1 1 - emission_rate 500 - velocity 0 - width 2000 - height 2000 - depth 2000 + //billboard_type perpendicular_common + //billboard_type perpendicular_self + //common_direction 0 0 -1 + //self_direction 0 0 -1 + //self_up_vector 0 0 1 + + // Area emitter + emitter Ellipsoid{ + + time_to_live 10 + colour 0.0 0.0 0.0 + emission_rate 500 + velocity 0.1 + width 2000 + height 2000 + depth 2000 } - // Fader - //affector ColourFader2 - //{ - // red1 0.4 - // green1 0.4 - // blue1 0.4 - // state_change 2.5 - // red2 -0.4 - // green2 -0.4 - // blue2 -0.4 - // } + // Fader + affector ColourFader2 + { + red1 0.2 + green1 0.2 + blue1 0.2 + state_change 5 + red2 -0.2 + green2 -0.2 + blue2 -0.2 + } +} -} \ No newline at end of file Modified: trunk/data/skybox/skybox.material =================================================================== --- trunk/data/skybox/skybox.material 2009-12-22 22:02:14 UTC (rev 1160) +++ trunk/data/skybox/skybox.material 2009-12-23 19:54:13 UTC (rev 1161) @@ -6,7 +6,7 @@ { lighting off depth_write off -// scene_blend add + scene_blend add texture_unit { @@ -46,7 +46,12 @@ pass { lighting off - depth_write off + depth_check off + depth_write off + //scene_blend dest_colour one_minus_src_colour + //scene_blend alpha_blend //same like scene_blend src_alpha one_minus_src_alpha + scene_blend add + //scene_blend colour_blend texture_unit { Modified: trunk/src/Sector.cpp =================================================================== --- trunk/src/Sector.cpp 2009-12-22 22:02:14 UTC (rev 1160) +++ trunk/src/Sector.cpp 2009-12-23 19:54:13 UTC (rev 1161) @@ -419,8 +419,11 @@ //planet_->lighting( true ); sectorEnvironment_.insert( planet ); - SectorSpaceDustObject *spaceDust = new SectorSpaceDustObject( this ); + SectorSpaceDustObject *spaceDust = new SectorSpaceDustObject( this, listener()->mainCameraNode() ); sectorEnvironment_.insert( spaceDust ); + + SectorStarfieldObject *starfield = new SectorStarfieldObject( this ); + sectorEnvironment_.insert( starfield ); return; } Modified: trunk/src/SectorEnvironmentObject.cpp =================================================================== --- trunk/src/SectorEnvironmentObject.cpp 2009-12-22 22:02:14 UTC (rev 1160) +++ trunk/src/SectorEnvironmentObject.cpp 2009-12-23 19:54:13 UTC (rev 1161) @@ -24,10 +24,13 @@ #include "Sector.h" #include "SectorAvatarObject.h" +#include <OgreBillboard.h> +#include <OgreBillboardSet.h> #include <OgreEntity.h> #include <OgreLight.h> #include <OgreManualObject.h> #include <OgreMeshManager.h> +#include <OgreParticle.h> #include <OgreParticleEmitter.h> #include <OgreParticleSystem.h> #include <OgreSceneManager.h> @@ -291,10 +294,46 @@ mainNode_->attachObject( entity_ ); } +SectorStarfieldObject::SectorStarfieldObject( Sector * sector, Ogre::SceneNode * parentNode ) + : SectorEnvironmentObject( "Starfield", sector, parentNode ){ + bs_ = sector_->sceneManager()->createBillboardSet( "Starfield" ); + bs_->setMaterialName( "OpenGate/Star" ); + bs_->setRenderQueueGroup( Ogre::RENDER_QUEUE_BACKGROUND ); + //bs_->setRenderQueueGroup( Ogre::RENDER_QUEUE_SKIES_EARLY ); + Ogre::Billboard *bb; + + for ( int i = 0; i < 25000; i ++ ){ + bb = bs_->createBillboard( Ogre::Vector3::ZERO, Ogre::ColourValue( 1.0f, 1.0f, 1.0f) ); + double dim = Ogre::Math::RangeRandom( 50.0, 100.0 ); + bb->setDimensions( dim, dim ); + double r = 10000.0; + double d = Ogre::Math::RangeRandom( 0.0, 2.0 * Ogre::Math::PI ); + double p = Ogre::Math::RangeRandom( 0.0, 2.0 * Ogre::Math::PI ); + double x = r * Ogre::Math::Cos( d ) * Ogre::Math::Cos( p ); + double y = r * Ogre::Math::Cos( d ) * Ogre::Math::Sin( p ); + double z = r * Ogre::Math::Sin( d ); + bb->setPosition( x, y, z ); + + } + mainNode_->attachObject( bs_ ); + +} + +SectorStarfieldObject::~SectorStarfieldObject(){ + mainNode_->detachObject( bs_ ); + mainNode_->getCreator()->destroyBillboardSet( bs_ ); +} + +bool SectorStarfieldObject::update( Ogre::Real elapsedTime ){ + mainNode_->setPosition( sector_->avatarObject()->mainNode()->getPosition() ); + return true; +} + + + SectorSpaceDustObject::SectorSpaceDustObject( Sector * sector, Ogre::SceneNode * parentNode ) : SectorEnvironmentObject( "SpaceDust", sector, parentNode ){ ps_ = sector_->sceneManager()->createParticleSystem("Dust PS", "OpenGate/Space/Dust"); - mainNode_->createChildSceneNode( "DustParticles" ); mainNode_->attachObject( ps_ ); Ogre::ParticleEmitter *emitter = ps_->getEmitter( 0 ); liveRange_ = toDouble( emitter->getParameter( "width") ); @@ -306,57 +345,28 @@ } bool SectorSpaceDustObject::update( Ogre::Real elapsedTime ){ - //ps_->_update( elapsedTime ); - mainNode_->setPosition( sector_->avatarObject()->mainNode()->getPosition() ); - sector_->avatarObject()->speedRate(); - Ogre::ParticleEmitter *emitter = ps_->getEmitter( 0 ); - double liveTime = liveRange_ / max( 10.0, sector_->avatarObject()->speedRate() * sector_->avatarObject()->speed() ) * 2.0; - std::cout << liveTime << " " << liveRange_ << " " << ps_->getParticleQuota() / liveTime << std::endl; - emitter->setTimeToLive( liveTime ); - emitter->setEmissionRate( ps_->getParticleQuota() / liveTime ); + Ogre::ParticleIterator pit = ps_->_getIterator(); + //particle->setDimensions( max( particle->getOwnWidth(), 50.0f ), particle->getOwnHeight() );//* sector_->avatarObject()->speedRate() ); + //ps_->setParameter("particle_height", toStr( max( 1.0f, 15.0f * sector_->avatarObject()->speedRate() ) ) ); + //ps_->setParameter("particle_height","1"); +// ps_->setParameter("self_direction", toStr( sector_->avatarObject()->velocity().x +0.01) + " " + +// toStr( sector_->avatarObject()->velocity().y +0.01) + " " + +// toStr( sector_->avatarObject()->velocity().z + 0.01) ); -// const float maxDist = 250.0; -// const float mirrorDist = maxDist*0.99; -// const float dimFactor = 0.8*0.005*0.005; -// const float maxDist2 = maxDist*maxDist; -// Camera* cam = mCamera->getCamera(); -// const Vector3& camPos = cam->getWorldPosition(); -// -// const float twiceMaxDist = 2 * maxDist; -// -// ParticleIterator pit = mParticleSystem->_getIterator(); -// -// while (!pit.end()) -// { -// Particle* particle = pit.getNext(); -// Vector3& pos = particle->position; -// particle->timeToLive = 999999.0f; -// -// // position particles near camera -// // (keep moving them toward camera until within range) -// while (pos.x - camPos.x > maxDist) -// pos.x -= twiceMaxDist; -// while (pos.x - camPos.x < -maxDist) -// pos.x += twiceMaxDist; -// while (pos.y - camPos.y > maxDist) -// pos.y -= twiceMaxDist; -// while (pos.y - camPos.y < -maxDist) -// pos.y += twiceMaxDist; -// while (pos.z - camPos.z > maxDist) -// pos.z -= twiceMaxDist; -// while (pos.z - camPos.z < -maxDist) -// pos.z += twiceMaxDist; -// -// Vector3 pDir = pos-camPos; -// float dist = pDir.squaredLength(); -// float dim = dist*dimFactor; -// particle->setDimensions(dim, dim); -// -// } -// -// return true; -// } +// ps_->setParameter("common_direction", toStr( sector_->avatarObject()->velocity().x ) + " " + +// toStr( sector_->avatarObject()->velocity().y ) + " " + +// toStr( sector_->avatarObject()->velocity().z ) ); + while ( !pit.end() ) { + Ogre::Particle* particle = pit.getNext(); + + Ogre::Vector3 pDir( ( sector_->avatarObject()->mainNode()->getPosition() - particle->position ) ); + if ( pDir.squaredLength() > ( liveRange_ * liveRange_ ) / 4.0 ){ + particle->position = sector_->avatarObject()->mainNode()->getPosition() + pDir; + //particle->rotation = 1.0; + } + + } return true; } Modified: trunk/src/SectorEnvironmentObject.h =================================================================== --- trunk/src/SectorEnvironmentObject.h 2009-12-22 22:02:14 UTC (rev 1160) +++ trunk/src/SectorEnvironmentObject.h 2009-12-23 19:54:13 UTC (rev 1161) @@ -90,9 +90,18 @@ double liveRange_; }; +class SectorStarfieldObject : public SectorEnvironmentObject{ +public: + SectorStarfieldObject( Sector * sector, Ogre::SceneNode * parentNode = NULL ); -// class SectorStarfieldObject : public SectorEnvironmentObject{ -// }; + ~SectorStarfieldObject( ); + + virtual bool update( Ogre::Real elapsedTime ); + +protected: + Ogre::BillboardSet * bs_; +}; + // class SectorSpaceDecorationObject : public SectorEnvironmentObject{ // }; Modified: trunk/src/UnDockedState.h =================================================================== --- trunk/src/UnDockedState.h 2009-12-22 22:02:14 UTC (rev 1160) +++ trunk/src/UnDockedState.h 2009-12-23 19:54:13 UTC (rev 1161) @@ -74,12 +74,14 @@ bool minimiseConsole( ); inline RadarObject * radar() { return radar_; } - + inline Sector * sector( ) { return sector_; } void showHud(); void hideHud(); + Ogre::SceneNode * mainCameraNode() { return mainCameraNode_; } + bool keyActionDoNothing( bool pressed = true ) { return false; } bool keyActionSwitchMinMaxConsole( bool pressed = true ); @@ -115,7 +117,7 @@ bool keyActionAvatarBreakPressed( bool pressed = true ); bool keyActionAvatarAfterburnerPressed( bool pressed = true ); - /*! Actions for development, will removed later. */ + /*! Actions for development, will removed later. */ bool keyActionTogglePolygonMode_DEV( bool pressed = true ); bool keyActionToggleFiltering_DEV( bool pressed = true ); @@ -124,10 +126,10 @@ bool keyActionIncreaseShaderScheme_DEV( bool pressed = true ); bool keyActionDecreaseShaderScheme_DEV( bool pressed = true ); - + bool keyActionIncreaseTimeZoom_DEV( bool pressed = true ); bool keyActionDecreaseTimeZoom_DEV( bool pressed = true ); - + bool keyActionAvatarSwitchDuelistPilot_DEV( bool pressed = true ); bool keyActionAvatarSwitchDuelistTarget_DEV( bool pressed = true ); bool keyActionAvatarChangeDockedState_DEV( bool pressed = true ); @@ -150,21 +152,21 @@ void setScheme_(); void toggleNextCamera_( int mode = -1 ); void updateCamera_( Ogre::Real elapsedTime ); - + Ogre::Root * root_; Ogre::RenderWindow * window_; Ogre::SceneManager * sceneMgr_; - + Hud * hud_; - + Ogre::SceneNode * mainCameraNode_; Ogre::Camera * mainCamera_; Ogre::Camera * secondCamera_; Sector * sector_; NetworkClient * network_; RadarObject * radar_; - + Ogre::Vector2 flightCursorPos_; CEGUI::Window * flightCursor_; Ogre::Real flightCursorHalfWidth_; @@ -174,7 +176,7 @@ double timeSinceLastSectorUpdate_; double timeSinceLastHudUpdate_; - + int cameraMode_; int cameraViewKey_; Ogre::Real cameraZoom_; @@ -197,10 +199,10 @@ int ambientLight_; int schemeIdx_; double timeZoom_; - + // Ogre::TextureFilterOptions filtering_; int aniso_; - + OpenALSoundSource * soundBackround_; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-22 22:02:21
|
Revision: 1160 http://opengate.svn.sourceforge.net/opengate/?rev=1160&view=rev Author: spom_spom Date: 2009-12-22 22:02:14 +0000 (Tue, 22 Dec 2009) Log Message: ----------- client: add experimental space dust (not yet perfect) Modified Paths: -------------- trunk/data/misc/misc.particle trunk/src/GunObject.cpp trunk/src/Sector.cpp trunk/src/SectorEnvironmentObject.cpp trunk/src/SectorEnvironmentObject.h trunk/src/SectorMovableObject.cpp trunk/src/SectorVesselObject.cpp Modified: trunk/data/misc/misc.particle =================================================================== --- trunk/data/misc/misc.particle 2009-12-21 22:41:44 UTC (rev 1159) +++ trunk/data/misc/misc.particle 2009-12-22 22:02:14 UTC (rev 1160) @@ -1,18 +1,35 @@ -OpenGate/Space/Dust +particle_system OpenGate/Space/Dust { material OpenGate/Space/Dust particle_width 1 particle_height 1 - cull_each true - quota 500 + cull_each false + quota 25000 billboard_type point // Area emitter emitter Ellipsoid{ - emission_rate 50000 + time_to_live 5 + colour 1.0 1.0 1.0 + //colour_range_start 0.0 0.0 0.0 + //colour_range_end 1 1 1 + emission_rate 500 velocity 0 - width 500 - height 500 - depth 500 + width 2000 + height 2000 + depth 2000 } + // Fader + + //affector ColourFader2 + //{ + // red1 0.4 + // green1 0.4 + // blue1 0.4 + // state_change 2.5 + // red2 -0.4 + // green2 -0.4 + // blue2 -0.4 + // } + } \ No newline at end of file Modified: trunk/src/GunObject.cpp =================================================================== --- trunk/src/GunObject.cpp 2009-12-21 22:41:44 UTC (rev 1159) +++ trunk/src/GunObject.cpp 2009-12-22 22:02:14 UTC (rev 1160) @@ -34,7 +34,7 @@ namespace OpenGate{ -GunObject::GunObject( Gun * gunBluePrint ) +GunObject::GunObject( Gun * gunBluePrint ) : gunBluePrint_( gunBluePrint ), parent_( NULL ), mountPoint_( NULL ), gunSound_( NULL ) { delayTime_ = 0; } @@ -46,9 +46,9 @@ void GunObject::mount( SectorVesselObject * parent, Ogre::SceneNode * mountPoint ){ parent_ = parent; mountPoint_ = mountPoint; - gunSound_ = OpenALSoundManager::getSingleton().createSoundSourceFromRessource( "sounds/defaultLaser", + gunSound_ = OpenALSoundManager::getSingleton().createSoundSourceFromRessource( "sounds/defaultLaser", mountPoint->getName() + "/Sound" ); - + if ( gunSound_ ) gunSound_->setRolloff( 0.04 ); } @@ -56,10 +56,10 @@ delayTime_ -= elapsedTime; } -const Ogre::Vector3 & GunObject::mountPosition() const { - return mountPoint_->_getDerivedPosition(); +const Ogre::Vector3 & GunObject::mountPosition() const { + return mountPoint_->_getDerivedPosition(); } - + bool GunObject::fire( Uint32 & capacity ){ if ( delayTime_ < 0 ){ if ( capacity > gunBluePrint_->powerConsumption() ){ @@ -76,57 +76,56 @@ } return false; } - + EngineObject::EngineObject( Engine * engineBluePrint, const std::string & name, Ogre::SceneNode * mountNode, const Ogre::Vector3 & position ) : engineBluePrint_( engineBluePrint ), name_( name ), mountNode_( mountNode ){ - + thrustRate_ = 0.0; thrusterParticles_ = NULL; - + mainNode_ = mountNode_->createChildSceneNode( name_ + "_EngineMountPoint" ); mainNode_->setPosition( position ); - + thrusterParticles_ = mountNode_->getCreator()->createParticleSystem( mainNode_->getName() + "/Thruster" ); thrusterParticles_->setMaterialName( "Examples/Flare" ); thrusterParticles_->setDefaultDimensions( 2, 1 ); - + pEmit_ = thrusterParticles_->addEmitter( "Point" ); // pEmit->setDirection( mainNode_->getOrientation().zAxis() ); // pEmit->setPosition( ( mainNodeEntityRot_->getOrientation() * engineMountPoints[ i ] ) * mainNodeEntityScale_->getScale() ); pEmit_->setColour( Ogre::ColourValue::Blue, Ogre::ColourValue::Green ); - + mainNode_->attachObject( thrusterParticles_ ); - } - + EngineObject::~EngineObject(){ - + if ( thrusterParticles_ ){ mainNode_->detachObject( thrusterParticles_ ); mainNode_->getCreator()->destroyParticleSystem( thrusterParticles_ ); mountNode_->removeAndDestroyChild( mainNode_->getName() ); } } - + // void EngineObject::mount( SectorMovableObject * parent, Ogre::SceneNode * mountPoint ){ // parent_ = parent; // mountPoint_ = mountPoint; // thrusterParticles_ = parent->sector()->sceneManager()->createParticleSystem( mountPoint->getName() + "/Thruster" ); // thrusterParticles_->setMaterialName( "Examples/Flare" ); // thrusterParticles_->setDefaultDimensions( 2, 1 ); -// +// // pEmit_ = thrusterParticles_->addEmitter( "Point" ); // // pEmit->setDirection( mainNode_->getOrientation().zAxis() ); // // pEmit->setPosition( ( mainNodeEntityRot_->getOrientation() * engineMountPoints[ i ] ) * mainNodeEntityScale_->getScale() ); // pEmit_->setColour( Ogre::ColourValue::Blue, Ogre::ColourValue::Green ); -// +// // mountPoint->attachObject( thrusterParticles_ ); // } void EngineObject::setThrustRate( double thrustRate ){ thrustRate_ = thrustRate; - + if ( thrusterParticles_ ){ pEmit_->setTimeToLive( thrustRate_ / 3000.0 * 100.0 ); pEmit_->setEmissionRate( thrustRate_ * 10.0 * 100.0 ); @@ -139,6 +138,6 @@ powerLine -= engineIn; return (Uint32)rint( engineBluePrint_->efficiency() * engineIn ); } - + } // namespace OpenGate Modified: trunk/src/Sector.cpp =================================================================== --- trunk/src/Sector.cpp 2009-12-21 22:41:44 UTC (rev 1159) +++ trunk/src/Sector.cpp 2009-12-22 22:02:14 UTC (rev 1160) @@ -19,9 +19,6 @@ ***************************************************************************/ #include "Sector.h" - -#ifdef NEWSECTOR - #include "commonWithOgre.h" #include "Avatar.h" @@ -53,7 +50,7 @@ #include <OgreSubEntity.h> namespace OpenGate{ - + Sector::Sector( Ogre::SceneManager * sceneMgr, NetworkClient * network ) : sceneMgr_( sceneMgr ), network_( network ) { @@ -65,7 +62,7 @@ childIDCounter_ = 0; timeSinceLastNetworkUpdate_ = 0.0; timeSinceLastStatusUpdate_ = 0.0; - + ecliptic_ = new SectorEclipticObject( this ); sectorEnvironment_.insert( ecliptic_ ); showEcliptic( false ); @@ -78,7 +75,7 @@ sendVesselDeRegister( avatarObject_ ); avatar_->setRegistered( false ); } - + for_each( sectorEnvironment_.begin(), sectorEnvironment_.end(), deletePtr() ); for_each( sectorCollObjects_.begin(), sectorCollObjects_.end(), deletePtr() ); for_each( sectorMeshObjects_.begin(), sectorMeshObjects_.end(), deletePtr() ); @@ -86,38 +83,38 @@ for ( std::map< std::string, std::deque< SectorCollisionObject * > >::iterator it = objectHeap_.begin(), itmax = objectHeap_.end(); it != itmax; it ++ ){ for_each( (*it).second.begin(), (*it).second.end(), deletePtr() ); } - + if ( koordAxisNode_ ) { koordAxisNode_->detachObject( koordAxisMO_ ); sceneMgr_->destroyManualObject( koordAxisMO_->getName() ); sceneMgr_->getRootSceneNode()->removeAndDestroyChild( koordAxisNode_->getName() ); koordAxisNode_ = NULL; - } + } } bool Sector::update( Ogre::Real elapsedTime ){ if ( ResourceManager::getSingleton().collisionManager ){ ResourceManager::getSingleton().collisionManager->update( elapsedTime ); } - + for ( std::set< SectorEnvironmentObject * >::iterator it = sectorEnvironment_.begin(); it != sectorEnvironment_.end(); it++ ){ (*it)->update( elapsedTime ); } for ( std::set< SectorCollisionObject * >::iterator it = sectorCollObjects_.begin(); it != sectorCollObjects_.end(); ){ - if ( !(*it)->update( elapsedTime ) ) { + if ( !(*it)->update( elapsedTime ) ) { destructCollObject_( (*it++) ); } else ++it; } for ( std::set< SectorMeshObject * >::iterator it = sectorMeshObjects_.begin(); it != sectorMeshObjects_.end(); ){ - if ( !(*it)->update( elapsedTime ) ) { + if ( !(*it)->update( elapsedTime ) ) { destructMeshObject_( (*it++) ); } else ++it; } - + //** send movement data, max 10 net-updates/second timeSinceLastNetworkUpdate_ += elapsedTime; timeSinceLastStatusUpdate_ += elapsedTime; - + if ( timeSinceLastNetworkUpdate_ > 0.1 ){ sendAllVesselMovements( ); timeSinceLastNetworkUpdate_ = 0.0; @@ -144,7 +141,7 @@ } } } - + void Sector::destructMeshObject_( SectorMeshObject * obj ){ if ( obj ){ log_->debug( "Sector::destruct_ object: " + obj->name() + " " + toStr( obj->rtti() ) ); @@ -173,7 +170,7 @@ } } } - + void Sector::insertCollObject_( SectorCollisionObject * obj ){ sectorCollObjects_.insert( obj ); obj->activate(); @@ -183,7 +180,7 @@ obj->deactivate(); sectorCollObjects_.erase( obj ); } - + void Sector::insertMeshObject_( SectorMeshObject * obj ){ std::cout << "Sector::insertMeshObject_( SectorMeshObject * obj )" << obj->name() << std::endl; sectorMeshObjects_.insert( obj ); @@ -194,13 +191,13 @@ } } } - + void Sector::removeMeshObject_( SectorMeshObject * obj ){ if ( listener_ ) { if ( listener_->radar() ){ listener_->radar()->delObject( obj ); } - } + } obj->deactivate(); sectorMeshObjects_.erase( obj ); } @@ -235,7 +232,7 @@ log_->info( std::string( "Sector::createAvatarObject: " ) + avatar->name() ); avatarObject_ = new SectorAvatarObject( avatar->name(), this, avatar->vessel() ); avatarObject_->reset(); - + bool hasStation = false; if ( !sectorStations_.empty() ){ SectorStationObject *station = dynamic_cast< SectorStationObject* >( *sectorStations_.begin() ); @@ -256,13 +253,13 @@ avatarObject_->setVelocity( Ogre::Vector3( 0.0, 0.0, 0.0 ) ); } insertMeshObject_( avatarObject_ ); - + sendVesselRegister( avatarObject_ ); avatar_->setRegistered( true ); - + return avatarObject_; } - + SectorVesselObject * Sector::createVesselObject( Vessel * vessel ){ SectorVesselObject * obj; if ( objectHeap_[ vessel->name() ].empty() ){ @@ -278,10 +275,10 @@ insertMeshObject_( obj ); return obj; } - + SectorMissileObject * Sector::createMissileObject( Missile * missile ){ SectorMissileObject * obj; - + if ( objectHeap_[ missile->name() ].empty() ){ obj = new SectorMissileObject( missile->name() + "_" + toStr( childIDCounter_ ), this, missile ); childIDCounter_++; @@ -295,11 +292,11 @@ insertMeshObject_( obj ); return obj; } - + void Sector::createExplosion( SectorMeshObject * object ){ SectorExplosionObject * obj; std::string heapName( "Explosion" ); - + if ( objectHeap_[ heapName ].empty() ){ obj = new SectorExplosionObject( heapName + "_" + toStr( childIDCounter_ ), this ); childIDCounter_++; @@ -315,11 +312,11 @@ SectorProjectileObject * Sector::createProjectile( GunObject * obj, int shots ){ SectorProjectileObject * ammo = new SectorProjectileObject( obj->parent()->name() + "Ammo_" + toStr( shots ), this, obj ); insertCollObject_( ammo ); - + if ( obj->parent() == avatarObject_ ){ sendProjectile( ammo ); } - + return ammo; } @@ -362,13 +359,13 @@ return; } readXMLAttribute< std::string >( pElem, "name_en name", this, &OpenGate::Sector::setName, false ); - + pElem = hRoot.ChildElement( "environment", 0 ).Element(); if ( pElem ){ readXMLAttribute< std::string >( pElem, "skybox", this, &OpenGate::Sector::setSkyBox, false ); readXMLColourElement( pElem, "ambient", sceneMgr_, &Ogre::SceneManager::setAmbientLight, false ); - } - + } + pElem = hRoot.ChildElement( "station", 0 ).Element(); if ( pElem ){ std::string name; readXMLAttribute < std::string >( pElem, "name", name ); @@ -378,7 +375,7 @@ if ( pos != Ogre::Vector3::ZERO ) obj->mainNode()->setPosition( pos ); if ( rot != Ogre::Quaternion::ZERO ) obj->rotNode()->setOrientation( rot ); } - + pElem = hRoot.ChildElement( "beacon", 0 ).Element(); if ( pElem ){ Ogre::Vector3 pos( readXMLVec3Element( pElem, "position" ) ); @@ -405,7 +402,7 @@ if ( scale != Ogre::Vector3::ZERO ) obj->scaleNode()->scale( scale ); if ( rot != Ogre::Quaternion::ZERO ) obj->rotNode()->setOrientation( rot ); int nSubEnt = 0; readXMLAttribute < int >( pElemChild, "numSubEntities", nSubEnt ); - + for ( int i = 0; i < nSubEnt; i ++ ){ std::string matName; readXMLAttribute < std::string >( pElemChild, "material-"+toStr( i ), matName ); obj->entity()->getSubEntity( i )->setMaterialName( matName ); @@ -415,13 +412,15 @@ std::cerr << "no entity found for sectorobject: " << name << std::endl; } } //! for all sectorobject - + //! create Planet SectorPlanetObject *planet = new SectorPlanetObject( "planet", this ); - //, Ogre::Vector3( 0000.0, 0000.0, 50000 ), 15000.0f, 64 ); + //, Ogre::Vector3( 0000.0, 0000.0, 50000 ), 15000.0f, 64 ); //planet_->lighting( true ); sectorEnvironment_.insert( planet ); - + + SectorSpaceDustObject *spaceDust = new SectorSpaceDustObject( this ); + sectorEnvironment_.insert( spaceDust ); return; } @@ -436,31 +435,31 @@ void Sector::flipShowEcliptic( ) { if ( ecliptic_ ) ecliptic_->mainNode()->flipVisibility( ); } - + void Sector::createKoordAxis( ){ koordAxisNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode( "axisnode" ); koordAxisMO_ = sceneMgr_->createManualObject( koordAxisNode_->getName()+ "/manualObject" ); Ogre::Real length = 20; - + koordAxisMO_->begin( "Shader/SingleColor", Ogre::RenderOperation::OT_LINE_LIST); koordAxisMO_->getSection( 0 )->setCustomParameter( 0, Ogre::Vector4( 1.0, 0.0, 0.0, 1.0 ) ); koordAxisMO_->position( 0.0, 0.0, 0.0 ); koordAxisMO_->position( 1.0, 0.0, 0.0 ); koordAxisMO_->position( 0.0, 0.0, 0.0 ); koordAxisMO_->end(); - + koordAxisMO_->begin( "Shader/SingleColor", Ogre::RenderOperation::OT_LINE_LIST); koordAxisMO_->getSection( 1 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 1.0, 0.0, 1.0 ) ); koordAxisMO_->position( 0.0, 1.0, 0.0 ); koordAxisMO_->position( 0.0, 0.0, 0.0 ); koordAxisMO_->end(); - + koordAxisMO_->begin( "Shader/SingleColor", Ogre::RenderOperation::OT_LINE_LIST); koordAxisMO_->getSection( 2 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 0.0, 1.0, 1.0 ) ); koordAxisMO_->position( 0.0, 0.0, 1.0 ); koordAxisMO_->position( 0.0, 0.0, 0.0 ); koordAxisMO_->end(); - + koordAxisMO_->begin( "BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_LIST); koordAxisMO_->position( -1.0, 0.0, 0.0 ); koordAxisMO_->position( 0.0, 0.0, 0.0 ); @@ -505,7 +504,7 @@ void Sector::receiveVesselRegister( const MessageBodyShipRegister & msg ){ log_->info( std::string( "Receive vessel register: " ) + toStr( msg.senderID() ) + " id:" + toStr( msg.vesselID() ) ) ; - + ClientUserObject * user( network_->user( msg.senderID() ) ); if ( user ){ SectorMovableObject * obj; @@ -513,7 +512,7 @@ log_->debug( "Sector::createMovableObject new " + obj->name() ); insertMeshObject_( obj ); user->setSectorObject( obj ); - + obj->mainNode()->setPosition( toOgreVec( msg.position() ) ); obj->setMass( msg.mass() ); @@ -523,9 +522,9 @@ } else { log_->fatal( std::string( " no user for id: " ) + toStr( msg.senderID() ) ) ; } - + sendAllVesselInfos( ); - + // if ( !movableObjects_.count( createGlobalID( msg.senderID(), msg.childID() ) ) ){ // if ( msg.childID() == 0 ){ // log_->info( "Create player object " + msg.name()+ " " + toStr( msg.senderID() ) + " VesselID: " + toStr( msg.vesselID() ) ); @@ -537,23 +536,23 @@ // obj->setMaxThrust( msg.maxThrust() ); // obj->setMaxSpeed( std::sqrt( msg.maxThrust() / obj->movable()->dragFactor() ) ); // std::cout << msg << std::endl; -// +// // } else { // log_->info( "Create ai object " + msg.name()+ " " + toStr( msg.senderID() ) + " " + // toStr( (int)msg.childID() ) + " " + toStr( msg.vesselID() ) ); -// +// // // SectorObjectMoveableAi * obj = createAiMoveableObject( msg.name(), msg.senderID(), msg.childID(), // // *VesselManager::getSingleton().vessel( msg.vesselID() ) ); // // obj->mainNode()->setPosition( toOgreVec( msg.position() ) ); -// // +// // // // if ( movableObjects_.count( createGlobalID( msg.senderID(), 0 ) ) ){ // // log_->info( "ai object target: " + movableObjects_[ createGlobalID( msg.senderID(), 0 ) ]->name() ); // // obj->setTarget( movableObjects_[ createGlobalID( msg.senderID(), 0 ) ] ); // // } // } -// +// // sendAllVesselInfos( ); -// +// // } else { // log_->warn( std::string( "Registering: object allready exist: " ) + // movableObjects_[ createGlobalID( msg.senderID(), msg.childID() ) ]->name() ); @@ -571,7 +570,7 @@ void Sector::receiveVesselDeRegister( const MessageBodyShipDeRegister & msg ){ log_->info( std::string( "Receive vessel deregister: " ) + toStr( msg.senderID() ) ) ; - + ClientUserObject * user( network_->user( msg.senderID() ) ); if ( user ){ SectorMovableObject * obj = user->sectorObject(); @@ -593,7 +592,7 @@ void Sector::receiveVesselDied( const MessageBodyShipDied & msg ){ log_->info( std::string( "Receive vessel died: " ) + toStr( msg.senderID() ) ) ; - + ClientUserObject * user( network_->user( msg.senderID() ) ); if ( user ){ SectorMovableObject * obj = user->sectorObject(); @@ -607,7 +606,7 @@ log_->fatal( std::string( " no user for id: " ) + toStr( msg.senderID() ) ) ; } } - + void Sector::sendVesselMovement( SectorVesselObject * obj ){ if ( obj ){ MessageBodyShipMovement msg( 0, @@ -671,7 +670,7 @@ void Sector::receiveVesselStatus( const MessageBodyShipStatus & msg ){ log_->info( std::string( "Receive vessel status: " ) + toStr( msg.senderID() ) ) ; - + ClientUserObject * user( network_->user( msg.senderID() ) ); if ( user ){ SectorMovableObject * obj = user->sectorObject(); @@ -686,9 +685,9 @@ } void Sector::sendProjectile( SectorProjectileObject * ammo ){ - MessageBodyShipProjectileFired msg( 0, + MessageBodyShipProjectileFired msg( 0, ammo->gunObject()->parent()->shotsFired(), - Ogre::Vector3( ammo->mainNode()->getPosition() ).ptr(), + Ogre::Vector3( ammo->mainNode()->getPosition() ).ptr(), ammo->velocity().ptr(), ammo->gunObject()->gunBluePrint()->id(), 0, 0.0 ); network_->send( msg ); @@ -730,22 +729,22 @@ log_->fatal( std::string( " target is not the avatar: " ) + toStr( msg.targetID() ) ); } // if ( msg.senderID() != network_->userID() ){ -// +// // std::map< long, SectorObjectMovable * >::iterator it; -// +// // if ( ( it = movableObjects_.find( createGlobalID( msg.targetID(), msg.targetChildID() ) ) ) != movableObjects_.end() ){ // // log_->cout( "ReceiveVesselAmmoHit for " + network_->userName( msg.targetID() ) + " " + toStr( msg.damage() ) ); -// +// // it->second->hitByAmmo( msg.damage() ); // } else { // log_->fatal( std::string( "Requested non existant object for VesselAmmoHit " ) + -// " shooter: " + network_->userName( msg.senderID() ) + -// " shooter id: " + toStr( msg.senderID() ) + +// " shooter: " + network_->userName( msg.senderID() ) + +// " shooter id: " + toStr( msg.senderID() ) + // " gloabel id: " + toStr( createGlobalID( msg.targetID(), msg.targetChildID() ) ) + // " victim: " + network_->userName( msg.targetID() ) + // " child: " + toStr( (int)msg.targetChildID() ) + // " damage: " + toStr( msg.damage() ) + " this should not happen." ) ; -// +// // std::cerr << "Available objects: " << std::endl; // for ( std::map< long, SectorObjectMovable * >::iterator i = movableObjects_.begin(); i != movableObjects_.end(); i++){ // std::cerr << "\t" << i->first << " " << i->second->name() << " " << std::endl; @@ -754,875 +753,4 @@ // } } - - - - - - - - - - - - - - - - - - - - - - -#else - -#include "Sector.h" -#include "commonWithOgre.h" - -#include "AiObject.h" -#include "Avatar.h" -#include "EntityManager.h" -#include "Equipment.h" -#include "Missile.h" -#include "networkClient.h" -#include "OpcodeWrapper.h" -#include "Planet.h" -#include "Projectile.h" -#include "ResourceManager.h" -#include "SectorObjectAvatar.h" -#include "SectorObjectMissile.h" -#include "SectorObjectMoveable.h" -#include "SectorObjectVessel.h" -#include "Station.h" -#include "UnDockedState.h" -#include "Vessel.h" - -#include "tinyxml/tinyxml.h" - -#include <OgreEntity.h> -#include <OgreManualObject.h> -#include <OgreMaterialManager.h> -#include <OgreMeshManager.h> -#include <OgreOverlayContainer.h> -#include <OgreOverlayManager.h> -#include <OgreRenderSystem.h> -#include <OgreRenderSystemCapabilities.h> -#include <OgreRoot.h> -#include <OgreSceneNode.h> -#include <OgreSubEntity.h> - - -namespace OpenGate{ - - // class StarField : public Ogre::SimpleRenderable { -// public: -// StarField(){ -// setMaterial("BaseWhiteNoLighting"); - - -// begin(); -// end(); -// } -// ~StarField(){ -// delete mRenderOp.vertexData; mRenderOp.vertexData = NULL; -// // delete mRenderOp.indexData; mRenderOp.indexData = NULL; -// } -// begin(){ -// if ( !mpRenderOp.vertexData ) mpRenderOp.vertexData = new VertexData(); -// // if ( !mpRenderOp.indexData && mpRenderOp.useIndexes ) mpRenderOp.indexData = new IndexData(); -// } -// end(){} -// protectd: - -// }; - -Sector::Sector( Ogre::SceneManager * sceneMgr, NetworkClient * network ) - : sceneMgr_( sceneMgr ), network_( network ) { - - radar_ = true; - planet_ = NULL; - koordAxisNode_ = NULL; - starsNode_ = NULL; - avatar_ = NULL; - station_ = NULL; - name_ = "unknown"; - childIDCounter_ = 0; - log_ = LogManager::getSingletonPtr(); - - avatarDeathSequenceTime_ = 0.0; - - //*** starfield test 1 -// Ogre::ManualObject* myManualObject = sceneMgr_->createManualObject("manual1"); -// Ogre::SceneNode* myManualObjectNode = sceneMgr_->getRootSceneNode()->createChildSceneNode("manual1_node"); - -// Ogre::MaterialPtr myManualObjectMaterial = Ogre::MaterialManager::getSingleton().create("manual1Material","debugger"); -// myManualObjectMaterial->setReceiveShadows( false ); -// myManualObjectMaterial->getTechnique(0)->setLightingEnabled( true ); -// myManualObjectMaterial->getTechnique(0)->getPass(0)->setDiffuse(1.0, 1.0, 1.0, 1.0); -// myManualObjectMaterial->getTechnique(0)->getPass(0)->setAmbient(1.0, 1.0, 1.0); -// myManualObjectMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(1.0, 1.0, 1.0); -// myManualObject->begin("manual1Material", Ogre::RenderOperation::OT_POINT_LIST); -// for ( int i = 0; i < 3000; i ++ ){ -// myManualObject->position(Ogre::Vector3(Ogre::Math::RangeRandom(-1,1), -// Ogre::Math::RangeRandom(-1,1), -// Ogre::Math::RangeRandom(-1,1)).normalisedCopy() * -// Ogre::Math::RangeRandom(100000,400000) ); -// } -// myManualObject->end(); -// myManualObjectNode->attachObject(myManualObject); - //*** end starfield test 1 - - - //*** starfield test 2 -// starsNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode("StarfieldNode"); -// Ogre::BillboardSet* mySet = sceneMgr_->createBillboardSet("StarfieldNode"); -// mySet->setMaterialName( "OpenGate/Star"); -// for ( int i = 0; i < 1000; i ++ ){ -// Ogre::Billboard* myBillboard = mySet->createBillboard(Ogre::Vector3(Ogre::Math::RangeRandom(-1,1), -// Ogre::Math::RangeRandom(-1,1), -// Ogre::Math::RangeRandom(-1,1)).normalisedCopy()* Ogre::Math::RangeRandom( 1000, 3000 ) ); -// myBillboard->setDimensions( 10, 10 ); -// } -// starsNode_->attachObject(mySet); - //*** end starfield test 2; - - -// Ogre::Light * mainLight = sceneMgr_->createLight("MainLight" ); -// mainLight->setDiffuseColour( 0.1, 0.1, 0.1 ); -// mainLight->setSpecularColour( 0.4, 0.4, 0.4 ); -// mainLight->setPosition(-50000, 0, -40000 ); - - // sceneMgr_->setAmbientLight( Ogre::ColourValue( 0.1, 0.1, 0.1 ) ); - - if ( 1 ) { - // planet_ = new Planet( "planet", sceneMgr_, Ogre::Vector3( 20000.0, 10000.0, 40000 ), 15000.0f, 32 ); - planet_ = new Planet( "planet", sceneMgr_, Ogre::Vector3( 0000.0, 0000.0, 50000 ), 15000.0f, 64 ); - planet_->lighting( true ); - } - - populate( "test.sector" ); - - createKoordAxis( ); -} - -Sector::~Sector( ){ - - for ( std::set< SectorObject * >::iterator it = sectorObjects_.begin(); it != sectorObjects_.end(); it ++){ - // log_->info( "Sector::~Sector( ) deleting sector object: " + (*it)->name() ); - - if ( radar_ && (*it)->isOnRadar() ){ - Ogre::Overlay * radar = Ogre::OverlayManager::getSingleton().getByName( "Radar" ); - Ogre::OverlayContainer * radarMap = radar->getChild( "Radar/Map" ); - radarMap->removeChild( (*it)->dotA()->getName() ); - radarMap->removeChild( (*it)->dotB()->getName() ); - } - - delete *it; - } - - sceneMgr_->destroyLight("MainLight" ); - - if ( planet_ ) { delete planet_; } - - if ( koordAxisNode_ ) { - koordAxisNode_->detachObject( koordAxisMO_ ); - sceneMgr_->destroyManualObject( koordAxisMO_->getName() ); - sceneMgr_->getRootSceneNode()->removeAndDestroyChild( koordAxisNode_->getName() ); - koordAxisNode_ = NULL; - } - - for ( std::map< std::string, std::deque< SectorObject * > >::iterator it = objectHeap_.begin(); it != objectHeap_.end(); it ++ ){ - for_each( (*it).second.begin(), (*it).second.end(), deletePtr() ); -// std::cout << (*it).first << std::endl; -// for ( int i = 0; i < (*it).second.size(); i ++ ){ -// std::cout << (*it).second[ i ]->name() << std::endl; -// delete (*it).second[ i ]; -// } - } -} - -void Sector::populate( const std::string & fileName ){ - TiXmlDocument doc( ResourceManager::getSingleton().findFullFileName( fileName ) ); - bool loadOkay = doc.LoadFile(); - - if ( !loadOkay ) { - log_->fatal( std::string( "Failed to load sector file: " + fileName ) ); - return; - } - - TiXmlHandle docHandle( &doc ); - TiXmlElement *pElem;//, *pSubElem; - TiXmlHandle hRoot( 0 ); - - pElem = docHandle.FirstChildElement().Element(); - hRoot = TiXmlHandle( pElem ); - - if ( !pElem ) { - log_->fatal( fileName + " cannot read first node." ); - return; - } - - if ( strcmp( "sector", pElem->Value() ) != 0 ) { - log_->fatal( fileName + " is no sector description" ); - return; - } - readXMLAttribute< std::string >( pElem, "name_en name", this, &OpenGate::Sector::setName, false ); - - pElem = hRoot.ChildElement( "environment", 0 ).Element(); - if ( pElem ){ - readXMLAttribute< std::string >( pElem, "skybox", this, &OpenGate::Sector::setSkyBox, false ); - readXMLColourElement( pElem, "ambient", sceneMgr_, &Ogre::SceneManager::setAmbientLight, false ); - } - - pElem = hRoot.ChildElement( "station", 0 ).Element(); - if ( pElem ){ - std::string name; readXMLAttribute < std::string >( pElem, "name", name ); - Ogre::Vector3 pos( readXMLVec3Element( pElem, "position" ) ); - Ogre::Quaternion rot( readXMLQuatElement( pElem, "orientation" ) ); - SectorObject *obj = createStation( name, pos ); - if ( rot != Ogre::Quaternion::ZERO ) obj->rotNode()->setOrientation( rot ); - } - - pElem = hRoot.ChildElement( "beacon", 0 ).Element(); - if ( pElem ){ - Ogre::Vector3 pos( readXMLVec3Element( pElem, "position" ) ); - Ogre::Vector3 dir( readXMLVec3Element( pElem, "direction" ) ); - Ogre::Quaternion rot( readXMLQuatElement( pElem, "orientation" ) ); - SectorObject * obj = createBeacon( pos ); - obj->mainNode()->setDirection( dir ); - if ( rot != Ogre::Quaternion::ZERO ) obj->rotNode()->setOrientation( rot ); - } - - for ( pElem = hRoot.FirstChild( "sectorobject" ).Element(); pElem != 0; pElem = pElem->NextSiblingElement("sectorobject") ) { - std::string name; readXMLAttribute < std::string >( pElem, "name", name ); - Ogre::Vector3 pos( readXMLVec3Element( pElem, "position" ) ); - Ogre::Vector3 scale( readXMLVec3Element( pElem, "scale" ) ); - Ogre::Quaternion rot( readXMLQuatElement( pElem, "orientation" ) ); - - TiXmlElement * pElemChild = pElem->FirstChildElement( "entity" ); - - if ( pElemChild ){ - std::string mesh; readXMLAttribute < std::string >( pElemChild, "meshFile", mesh ); - SectorObject * obj = createStaticObject( mesh, name, pos ); - if ( scale != Ogre::Vector3::ZERO ) obj->scale( scale ); - if ( rot != Ogre::Quaternion::ZERO ) obj->rotNode()->setOrientation( rot ); - int nSubEnt = 0; readXMLAttribute < int >( pElemChild, "numSubEntities", nSubEnt ); - - for ( int i = 0; i < nSubEnt; i ++ ){ - std::string matName; readXMLAttribute < std::string >( pElemChild, "material-"+toStr( i ), matName ); - obj->entity()->getSubEntity( i )->setMaterialName( matName ); - } - - } else{ - std::cerr << "no entity found for sectorobject: " << name << std::endl; - } - } - - return; -} - -void Sector::setSkyBox( const std::string & name ){ - sceneMgr_->setSkyBox( true, name, 10000 ); -} - -bool Sector::update( Ogre::Real elapsedTime ){ - if ( ResourceManager::getSingleton().collisionManager ) - ResourceManager::getSingleton().collisionManager->update( elapsedTime ); - - if ( avatar_ ) { - if ( planet_ ){ - planet_->update( elapsedTime ); - } - - if ( starsNode_ ) starsNode_->setPosition( avatar_->mainNode()->getPosition() ); - - if ( radar_ ){ - Ogre::Overlay * radar = Ogre::OverlayManager::getSingleton().getByName( "Radar" ); - Ogre::OverlayContainer * radarMap = radar->getChild( "Radar/Map" ); - - int dotAWidth = 4; - int dotAHeight = 2; - float radarRange = 5000; - float radarWidth = radarMap->getWidth() * Ogre::OverlayManager::getSingleton().getViewportWidth(); - float radarHeight = radarMap->getHeight() * Ogre::OverlayManager::getSingleton().getViewportHeight(); - float xScale = radarRange / ( radarWidth / 2.0 ); - float yScale = radarRange / ( radarHeight / 2.0 ); - - for ( std::set< SectorObject * >::iterator it = sectorObjects_.begin(); it != sectorObjects_.end(); it++){ - - if ( (*it) != avatar_ ){ - Ogre::Vector3 relativPosition( (*it)->mainNode()->getPosition( ) - avatar_->mainNode()->getPosition( ) ); - Ogre::OverlayElement * dotA = (*it)->dotA(); - Ogre::OverlayElement * dotB = (*it)->dotB(); - - if ( relativPosition.length() < radarRange ){ - - Ogre::Quaternion q; - q.FromAngleAxis( -avatar_->mainNode()->getOrientation( ).getYaw(), Ogre::Vector3::UNIT_Y); - relativPosition = q * relativPosition; - -// Ogre::Quaternion r( Ogre::Degree(20), Ogre::Vector3::UNIT_Z); -// relativPosition = r * relativPosition; - // std::cout << relativPosition << std::endl; - - Ogre::Plane viewPlane( avatar_->mainNode()->getOrientation().yAxis().normalisedCopy(), - avatar_->mainNode()->getPosition() ); - - float distToPlane = viewPlane.getDistance( (*it)->mainNode()->getPosition( ) ) / yScale; - - dotA->setPosition( radarWidth / 2.0 + relativPosition[ 0 ] / xScale - dotAWidth / 2, - radarHeight / 2.0 + relativPosition[ 2 ] / yScale - dotAHeight / 2 - distToPlane ); - - if ( distToPlane < 0 ) distToPlane = 0; - - dotB->setHeight( fabs( distToPlane ) ); - dotB->setPosition( radarWidth / 2.0 + relativPosition[ 0 ] / xScale, - - distToPlane + radarHeight / 2.0 + relativPosition[ 2 ] / yScale ); - - if ( (*it)->isOnRadar() == false ){ - radarMap->addChild( dotA ); - radarMap->addChild( dotB ); - (*it)->onRadar( true ); - } - } else { // if not in radarrange - if ( (*it)->isOnRadar() == true ){ - radarMap->removeChild( dotA->getName() ); - radarMap->removeChild( dotB->getName() ); - (*it)->onRadar( false ); - } - } - } // if it != avatar - } // for each object - } // if radar - } // if avatar - - for ( std::map< long, SectorObjectMovable * >::iterator it = movableObjects_.begin(); it != movableObjects_.end(); ){ - - if ( !it->second ){ - log_->info( "Sector::update request for invalid object id: " + toStr( it->first ) ); - } else { - if ( !it->second->update( elapsedTime ) ) { //** object died; - if ( it->second == avatar_ ) { - if ( avatarDeathSequenceTime_ == 0.0 ){ - avatarDeathSequenceTime_ = 1.0; - } else { - avatarDeathSequenceTime_ -= elapsedTime; - if ( avatarDeathSequenceTime_ < 0 ){ - avatarDeathSequenceTime_ = 0.0; - listener_->avatarDeathSequence( false ); - } - } - it++; - } else { //** died object is not avatar; - destruct_( (it++)->second ); - } - } else ++it; - } - } - return true; -} - -void Sector::avatarDied( ){ - if ( avatar_ ){ - sendVesselDied( avatar_ ); - listener_->avatarDeathSequence( true ); - } -} - -SectorObject * Sector::createStaticObject( const Ogre::String & meshname, const Ogre::String & objectname, - const Ogre::Vector3 & pos ){ - SectorObject * obj = new SectorObject( objectname, this ); - - obj->setShape( meshname ); - - obj->mainNode()->setPosition( pos ); - sectorObjects_.insert( obj ); - return obj; -} - -SectorObject * Sector::createStaticObject( const Ogre::String & meshname, const Ogre::String & objectname, - const Ogre::Vector3 & pos, const Ogre::Vector3 & targetSize, Ogre::Degree yaw ){ - - SectorObject * obj = new SectorObject( objectname, this ); - - obj->mainNode()->yaw( yaw ); - obj->setShape( meshname ); - obj->setBaseSize( targetSize ); - obj->mainNode()->setPosition( pos ); - - sectorObjects_.insert( obj ); - return obj; -} - -SectorObject * Sector::createStation( const Ogre::String & stationName, Ogre::Vector3 & pos ){ - Station * station = ResourceManager::getSingleton().entityManager->station( stationName ); - SectorObject * obj = NULL; - - if ( station ){ - obj = new StationObject( *station, this ); - obj->mainNode()->setPosition( pos ); - sectorObjects_.insert( obj ); - station_ = dynamic_cast< StationObject * >( obj ); - } - return obj; -} - -SectorObject * Sector::createBeacon( const Ogre::Vector3 & pos ){ - SectorObject * obj = new BeaconObject( this ); - obj->mainNode()->setPosition( pos ); - obj->scale( Ogre::Vector3( 20.0, 20.0, 20.0 ) ); - sectorObjects_.insert( obj ); - return obj; -} - -SectorObjectMovable * Sector::createMovable( const Ogre::String & name, - Uint32 userID, Uint8 childID, Movable & movable ){ - SectorObjectMovable * obj = new SectorObjectMovable( name, this, userID, childID, - new Movable( movable ) ); - sectorObjects_.insert( obj ); - movableObjects_[ obj->globalID() ] = obj; - - return obj; -} - -SectorObjectVessel * Sector::createVessel( const Ogre::String & name, - Uint32 userID, Uint8 childID, Vessel & vessel ){ - - SectorObjectVessel * obj; - - if ( objectHeap_[ vessel.name() ].empty() ){ - childIDCounter_++; - obj = new SectorObjectVessel( name + "_" + toStr( childIDCounter_ ), - this, userID, childIDCounter_, new Vessel( vessel ) ); - log_->debug( "Sector::createVessel new " + obj->name() ); - } else { - obj = dynamic_cast< SectorObjectVessel * >( objectHeap_[ vessel.name() ].front() ); - objectHeap_[ vessel.name() ].pop_front(); - obj->reset(); - log_->debug( "Sector::createVessel reuse " + obj->name() ); - } - - sectorObjects_.insert( obj ); - if ( !movableObjects_.count( obj->globalID() ) ){ - movableObjects_[ obj->globalID() ] = obj; - } else { - std::cout << "Sector::createVessel: globalID allready exist:" << name << std::endl; - } - obj->setActive( true ); - return obj; -} - -SectorObjectMissile * Sector::createMissile( const Ogre::String & name, Uint32 userID, Uint8 childID, - Missile & missile ){ - SectorObjectMissile * obj; - - //if ( objectHeap_.count( missile.name() ) == 0 ){ - if ( objectHeap_[ missile.name() ].empty() ){ - childIDCounter_++; - obj = new SectorObjectMissile( name + "_" + toStr( childIDCounter_ ), - this, userID, childIDCounter_, new Missile( missile ) ); - //log_->debug( "Sector::createMissile new " + obj->name() ); - } else { - obj = dynamic_cast< SectorObjectMissile * >( objectHeap_[ missile.name() ].front() ); - objectHeap_[ missile.name() ].pop_front(); - obj->reset(); - //log_->debug( "Sector::createMissile reuse " + obj->name() ); - } - - sectorObjects_.insert( obj ); - - if ( !movableObjects_.count( obj->globalID() ) ){ - movableObjects_[ obj->globalID() ] = obj; - } else { - log_->fatal( "Sector::createMissile: globalID allready exist:" + name ); - } - obj->setActive( true ); - return obj; -} - -void Sector::createAvatarObject( Avatar & avatar ){ - log_->info( std::string( "Sector::createAvatarObject: " ) + avatar.name() ); - avatar_ = new SectorObjectAvatar( avatar.name(), this, avatar.userID(), avatar.vessel() ); - sectorObjects_.insert( avatar_ ); - movableObjects_[ avatar_->userID() ] = avatar_; - - avatar_->reset(); - if ( station_ ){ - log_->info( std::string( "launch avatar from station " ) ); - avatar_->mainNode()->setPosition( station_->launchPadPosition() + station_->launchPadDirection() * 5.0); - avatar_->mainNode()->setDirection( station_->launchPadDirection() ); - avatar_->setVelocity( station_->launchPadDirection() * 20.0 ); - } else{ - log_->info( std::string( "launch avatar from free position " ) ); - avatar_->mainNode()->setPosition( 0.0, 0.0, 100.0 ); - avatar_->mainNode()->setDirection( Ogre::Vector3( 0.0, 0.0, -1.0 ) ); - avatar_->setVelocity( Ogre::Vector3( 0.0, 0.0, -50.0 ) ); - } - - avatar_->setVisible( false ); - sendVesselRegister( avatar_ ); -} - -void Sector::destruct_( SectorObject * obj ){ - if ( obj ){ -// log_->debug( "Sector::destruct_ object: " + obj->name() + " " + toStr( obj->rtti() ) ); - sectorObjects_.erase( obj ); - if ( listener_->target() == obj ) selectNextTarget( ); - - if ( obj->isOnRadar() && radar_ ){ - Ogre::Overlay * radar = Ogre::OverlayManager::getSingleton().getByName( "Radar" ); - Ogre::OverlayContainer * radarMap = radar->getChild( "Radar/Map" ); - Ogre::OverlayElement * dotA = obj->dotA(); - Ogre::OverlayElement * dotB = obj->dotB(); - radarMap->removeChild( dotA->getName() ); - radarMap->removeChild( dotB->getName() ); - obj->onRadar( false ); - } - -// for ( std::map< long, SectorObjectMissile * >::iterator it = localAiObjects_.begin(); it != localAiObjects_.end(); it ++ ){ -// if ( it->second->target() == obj ){ -// log_->warn( std::string( "ai object target: " ) + it->second->name() + " loose target." ); -// it->second->setTarget( NULL ); -// } -// } - obj->setActive( false ); - - switch ( obj->rtti() ){ - case SECTOROBJECTMOVABLE_RTTI: - movableObjects_.erase( obj->globalID() ); - delete obj; - obj = NULL; - break; - case SECTOROBJECTVESSEL_RTTI: - if ( dynamic_cast< SectorObjectVessel *>( obj )->controler() ) { - dynamic_cast< SectorObjectVessel *>( obj )->controler()->setVesselObject( NULL ); - } - movableObjects_.erase( obj->globalID() ); - objectHeap_[ dynamic_cast< SectorObjectVessel *>( obj )->movable()->name() ].push_back( obj ); - break; - case SECTOROBJECTMISSILE_RTTI: { -// if ( dynamic_cast< SectorObjectMissile *>( obj )->target() == avatar_ ) { -// //sendVesselDeRegister( dynamic_cast< SectorObjectMoveable *>( obj ) ); -// log_->fatal( "void Sector::destruct_( SectorObject * obj )" ); -// //sendVesselDeRegister( obj ); -// } - movableObjects_.erase( obj->globalID() ); - objectHeap_[ dynamic_cast< SectorObjectMissile *>( obj )->movable()->name() ].push_back( obj ); - - //localAiObjects_.erase( dynamic_cast< SectorObjectMissile *>(obj)->globalID() ); -// delete obj; -// obj = NULL; - } break; - default: - log_->fatal( "Sector::destruct moveableObject: object type unknown. this should not happen: " + toStr( obj->rtti() ) ); - } - } else { - log_->fatal( "Sector::destruct moveableObject: object is no valid: " ); - } -} - -void Sector::destructAvatarObject( ){ - for ( std::map< long, SectorObjectMissile * >::iterator it = localAiObjects_.begin(); - it != localAiObjects_.end(); it ++ ){ - - if ( it->second->target() == avatar_ ){ - log_->warn( std::string( "ai object target: " ) + it->second->name() + " loose target." ); - it->second->setTarget( NULL ); - } - } - - if ( avatar_ ){ - sendVesselDeRegister( avatar_ ); - movableObjects_.erase( avatar_->userID() ); - sectorObjects_.erase( avatar_ ); - delete avatar_; - } - - avatar_ = NULL; -} - -void Sector::selectNextTarget( ){ - listener_->setTarget( nextTarget( true, false ) ); -} - -void Sector::selectPrevTarget( ){ - listener_->setTarget( nextTarget( true, true ) ); -} - -SectorObject * Sector::prevTarget( bool forbidAvatarSelection ){ - return nextTarget( forbidAvatarSelection, true ); -} - -SectorObject * Sector::nextTarget( bool forbidAvatarSelection, bool reverse ){ - if ( sectorObjects_.size() == 1 ){ - return *sectorObjects_.begin(); - } - std::set< SectorObject * >::iterator itTarget = sectorObjects_.find( listener_->target() ); - if ( itTarget == sectorObjects_.end() ) itTarget = sectorObjects_.begin(); - - for ( uint i = 0; i < sectorObjects_.size(); i ++ ){ - if ( reverse ){ - if ( itTarget == sectorObjects_.begin() ) itTarget = sectorObjects_.end(); - itTarget --; - } else { - itTarget ++; - if ( itTarget == sectorObjects_.end() ) itTarget = sectorObjects_.begin(); - } - - if ( (*itTarget)->selectable() ) { - if ( forbidAvatarSelection ){ - if ( (*itTarget) != avatar_ ) return (*itTarget); - } else return (*itTarget); - } - } - return avatar_; -} - - -void Sector::sendAllVesselMovements( ){ - if ( avatar_ ) sendVesselMovement( avatar_ ); -} - -void Sector::sendAllVesselInfos( ){ - if ( avatar_ ){ - sendVesselStatus( avatar_ ); - -// for ( std::map< long, SectorObjectMoveableAi * >::iterator it = localAiObjects_.begin(); it != localAiObjects_.end(); it ++ ){ -// if ( it->second->target() == avatar_ ){ -// sendVesselMovement( it->second ); -// sendVesselStatus( it->second ); -// } -// } - } -} - -void Sector::sendVesselMovement( SectorObjectVessel * obj ){ - if ( obj ){ - MessageBodyShipMovement msg( obj->childID(), - obj->mainNode()->getPosition().ptr(), - obj->velocity().ptr(), - obj->mainNode()->getOrientation().ptr(), - obj->thrustRate(), - obj->thrust(), - obj->scaledYaw(), - obj->scaledPitch(), - obj->scaledRoll(), - 0 ); - - network_->send( msg ); - } -} - -void Sector::receiveVesselMovement( const std::vector < MessageBodyShipMovement * > & movements ){ - - std::map < long, const MessageBodyShipMovement * > singleMsg; - - //** we sort the movement messaged - for ( size_t i = 0; i < movements.size(); i ++ ){ -// LogManager::getSingleton().debug( std::string( "Movement: " ) + -// movableObjects_[ createGlobalID( movements[ i ]->senderID(), movements[ i ]->childID() )]->name() + " " + toStr( movements[ i ]->senderID() ) + " " + toStr( (int)movements[ i ]->childID() ) + -// " " + toStr( movements[ i ]->position() ) ); - - if ( movements[ i ]->senderID() != network_->userID() ){ - //** apply only foreign movements, and take just the actual movement - singleMsg[ createGlobalID( movements[ i ]->senderID(), movements[ i ]->childID() ) ] = movements[ i ]; - } - } - - std::map< long, SectorObjectMovable * >::iterator it; - - for ( std::map < long, const MessageBodyShipMovement * >::iterator i = singleMsg.begin(); i != singleMsg.end(); i++ ){ - if ( ( it = movableObjects_.find( i->first ) ) != movableObjects_.end() ){ - it->second->setFlightProperties( (*i->second) ); - } else { - log_->fatal( "Requested non existant object for shipmovement: " + - toStr( network_->userName( i->second->senderID() ) ) + - " child: " + toStr( (int)i->second->childID() ) + - " this should not happen." ); - } - } - for ( size_t i = 0; i < movements.size(); i ++ ){ - delete movements[ i ]; - } - -} - -void Sector::sendVesselStatus( SectorObjectVessel * obj ){ - if ( obj ){ - std::cout << "sendVesselStatus:" << obj->name() << std::endl; - MessageBodyShipStatus msg( obj->childID(), obj->shield(), obj->armor(), 0, 0, 0 ); - network_->send( msg ); - } -} - -void Sector::receiveVesselStatus( const MessageBodyShipStatus & msg ){ - if ( msg.senderID() != network_->userID() ){ - - std::map< long, SectorObjectMovable * >::iterator it; - - if ( ( it = movableObjects_.find( createGlobalID( msg.senderID(), msg.childID() ) ) ) != movableObjects_.end() ){ - // log_->debug( "ReceiveVesselStatus for " + it->second->name( ) ); - it->second->setStatus( msg ); - } else { - log_->fatal( "Requested non existant object for shipstatus: " + - network_->userName( msg.senderID() ) + " this should not happen." ); - } - } -} - -void Sector::sendVesselRegister( SectorObjectVessel * obj ){ - if ( obj ) { - log_->info( std::string( "Send register " ) + obj->name() + " id:" + toStr( obj->vessel()->id() ) ); - MessageBodyShipRegister msg( obj->userID(), obj->childID(), obj->name(), obj->mainNode()->getPosition().ptr(), - obj->vessel()->id(), obj->mass(), obj->maxShield(), obj->maxThrust() ); - network_->send( msg ); - } - -} - -void Sector::receiveVesselRegister( const MessageBodyShipRegister & msg ){ - - if ( !movableObjects_.count( createGlobalID( msg.senderID(), msg.childID() ) ) ){ - if ( msg.childID() == 0 ){ - log_->info( "Create player object " + msg.name()+ " " + toStr( msg.senderID() ) + " VesselID: " + toStr( msg.vesselID() ) ); - SectorObjectMovable * obj = createMovable( msg.name(), msg.senderID(), msg.childID(), - *ResourceManager::getSingleton().entityManager->vessel( msg.vesselID() ) ); - obj->mainNode()->setPosition( toOgreVec( msg.position() ) ); - obj->setMass( msg.mass() ); - obj->setMaxShield( msg.maxShield() ); - obj->setMaxThrust( msg.maxThrust() ); - obj->setMaxSpeed( std::sqrt( msg.maxThrust() / obj->movable()->dragFactor() ) ); - std::cout << msg << std::endl; - - } else { - log_->info( "Create ai object " + msg.name()+ " " + toStr( msg.senderID() ) + " " + - toStr( (int)msg.childID() ) + " " + toStr( msg.vesselID() ) ); - -// SectorObjectMoveableAi * obj = createAiMoveableObject( msg.name(), msg.senderID(), msg.childID(), -// *VesselManager::getSingleton().vessel( msg.vesselID() ) ); -// obj->mainNode()->setPosition( toOgreVec( msg.position() ) ); -// -// if ( movableObjects_.count( createGlobalID( msg.senderID(), 0 ) ) ){ -// log_->info( "ai object target: " + movableObjects_[ createGlobalID( msg.senderID(), 0 ) ]->name() ); -// obj->setTarget( movableObjects_[ createGlobalID( msg.senderID(), 0 ) ] ); -// } - } - - sendAllVesselInfos( ); - - } else { - log_->warn( std::string( "Registering: object allready exist: " ) + - movableObjects_[ createGlobalID( msg.senderID(), msg.childID() ) ]->name() ); - } - -} - -void Sector::sendVesselDeRegister( SectorObjectVessel * obj ){ - if ( obj ) { - log_->info( std::string( "Send deregister " ) + obj->name() ); - MessageBodyShipDeRegister msg( 0, obj->childID() ); - network_->send( msg ); - } -} - -void Sector::receiveVesselDeRegister( const MessageBodyShipDeRegister & msg ){ - if ( movableObjects_.count( createGlobalID( msg.senderID(), msg.childID() ) ) ){ - log_->info( std::string( "Receive deregister " ) - + movableObjects_[ createGlobalID( msg.senderID(), msg.childID() ) ]->name() ); - - SectorObjectMovable *obj = movableObjects_[ createGlobalID( msg.senderID(), msg.childID() ) ]; - obj->destroy(); - - } else { - log_->warn( std::string( "Deregistering request for unknown object: " ) + - toStr( msg.senderID() ) + ": " + toStr( (int)msg.childID() ) ); - } -} - -void Sector::sendVesselDied( SectorObjectVessel * obj ){ - MessageBodyShipDied msg( 0, obj->childID() ); - network_->send( msg ); -} - -void Sector::receiveVesselDied( const MessageBodyShipDied & msg ){ - if ( movableObjects_.count( createGlobalID( msg.senderID(), msg.childID() ) ) ){ - log_->info( std::string( "Receive vessel died " ) - + movableObjects_[ createGlobalID( msg.senderID(), msg.childID() ) ]->name() ); - - SectorObjectMovable *obj = movableObjects_[ createGlobalID( msg.senderID(), msg.childID() ) ]; - obj->deathSequence( 0.0 ); - } else { - log_->warn( std::string( "Died vessel request for unknown object: " ) + - toStr( msg.senderID() ) + ": " + toStr( (int)msg.childID() ) ); - } -} - -void Sector::sendVesselAmmoHit( const Projectile & projectile, BaseObject * victim ){ - - if ( projectile.parent().userID() == network_->userID() ){ - MessageBodyShipAmmoHit msg( projectile.parent().childID(), victim->userID(), victim->childID(), projectile.damage() ); - network_->send( msg ); - // std::cout << " Send: " << msg << endl; - victim->hitByAmmo( projectile.damage() ); - } -} - -void Sector::receiveVesselAmmoHit( const MessageBodyShipAmmoHit & msg ){ - if ( msg.senderID() != network_->userID() ){ - - std::map< long, SectorObjectMovable * >::iterator it; - - if ( ( it = movableObjects_.find( createGlobalID( msg.targetID(), msg.targetChildID() ) ) ) != movableObjects_.end() ){ - // log_->cout( "ReceiveVesselAmmoHit for " + network_->userName( msg.targetID() ) + " " + toStr( msg.damage() ) ); - - it->second->hitByAmmo( msg.damage() ); - } else { - log_->fatal( std::string( "Requested non existant object for VesselAmmoHit " ) + - " shooter: " + network_->userName( msg.senderID() ) + - " shooter id: " + toStr( msg.senderID() ) + - " gloabel id: " + toStr( createGlobalID( msg.targetID(), msg.targetChildID() ) ) + - " victim: " + network_->userName( msg.targetID() ) + - " child: " + toStr( (int)msg.targetChildID() ) + - " damage: " + toStr( msg.damage() ) + " this should not happen." ) ; - - std::cerr << "Available objects: " << std::endl; - for ( std::map< long, SectorObjectMovable * >::iterator i = movableObjects_.begin(); i != movableObjects_.end(); i++){ - std::cerr << "\t" << i->first << " " << i->second->name() << " " << std::endl; - } - } - } -} - -void Sector::sendProjectile( const Projectile & projectile ){ - MessageBodyShipProjectileFired msg( projectile.parent().childID(), projectile.shotCount(), - Ogre::Vector3( projectile.mainNode()->getPosition() ).ptr(), - projectile.velocity().ptr(), - projectile.gun()->id(), projectile.damage(), projectile.lifeTime() ); - network_->send( msg ); -} - -void Sector::receiveProjectile( const MessageBodyShipProjectileFired & msg ){ - if ( msg.senderID() != network_->userID() ){ - - std::map< long, SectorObjectMovable * >::iterator it; - if ( ( it = movableObjects_.find( createGlobalID( msg.senderID(), msg.childID() ) ) ) != movableObjects_.end() ){ - Gun * gun = dynamic_cast < Gun * >( ResourceManager::getSingleton().entityManager->entity( msg.gunID() ) ); - if ( gun->entityType() == GUN ){ - Projectile * pro = new Projectile( it->second, msg.shotCount(), *gun, - toOgreVec( msg.position() ), - toOgreVec( msg.velocity() ) ); - - it->second->addProjectile( pro ); - } else { - log_->warn( "Unknown projectile type: " + toStr( msg.gunID() ) ); - } - } else { - log_->warn( "Unknown shooter" ); - } - } -} -#endif - } // namespace OpenGate Modified: trunk/src/SectorEnvironmentObject.cpp =================================================================== --- trunk/src/SectorEnvironmentObject.cpp 2009-12-21 22:41:44 UTC (rev 1159) +++ trunk/src/SectorEnvironmentObject.cpp 2009-12-22 22:02:14 UTC (rev 1160) @@ -22,11 +22,14 @@ #include "LogManager.h" #include "Sector.h" +#include "SectorAvatarObject.h" #include <OgreEntity.h> #include <OgreLight.h> #include <OgreManualObject.h> #include <OgreMeshManager.h> +#include <OgreParticleEmitter.h> +#include <OgreParticleSystem.h> #include <OgreSceneManager.h> #include <OgreSceneNode.h> #include <OgreSubMesh.h> @@ -291,14 +294,28 @@ SectorSpaceDustObject::SectorSpaceDustObject( Sector * sector, Ogre::SceneNode * parentNode ) : SectorEnvironmentObject( "SpaceDust", sector, parentNode ){ ps_ = sector_->sceneManager()->createParticleSystem("Dust PS", "OpenGate/Space/Dust"); - mainNode_ = parentNode->createChildSceneNode( "DustParticles", parentNode->getPosition() ); -// mainNode_->attachObject( ps_ ); + mainNode_->createChildSceneNode( "DustParticles" ); + mainNode_->attachObject( ps_ ); + Ogre::ParticleEmitter *emitter = ps_->getEmitter( 0 ); + liveRange_ = toDouble( emitter->getParameter( "width") ); } SectorSpaceDustObject::~SectorSpaceDustObject( ){ + mainNode_->detachObject( ps_ ); + mainNode_->getCreator()->destroyParticleSystem( ps_ ); } bool SectorSpaceDustObject::update( Ogre::Real elapsedTime ){ + //ps_->_update( elapsedTime ); + mainNode_->setPosition( sector_->avatarObject()->mainNode()->getPosition() ); + sector_->avatarObject()->speedRate(); + Ogre::ParticleEmitter *emitter = ps_->getEmitter( 0 ); + double liveTime = liveRange_ / max( 10.0, sector_->avatarObject()->speedRate() * sector_->avatarObject()->speed() ) * 2.0; + std::cout << liveTime << " " << liveRange_ << " " << ps_->getParticleQuota() / liveTime << std::endl; + emitter->setTimeToLive( liveTime ); + emitter->setEmissionRate( ps_->getParticleQuota() / liveTime ); + + // const float maxDist = 250.0; // const float mirrorDist = maxDist*0.99; // const float dimFactor = 0.8*0.005*0.005; @@ -381,4 +398,4 @@ // planetNode_->rotate( rot, Ogre::Node::TS_PARENT ); // } -} +} // namespace OpenGate Modified: trunk/src/SectorEnvironmentObject.h =================================================================== --- trunk/src/SectorEnvironmentObject.h 2009-12-21 22:41:44 UTC (rev 1159) +++ trunk/src/SectorEnvironmentObject.h 2009-12-22 22:02:14 UTC (rev 1160) @@ -79,7 +79,7 @@ class SectorSpaceDustObject : public SectorEnvironmentObject{ public: - SectorSpaceDustObject( Sector * sector, Ogre::SceneNode * parentNode ); + SectorSpaceDustObject( Sector * sector, Ogre::SceneNode * parentNode = NULL ); ~SectorSpaceDustObject( ); @@ -87,6 +87,7 @@ protected: Ogre::ParticleSystem * ps_; + double liveRange_; }; Modified: trunk/src/SectorMovableObject.cpp =================================================================== --- trunk/src/SectorMovableObject.cpp 2009-12-21 22:41:44 UTC (rev 1159) +++ trunk/src/SectorMovableObject.cpp 2009-12-22 22:02:14 UTC (rev 1160) @@ -36,12 +36,12 @@ #include <OgreSceneNode.h> namespace OpenGate{ - + SectorMovableObject::SectorMovableObject( const std::string & name, Sector * sector, Movable * movable ) : SectorMeshObject( name, sector, NULL ), movable_( movable ), user_( NULL ){ - + setMesh( movable_->meshPtr()->getName() ); - + setBaseRot( movable_->baseYaw(), movable_->basePitch(), movable_->baseRoll() ); setBaseSize( movable_->baseSize() ); reset(); @@ -49,18 +49,18 @@ SectorMovableObject::~SectorMovableObject( ){ } - + void SectorMovableObject::reset( ){ SectorMeshObject::reset(); - + user_ = NULL; - + yaw_ = 0.0; pitch_ = 0.0; roll_ = 0.0; rotRelativeTo_ = Ogre::Node::TS_LOCAL; - + acc_ = Ogre::Vector3::ZERO; vel_ = Ogre::Vector3::ZERO; @@ -81,9 +81,9 @@ maxArmor_ = movable_->armor(); maxShield_ = 1; shield_ = 0; - + lastFrameCount_ = 0; - + setDestroyRequest_( false ); } @@ -108,12 +108,12 @@ } break; default: - std::cout << "SectorMovableObject: " << this->name() << " collide with " - << obj->rtti() << " " << obj->name() << std::endl; + std::cout << "SectorMovableObject: " << this->name() << " collide with " + << obj->rtti() << " " << obj->name() << std::endl; } } } - + bool SectorMovableObject::update( Ogre::Real elapsedTime ){ if ( destroyRequest_ ) return false; @@ -128,10 +128,10 @@ Ogre::Vector3 thrustDir( mainNode_->getOrientation().zAxis().normalisedCopy() ); Ogre::Vector3 flightDir( vel_.normalisedCopy() ); - + thrustDir.x = round( thrustDir.x, 7 ); thrustDir.y = round( thrustDir.y, 7 ); thrustDir.z = round( thrustDir.z, 7 ); flightDir.x = round( flightDir.x, 7 ); flightDir.y = round( flightDir.y, 7 ); flightDir.z = round( flightDir.z, 7 ); - + //** thrust = mass * a; if ( mass_ > 0 ){ acc_ = ( - thrustDir * (double)thrust_ - flightDir * transFriction_() ) / (double)mass_; @@ -146,45 +146,45 @@ // std::cout << yaw_ << " " << pitch_ << " " << roll... [truncated message content] |
From: <spo...@us...> - 2009-12-21 22:41:52
|
Revision: 1159 http://opengate.svn.sourceforge.net/opengate/?rev=1159&view=rev Author: spom_spom Date: 2009-12-21 22:41:44 +0000 (Mon, 21 Dec 2009) Log Message: ----------- client: remove unused files Modified Paths: -------------- trunk/data/misc/common.material trunk/src/OpcodeWrapper.cpp trunk/src/SectorEnvironmentObject.cpp trunk/src/SectorEnvironmentObject.h trunk/src/networkClient.h Added Paths: ----------- trunk/data/misc/misc.material trunk/data/misc/misc.particle Removed Paths: ------------- trunk/src/SectorObject.cpp trunk/src/SectorObject.h trunk/src/SectorObjectAvatar.cpp trunk/src/SectorObjectAvatar.h trunk/src/SectorObjectMissile.cpp trunk/src/SectorObjectMissile.h trunk/src/SectorObjectMoveable.cpp trunk/src/SectorObjectMoveable.h trunk/src/SectorObjectVessel.cpp trunk/src/SectorObjectVessel.h Modified: trunk/data/misc/common.material =================================================================== --- trunk/data/misc/common.material 2009-12-21 18:33:14 UTC (rev 1158) +++ trunk/data/misc/common.material 2009-12-21 22:41:44 UTC (rev 1159) @@ -15,3 +15,4 @@ } } } + Added: trunk/data/misc/misc.material =================================================================== --- trunk/data/misc/misc.material (rev 0) +++ trunk/data/misc/misc.material 2009-12-21 22:41:44 UTC (rev 1159) @@ -0,0 +1,17 @@ +material OpenGate/Space/Dust +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture textures/flare.png + } + } + } +} \ No newline at end of file Added: trunk/data/misc/misc.particle =================================================================== --- trunk/data/misc/misc.particle (rev 0) +++ trunk/data/misc/misc.particle 2009-12-21 22:41:44 UTC (rev 1159) @@ -0,0 +1,18 @@ +OpenGate/Space/Dust +{ + material OpenGate/Space/Dust + particle_width 1 + particle_height 1 + cull_each true + quota 500 + billboard_type point + + // Area emitter + emitter Ellipsoid{ + emission_rate 50000 + velocity 0 + width 500 + height 500 + depth 500 + } +} \ No newline at end of file Modified: trunk/src/OpcodeWrapper.cpp =================================================================== --- trunk/src/OpcodeWrapper.cpp 2009-12-21 18:33:14 UTC (rev 1158) +++ trunk/src/OpcodeWrapper.cpp 2009-12-21 22:41:44 UTC (rev 1159) @@ -22,7 +22,7 @@ #include "OpcodeWrapper.h" #include "SectorCollisionObject.h" -#include "SectorObject.h" +//#include "SectorObject.h" #include "ResourceManager.h" #include <OgreOpcode.h> @@ -50,7 +50,7 @@ collisionManager_->addCollClass( "Station" ); collisionManager_->addCollClass( "DockPad" ); collisionManager_->addCollClass( "Bullet" ); - + collisionManager_->addCollType( "Bullet", "Bullet", OgreOpcode::COLLTYPE_IGNORE ); collisionManager_->addCollType( "SectorObject", "Bullet", OgreOpcode::COLLTYPE_EXACT ); collisionManager_->addCollType( "SectorObject", "SectorObject", OgreOpcode::COLLTYPE_EXACT ); @@ -59,8 +59,8 @@ collisionManager_->addCollType( "Station", "Bullet", OgreOpcode::COLLTYPE_EXACT ); collisionManager_->addCollType( "DockPad", "SectorObject", OgreOpcode::COLLTYPE_EXACT ); - //** possible contact types OgreOpcode::COLLTYPE_CONTACT || OgreOpcode::COLLTYPE_QUICK - + //** possible contact types OgreOpcode::COLLTYPE_CONTACT || OgreOpcode::COLLTYPE_QUICK + collideInSectorContext_ = collisionManager_->getDefaultContext(); } else { std::cout << "OpcodeCollisionDetection deactivated" << std::endl; @@ -75,27 +75,27 @@ bool OpcodeCollisionDetection::update( Ogre::Real elapsedTime ){ if ( active_ ){ collideInSectorContext_->collide( elapsedTime ); - + OgreOpcode::CollisionReporter report( collideInSectorContext_->getCollisionReport() ); - + uint nCollids = report.getNumCollisions(); if ( nCollids > 0 ){ // std::cout << "OpcodeCollisionDetection::update() " << nCollids << std::endl; - + OgreOpcode::CollisionPair **collisionReport; report.getAllCollisions( collisionReport ); - + for ( uint i = 0; i < nCollids; i ++ ){ OgreOpcode::CollisionObject * col1 = collisionReport[ i ]->this_object; OgreOpcode::CollisionObject * col2 = collisionReport[ i ]->other_object; - + // std::cout << i << ": "<< col1->getName() << "<->" << col2->getName() << std::endl; - + static_cast< SectorCollisionObject * >( col1->getClientData() )->collide( static_cast< SectorCollisionObject * >( col2->getClientData() ) ); static_cast< SectorCollisionObject * >( col2->getClientData() )->collide( static_cast< SectorCollisionObject * >( col1->getClientData() ) ); - } + } } // if ncols } @@ -124,8 +124,8 @@ } } } - -void OpcodeCollisionDetection::destroy( SectorCollisionObject * obj ){ + +void OpcodeCollisionDetection::destroy( SectorCollisionObject * obj ){ if ( obj && active_ ){ destroy( obj->collisionObject() ); obj->setCollisionObject( NULL ); @@ -139,49 +139,48 @@ collisionManager_->destroyShape( shape ); } } - + bool OpcodeCollisionDetection::checkCollideRay( SectorCollisionObject * obj, const Ogre::Ray & ray, double rayLength ){ if ( active_ ){ if ( !obj->isDestroyRequest() ){ OgreOpcode::CollisionPair ** rayPickReport; - + uint nColl = collideInSectorContext_->rayCheck( ray, rayLength, OgreOpcode::COLLTYPE_EXACT, OgreOpcode::COLLTYPE_ALWAYS_EXACT, rayPickReport ); - + // std::cout << "OpcodeCollisionDetection::checkCollideRay()" << " " << rayLength << " " << nColl <<std::endl; - + for ( uint i = 0; i < nColl; i ++ ){ /* std::cout << "OpcodeCollisionDetection::checkCollideRay()" << " " << rayLength << " " << nColl <<std::endl;*/ - + OgreOpcode::CollisionObject * col1 = rayPickReport[ i ]->this_object; OgreOpcode::CollisionObject * col2 = rayPickReport[ i ]->other_object; - + if ( col1->getClientData() == col2->getClientData() ){ obj->collide( static_cast< SectorCollisionObject * >( col1->getClientData() ) ); static_cast< SectorCollisionObject * >( col1->getClientData() )->collide( obj ); } else { std::cout << "checkCollideRay: " << i << " " - << static_cast< SectorCollisionObject * >( col1->getClientData() )->name() << "<->" + << static_cast< SectorCollisionObject * >( col1->getClientData() )->name() << "<->" << static_cast< SectorCollisionObject * >( col2->getClientData() )->name() << std::endl; } - + // if ( obj->rtti() == SECTOR_PROJECTILE_OBJECT_RTTI ){ // if ( dynamic_cast< Projectile * >( obj )->parent() != static_cast< BaseObject * >( col1->getClientData() ) ){ // obj->mainNode()->setPosition( rayPickReport[ i ]->contact ); // obj->collide( static_cast< BaseObject * >( col2->getClientData() ) ); // static_cast< BaseObject * >( col1->getClientData() )->collide( obj ); // return true; -// } +// } // } else if ( obj != col1->getClientData() ){ // obj->collide( static_cast< BaseObject * >( col2->getClientData() ) ); // static_cast< BaseObject * >( col1->getClientData() )->collide( obj ); -// } - } - } +// } + } + } } return false; } - @@ -189,106 +188,107 @@ + // void OpcodeCollisionDetection::createObject( BaseObject * obj ){ -// +// // if ( obj && active_ ){ // OgreOpcode::CollisionObject * collObj = obj->collisionObject(); -// +// // if ( !collObj ){ -// +// // OgreOpcode::EntityCollisionShape * collShape = collisionManager_->createEntityCollisionShape( obj->name() + "/CollShape" ); // if ( obj->entity() ){ // collShape->load( obj->entity() ); // } else { // std::cout << "OpcodeCollisionDetection::createObject( BaseObject * obj ), no entity defined for obj: " << obj->name(); // } -// +// // collObj = collideInSectorContext_->createObject( obj->name() + "/CollObj" ); // collObj->setCollClass( collisionManager_->queryCollClass( obj->collisionClass() ) ); // collObj->setShape( collShape ); -// +// // collObj->setClientData( obj ); // collideInSectorContext_->addObject( collObj ); -// +// // obj->setCollisionObject( collObj ); -// } +// } // } // } -// -// void OpcodeCollisionDetection::destroyObject( BaseObject * obj ){ -// +// +// void OpcodeCollisionDetection::destroyObject( BaseObject * obj ){ +// // if ( obj && active_ ){ // destroy( obj->collisionObject() ); // obj->setCollisionObject( NULL ); // } // } -// -// void OpcodeCollisionDetection::detach( BaseObject * obj ){ +// +// void OpcodeCollisionDetection::detach( BaseObject * obj ){ // if ( obj && active_ ){ // destroyObject( obj ); // } // } -// -// void OpcodeCollisionDetection::attach( BaseObject * obj ){ -// if ( obj && active_ ){ +// +// void OpcodeCollisionDetection::attach( BaseObject * obj ){ +// if ( obj && active_ ){ // createObject( obj ); // } // } -// +// // bool OpcodeCollisionDetection::checkCollideRay( BaseObject * obj, const Ogre::Ray & ray, double rayLength){ // if ( active_ ){ // if ( !obj->isSetDestroyRequest() ){ // OgreOpcode::CollisionPair ** rayPickReport; -// +// // uint nColl = collideInSectorContext_->rayCheck( ray, rayLength, OgreOpcode::COLLTYPE_EXACT, // OgreOpcode::COLLTYPE_ALWAYS_EXACT, rayPickReport ); -// +// // // std::cout << "OpcodeCollisionDetection::checkCollideRay()" << " " << rayLength << " " << nColl <<std::endl; -// +// // for ( uint i = 0; i < nColl; i ++ ){ // /* std::cout << "OpcodeCollisionDetection::checkCollideRay()" << " " << rayLength << " " << nColl <<std::endl;*/ -// +// // OgreOpcode::CollisionObject* col1 = rayPickReport[ i ]->this_object; // OgreOpcode::CollisionObject* col2 = rayPickReport[ i ]->other_object; -// +// // // std::cout << "checkCollideRay: " << i << " " -// // << static_cast< BaseObject * >( col1->getClientData() )->name() << "<->" +// // << static_cast< BaseObject * >( col1->getClientData() )->name() << "<->" // // << static_cast< BaseObject * >( col2->getClientData() )->name() << std::endl; -// +// // if ( obj->rtti() == PROJECTILE_RTTI ){ -// if ( dynamic_cast< Projectile * >( obj )->parent() != +// if ( dynamic_cast< Projectile * >( obj )->parent() != // static_cast< BaseObject * >( col1->getClientData() ) ){ // obj->mainNode()->setPosition( rayPickReport[ i ]->contact ); // obj->collide( static_cast< BaseObject * >( col2->getClientData() ) ); // static_cast< BaseObject * >( col1->getClientData() )->collide( obj ); // return true; -// } +// } // } else if ( obj != col1->getClientData() ){ // obj->collide( static_cast< BaseObject * >( col2->getClientData() ) ); // static_cast< BaseObject * >( col1->getClientData() )->collide( obj ); -// } -// } -// } +// } +// } +// } // } // return false; // } void OpcodeCollisionDetection::info( ){ std::cout << "OpcodeCollisionDetection::info( )" << std::endl; - + std::vector< OgreOpcode::CollisionObject * > activeObjects( collideInSectorContext_->getAttachedObjects() ); std::cout << "CollisionContext attached objects: " + Ogre::StringConverter::toString(collideInSectorContext_->getAttachedObjectCount()) << std::endl; for ( uint i = 0; i < activeObjects.size(); i ++ ){ std::cout << i << ": " << activeObjects[ i ]->getName() << std::endl; } - + std::vector< OgreOpcode::CollisionObject * > ownedObjects( collideInSectorContext_->getOwnedObjects() ); std::cout << "CollisionContext owned objects: " + Ogre::StringConverter::toString(collideInSectorContext_->getOwnedObjectCount()) << std::endl; for ( uint i = 0; i < ownedObjects.size(); i ++ ){ std::cout << i << ": " << ownedObjects[ i ]->getName() << std::endl; } std::cout << "CollisionManager shapes: " + Ogre::StringConverter::toString(collisionManager_->getShapeCount())<< std::endl; - + } } // namespace OpenGate{ Modified: trunk/src/SectorEnvironmentObject.cpp =================================================================== --- trunk/src/SectorEnvironmentObject.cpp 2009-12-21 18:33:14 UTC (rev 1158) +++ trunk/src/SectorEnvironmentObject.cpp 2009-12-21 22:41:44 UTC (rev 1159) @@ -44,17 +44,17 @@ } -bool SectorEnvironmentObject::update( Ogre::Real elapsedTime ){ - return true; +bool SectorEnvironmentObject::update( Ogre::Real elapsedTime ){ + return true; } SectorPlanetObject::SectorPlanetObject( const std::string & name, Sector * sector, Ogre::SceneNode * parentNode ) : SectorEnvironmentObject( name, sector, parentNode ){ - + cloudNode_ = NULL; cloudEntity_ = NULL; - + //planet_->lighting( true ); createSphere_( name + "/Mesh", 15000.0f, 64, 64 ); @@ -64,27 +64,27 @@ mainNode_->attachObject( entity_ ); mainNode_->setPosition( Ogre::Vector3( 0000.0, 0000.0, 50000 ) ); // mainNode_->setVisible( false ); - + cloudNode_ = mainNode_->createChildSceneNode( mainNode_->getName() + "/cloud" ); // cloudNode_->setVisible( true ); - cloudEntity_ = entity_->clone( cloudNode_->getName() ); - cloudEntity_->setMaterialName( "Planet/Cloud" ); + cloudEntity_ = entity_->clone( cloudNode_->getName() ); + cloudEntity_->setMaterialName( "Planet/Cloud" ); cloudNode_->attachObject( cloudEntity_ ); cloudNode_->scale(1.015, 1.015, 1.015); - + light_ = sector_->sceneManager()->createLight( name + "-light"); light_->setDiffuseColour( 0.1, 0.1, 0.1 ); light_->setSpecularColour( 0.4, 0.4, 0.4 ); mainNode_->attachObject( light_ ); - light_->setVisible( true ); + light_->setVisible( true ); } SectorPlanetObject::~SectorPlanetObject( ){ mainNode_->detachObject( light_ ); sector_->sceneManager()->destroyLight( light_->getName() ); - + if ( cloudNode_ ){ if ( cloudEntity_ ){ cloudNode_->detachObject( cloudEntity_ ); @@ -92,7 +92,7 @@ } mainNode_->removeAndDestroyChild( cloudNode_->getName() ); } - + Ogre::MeshManager::getSingleton().remove( name_ + "/Mesh" ); mainNode_->detachObject( entity_ ); sector_->sceneManager()->destroyEntity( entity_ ); @@ -108,10 +108,10 @@ void SectorPlanetObject::createSphere_( const std::string & name, const float r, const int nRings, const int nSegments ){ Ogre::MeshPtr pSphere = Ogre::MeshManager::getSingleton().createManual( name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME ); Ogre::SubMesh *pSphereVertex = pSphere->createSubMesh(); - + pSphere->sharedVertexData = new Ogre::VertexData(); Ogre::VertexData* vertexData = pSphere->sharedVertexData; - + // define the vertex format Ogre::VertexDeclaration * vertexDecl = vertexData->vertexDeclaration; size_t currOffset = 0; @@ -124,55 +124,55 @@ // two dimensional texture coordinates vertexDecl->addElement(0, currOffset, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES, 0); currOffset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT2); - + // allocate the vertex buffer vertexData->vertexCount = (nRings + 1) * (nSegments+1); Ogre::HardwareVertexBufferSharedPtr vBuf = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer( - vertexDecl->getVertexSize(0), vertexData->vertexCount, + vertexDecl->getVertexSize(0), vertexData->vertexCount, Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, false); Ogre::VertexBufferBinding* binding = vertexData->vertexBufferBinding; binding->setBinding(0, vBuf); float * pVertex = static_cast<float*>(vBuf->lock(Ogre::HardwareBuffer::HBL_DISCARD)); - + // allocate index buffer pSphereVertex->indexData->indexCount = 6 * nRings * (nSegments + 1); pSphereVertex->indexData->indexBuffer = Ogre::HardwareBufferManager::getSingleton().createIndexBuffer( - Ogre::HardwareIndexBuffer::IT_16BIT, pSphereVertex->indexData->indexCount, + Ogre::HardwareIndexBuffer::IT_16BIT, pSphereVertex->indexData->indexCount, Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, false); Ogre::HardwareIndexBufferSharedPtr iBuf = pSphereVertex->indexData->indexBuffer; unsigned short* pIndices = static_cast<unsigned short*>(iBuf->lock(Ogre::HardwareBuffer::HBL_DISCARD)); - + float fDeltaRingAngle = (Ogre::Math::PI / nRings); float fDeltaSegAngle = (2.0 * Ogre::Math::PI / nSegments); unsigned short wVerticeIndex = 0 ; - + //! Generate the group of rings for the sphere for ( int ring = 0; ring <= nRings; ring++ ) { float r0 = r * sinf (ring * fDeltaRingAngle); float y0 = r * cosf (ring * fDeltaRingAngle); - + //! Generate the group of segments for the current ring for (int seg = 0; seg <= nSegments; seg++) { float x0 = r0 * sinf(seg * fDeltaSegAngle); float z0 = r0 * cosf(seg * fDeltaSegAngle); - + //! Add one vertex to the strip which makes up the sphere *pVertex++ = x0; *pVertex++ = y0; *pVertex++ = z0; - + Ogre::Vector3 vNormal = Ogre::Vector3(x0, y0, z0).normalisedCopy(); *pVertex++ = vNormal.x; *pVertex++ = vNormal.y; *pVertex++ = vNormal.z; - + *pVertex++ = (float) seg / (float) nSegments; *pVertex++ = (float) ring / (float) nRings; - + if (ring != nRings) { //! each vertex (except the last) has six indices pointing to it *pIndices++ = wVerticeIndex + nSegments + 1; - *pIndices++ = wVerticeIndex; + *pIndices++ = wVerticeIndex; *pIndices++ = wVerticeIndex + nSegments; *pIndices++ = wVerticeIndex + nSegments + 1; *pIndices++ = wVerticeIndex + 1; @@ -181,26 +181,26 @@ } } //! end for seg } //! end for ring - + vBuf->unlock(); iBuf->unlock(); - + //! Generate face list pSphereVertex->useSharedVertices = true; - + //! the original code was missing this line: pSphere->_setBounds( Ogre::AxisAlignedBox( Ogre::Vector3(-r, -r, -r), Ogre::Vector3(r, r, r) ), false ); pSphere->_setBoundingSphereRadius( r ); //! this line makes clear the mesh is loaded (avoids memory leaks) pSphere->load(); - + Ogre::MeshPtr pMesh = Ogre::MeshManager::getSingleton().load( name, - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, - Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, + Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, + Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, + Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, true, true); unsigned short src, dest; - + if ( !pMesh->suggestTangentVectorBuildParams( Ogre::VES_TANGENT, src, dest) ) { pMesh->buildTangentVectors( Ogre::VES_TANGENT, src, dest ); } @@ -208,17 +208,17 @@ SectorEclipticObject::SectorEclipticObject( Sector * sector, Ogre::SceneNode * parentNode ) : SectorEnvironmentObject( "Ecliptic", sector, parentNode ){ - + createGrid_(); } SectorEclipticObject::~SectorEclipticObject(){ mainNode_->detachObject( entity_ ); sector_->sceneManager()->destroyManualObject( entity_ ); -} +} -bool SectorEclipticObject::update( Ogre::Real elapsedTime ){ - return true; +bool SectorEclipticObject::update( Ogre::Real elapsedTime ){ + return true; } void SectorEclipticObject::createGrid_(){ @@ -226,13 +226,13 @@ Ogre::Real thickness = 15.0; // Of course this must be less than the radius value. Ogre::Real nx = 20, nz = 20; Ogre::Real dx = 1000, dz = 1000; - + unsigned point_index = 0; entity_->begin( "Shader/Gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); entity_->getSection( 0 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 0.0, 1.0, 0.2 ) ); entity_->getSection( 0 )->setCustomParameter( 1, Ogre::Vector4( nx * dx, 0.0, 0.0, 0.0 ) ); - + for ( int i = 0; i < nx+1; i ++ ){ entity_->position( -nx * dx / 2, 0.0, -nx * dx / 2 + i * dx - thickness ); entity_->position( nx * dx / 2, 0.0, -nx * dx / 2 + i * dx - thickness ); @@ -242,11 +242,11 @@ entity_->quad( point_index + 0, point_index + 1, point_index + 2, point_index + 3 ); } entity_->end(); - + entity_->begin( "Shader/Gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); entity_->getSection( 1 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 0.0, 1.0, 0.2 ) ); entity_->getSection( 1 )->setCustomParameter( 1, Ogre::Vector4( nz * dz, 0.0, 0.0, 0.0 ) ); - + for ( int i = 0; i < nz+1; i ++ ){ entity_->position( -nz * dz / 2 + i * dx + thickness, 0.0, -nz * dz / 2 ); entity_->position( -nz * dz / 2 + i * dx + thickness, 0.0, nz * dz / 2 ); @@ -256,11 +256,11 @@ entity_->quad( point_index + 0, point_index + 1, point_index + 2, point_index + 3 ); } entity_->end(); - + entity_->begin( "Shader/Gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); entity_->getSection( 2 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 1.0, 0.0, 0.2 ) ); entity_->getSection( 2 )->setCustomParameter( 1, Ogre::Vector4( nx * dx, 0.0, 0.0, 0.0 ) ); - + for ( int i = 0; i < nx+1; i ++ ){ entity_->position( -nx * dx / 2, 0.0, -nx * dx / 2 + i * dx - thickness ); entity_->position( nx * dx / 2, 0.0, -nx * dx / 2 + i * dx - thickness ); @@ -270,11 +270,11 @@ entity_->quad( point_index + 3, point_index + 2, point_index + 1, point_index + 0 ); } entity_->end(); - + entity_->begin( "Shader/Gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); entity_->getSection( 3 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 1.0, 0.0, 0.2 ) ); entity_->getSection( 3 )->setCustomParameter( 1, Ogre::Vector4( nz * dz, 0.0, 0.0, 0.0 ) ); - + for ( int i = 0; i < nz+1; i ++ ){ entity_->position( -nz * dz / 2 + i * dx + thickness, 0.0, -nz * dz / 2 ); entity_->position( -nz * dz / 2 + i * dx + thickness, 0.0, nz * dz / 2 ); @@ -284,18 +284,72 @@ entity_->quad( point_index + 3, point_index + 2, point_index + 1, point_index + 0 ); } entity_->end(); - + mainNode_->attachObject( entity_ ); } - +SectorSpaceDustObject::SectorSpaceDustObject( Sector * sector, Ogre::SceneNode * parentNode ) + : SectorEnvironmentObject( "SpaceDust", sector, parentNode ){ + ps_ = sector_->sceneManager()->createParticleSystem("Dust PS", "OpenGate/Space/Dust"); + mainNode_ = parentNode->createChildSceneNode( "DustParticles", parentNode->getPosition() ); +// mainNode_->attachObject( ps_ ); +} + +SectorSpaceDustObject::~SectorSpaceDustObject( ){ +} + +bool SectorSpaceDustObject::update( Ogre::Real elapsedTime ){ +// const float maxDist = 250.0; +// const float mirrorDist = maxDist*0.99; +// const float dimFactor = 0.8*0.005*0.005; +// const float maxDist2 = maxDist*maxDist; +// Camera* cam = mCamera->getCamera(); +// const Vector3& camPos = cam->getWorldPosition(); +// +// const float twiceMaxDist = 2 * maxDist; +// +// ParticleIterator pit = mParticleSystem->_getIterator(); +// +// while (!pit.end()) +// { +// Particle* particle = pit.getNext(); +// Vector3& pos = particle->position; +// particle->timeToLive = 999999.0f; +// +// // position particles near camera +// // (keep moving them toward camera until within range) +// while (pos.x - camPos.x > maxDist) +// pos.x -= twiceMaxDist; +// while (pos.x - camPos.x < -maxDist) +// pos.x += twiceMaxDist; +// while (pos.y - camPos.y > maxDist) +// pos.y -= twiceMaxDist; +// while (pos.y - camPos.y < -maxDist) +// pos.y += twiceMaxDist; +// while (pos.z - camPos.z > maxDist) +// pos.z -= twiceMaxDist; +// while (pos.z - camPos.z < -maxDist) +// pos.z += twiceMaxDist; +// +// Vector3 pDir = pos-camPos; +// float dist = pDir.squaredLength(); +// float dim = dist*dimFactor; +// particle->setDimensions(dim, dim); +// +// } +// +// return true; +// } + return true; +} + // if ( !1 ) { // planetNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode( "PlanetNode" ); -// +// // Ogre::ManualObject * planet = sceneMgr_->createManualObject( "Planet" ); // // planet->setUseIdentityProjection( true ); // // planet->setUseIdentityView( true ); -// +// // planet->begin( "OpenGate/RedPlanet", Ogre::RenderOperation::OT_TRIANGLE_LIST); // planet->position( Ogre::Vector3( -1.0, -1.0, 200.0 ) ); // planet->textureCoord( 0, 0 ); @@ -316,13 +370,13 @@ // if ( planetNode_ ){ // updateLoop // Ogre::Vector3 src = planetNode_->getWorldOrientation() * Ogre::Vector3::UNIT_Z; // src.normalise(); -// +// // Ogre::Vector3 target( avatar_->mainNode()->getPosition() - planetNode_->getWorldPosition() ); // target.normalise(); -// +// // Ogre::Quaternion rot = src.getRotationTo( target ); // rot.normalise(); -// +// // planetNode_->setPosition( Ogre::Vector3( 20000.0, 10000.0, 50000 ) + avatar_->mainNode()->getPosition() ); // planetNode_->rotate( rot, Ogre::Node::TS_PARENT ); // } Modified: trunk/src/SectorEnvironmentObject.h =================================================================== --- trunk/src/SectorEnvironmentObject.h 2009-12-21 18:33:14 UTC (rev 1158) +++ trunk/src/SectorEnvironmentObject.h 2009-12-21 22:41:44 UTC (rev 1159) @@ -30,29 +30,29 @@ class SectorEnvironmentObject : public SectorBaseObject { public: SectorEnvironmentObject( const Ogre::String & name, Sector * sector, Ogre::SceneNode * parentNode = NULL ); - + virtual ~SectorEnvironmentObject( ); - + virtual int rtti( ) const { return SECTOR_ENVIRONMENT_OBJECT_RTTI; } - + /*! Update loop for the environment */ virtual bool update( Ogre::Real elapsedTime ); - + protected: - + }; class SectorPlanetObject : public SectorEnvironmentObject{ public: SectorPlanetObject( const Ogre::String & name, Sector * sector, Ogre::SceneNode * parentNode = NULL ); - + virtual ~SectorPlanetObject(); - + /*! Update loop for the environment */ virtual bool update( Ogre::Real elapsedTime ); - + inline Ogre::SceneNode * cloudNode() { return cloudNode_; } - + protected: //** taken from ogre wiki: http://www.ogre3d.org/wiki/index.php/ManualSphereMeshes void createSphere_( const std::string & name, const float r, const int nRings, const int nSegments ); @@ -73,19 +73,31 @@ protected: void createGrid_(); - + Ogre::ManualObject * entity_; }; + +class SectorSpaceDustObject : public SectorEnvironmentObject{ +public: + SectorSpaceDustObject( Sector * sector, Ogre::SceneNode * parentNode ); + + ~SectorSpaceDustObject( ); + + virtual bool update( Ogre::Real elapsedTime ); + +protected: + Ogre::ParticleSystem * ps_; +}; + + // class SectorStarfieldObject : public SectorEnvironmentObject{ // }; -// class SectorSpaceDustObject : public SectorEnvironmentObject{ -// }; // class SectorSpaceDecorationObject : public SectorEnvironmentObject{ // }; - + } //namespace OpenGate #endif //_OPENGATE_SECTORENVIRONMENT__H Deleted: trunk/src/SectorObject.cpp =================================================================== --- trunk/src/SectorObject.cpp 2009-12-21 18:33:14 UTC (rev 1158) +++ trunk/src/SectorObject.cpp 2009-12-21 22:41:44 UTC (rev 1159) @@ -1,203 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 "SectorObject.h" - -#include "LogManager.h" -#include "OpcodeWrapper.h" -#include "ResourceManager.h" -#include "Sector.h" - -#include <OgreEntity.h> -#include <OgreMeshManager.h> -#include <OgreOverlayManager.h> -#include <OgreOverlayElement.h> -#include <OgreSceneManager.h> - -#include <string> - -namespace OpenGate{ - -SectorObject::SectorObject( const Ogre::String & name, Sector * sector, Uint32 userID, Uint8 childID ) - : BaseObject( name, sector, userID, childID ), target_( NULL ), entity_( NULL ) { __D( name ) - isOnRadar_ = false; - - mainNodeEntityScale_ = mainNode_->createChildSceneNode( mainNode_->getName() + "/basescale" ); - mainNodeEntityRot_ = mainNodeEntityScale_->createChildSceneNode( mainNodeEntityScale_->getName() + "/baserot" ); -// mainShapeNode_ = mainNodeEntityRot_->createChildSceneNode( name_ + "_shapeNode" ); - baseSize_ = Ogre::Vector3::ZERO; - - int dotAWidth = 4; - int dotAHeight = 2; - dotA_ = Ogre::OverlayManager::getSingleton().createOverlayElement( "Panel", "Radar/Map/DotA_" + name_ ); - dotA_->setMaterialName( "BaseWhite" ); - dotA_->setMetricsMode( Ogre::GMM_PIXELS ); - dotA_->setWidth( dotAWidth ); - dotA_->setHeight( dotAHeight ); - dotA_->setColour( Ogre::ColourValue( 1.0f, 0.0f, 0.0f ) ); - - dotB_ = Ogre::OverlayManager::getSingleton().createOverlayElement( "Panel", "Radar/Map/DotB_" + name_ ); - dotB_->setMaterialName( "BaseWhite" ); - dotB_->setMetricsMode( Ogre::GMM_PIXELS ); - dotB_->setWidth( 1 ); - dotB_->setHeight( 1 ); - dotB_->setColour( Ogre::ColourValue( 1.0f, 0.0f, 0.0f ) ); - - inititialize_(); -} - -SectorObject::~SectorObject(){ __D( name_ ) - - Ogre::OverlayManager::getSingleton().destroyOverlayElement( "Radar/Map/DotA_" + name_ ); - Ogre::OverlayManager::getSingleton().destroyOverlayElement( "Radar/Map/DotB_" + name_ ); - if ( ResourceManager::getSingleton().collisionManager ){ - ResourceManager::getSingleton().collisionManager->destroyObject( this ); - } - - if ( entity_ ){ - mainNodeEntityRot_->detachObject( entity_ ); - sceneMgr_->destroyEntity( entity_ ); - } - - mainNodeEntityScale_->removeAndDestroyChild( mainNodeEntityRot_->getName() ); - mainNode_->removeAndDestroyChild( mainNodeEntityScale_->getName() ); -} - -void SectorObject::inititialize_(){ - isOnRadar_ = false; - selectable_ = true; - if ( target_ ){ - std::cerr << WHERE_AM_I << "*************** this should not happen" << " " << target_->name() << std::endl; - } else { - target_ = NULL; - } -} - -void SectorObject::setShape( const Ogre::String & meshname ){ - try { - entity_ = sceneMgr_->createEntity( name_, meshname ); - } catch( Ogre::Exception & e ){ - LogManager::getSingleton().warn( e.what() ); - entity_ = NULL; - return ; - } catch( ... ){ - LogManager::getSingleton().warn( "Unknown exception" ); - entity_ = NULL; - return ; - } - - mainNodeEntityRot_->attachObject( entity_ ); - if ( ResourceManager::getSingleton().collisionManager ){ - ResourceManager::getSingleton().collisionManager->createObject( this ); - } -} - -void SectorObject::setBaseRot( const Ogre::Real & yaw, const Ogre::Real & pitch, const Ogre::Real & roll ){ - if ( fabs( yaw ) >1e-4 ||fabs( pitch ) >1e-4 || fabs( roll ) >1e-4 ){ - std::cout << "SectorObject::setBaseRot " << name_ << yaw - << " " << pitch << " " << roll << std::endl; - - mainNodeEntityRot_->yaw( Ogre::Degree( yaw ) ); - mainNodeEntityRot_->pitch( Ogre::Degree( pitch ) ); - mainNodeEntityRot_->roll( Ogre::Degree( roll ) ); - } -} - -void SectorObject::scale( const Ogre::Vector3 & scale ){ - std::cout << "SectorObject::scale " << name_ << scale << std::endl; - mainNodeEntityScale_->scale( scale ); - baseSize_ = scale * ( entity_->getBoundingBox().getMaximum() - entity_->getBoundingBox().getMinimum() ); -} - -void SectorObject::setBaseSize( const Ogre::Vector3 & size ){ - if ( size == Ogre::Vector3::ZERO ) return; - - /* Ogre::Vector3 oldSize( mainNodeEntityRot_->getOrientation() * ( - mainNodeEntityRot_->_getWorldAABB().getMaximum()- - mainNodeEntityRot_->_getWorldAABB().getMinimum() ) ); - */ - Ogre::Vector3 oldSize( entity_->getBoundingBox().getMaximum()- entity_->getBoundingBox().getMinimum() ); - - Ogre::Vector3 scale( size / oldSize ); - - scale[ 0 ] = fabs( scale[ 0 ] ); - scale[ 1 ] = fabs( scale[ 1 ] ); - scale[ 2 ] = fabs( scale[ 2 ] ); - - if ( scale[ 0 ] == 0.0 && scale[ 1 ] == 0.0 && scale[ 2 ] != 0.0) { - scale[ 0 ] = scale[ 2 ]; scale[ 1 ] = scale[ 2 ]; - } - if ( scale[ 0 ] == 0.0 && scale[ 1 ] != 0.0 && scale[ 2 ] == 0.0) { - scale[ 0 ] = scale[ 1 ]; scale[ 2 ] = scale[ 1 ]; - } - if ( scale[ 0 ] != 0.0 && scale[ 1 ] == 0.0 && scale[ 2 ] == 0.0) { - scale[ 2 ] = scale[ 0 ]; scale[ 1 ] = scale[ 0 ]; - } - - std::cout << name_ << std::endl; - std::cout << "sol: " << size << std::endl; - std::cout << "ist: " << oldSize << std::endl; - std::cout << scale << std::endl; - - std::cout << mainNodeEntityRot_->_getWorldAABB().getMaximum() << " " << - mainNodeEntityRot_->_getWorldAABB().getMinimum() << " " << - mainNodeEntityRot_->_getWorldAABB().getMaximum()-mainNodeEntityRot_->_getWorldAABB().getMinimum() - << std::endl; - - std::cout << entity_->getBoundingBox().getMaximum()- entity_->getBoundingBox().getMinimum() << std::endl; - - std::cout << mainNodeEntityRot_->getOrientation() * ( entity_->getBoundingBox().getMaximum()- - entity_->getBoundingBox().getMinimum() ) << std::endl; - - std::cout << mainNode_->_getWorldAABB().getMaximum() - mainNode_->_getWorldAABB().getMinimum() << std::endl; - std::cout << mainNode_->_getDerivedScale() << std::endl; - - mainNodeEntityScale_->scale( scale ); - baseSize_ = size; - baseScale_ = scale; -} - -void SectorObject::setTarget( SectorObject * target ){ - if ( target_ ) this->looseTarget( ); - - if ( target ){ - target_ = target; - target_->addObserver( this ); - } -} - -void SectorObject::looseTarget( ){ - if ( target_ ){ - target_->delObserver( this ); - target_ = NULL; - } -} - -void SectorObject::unsubscribeToObservers(){ - //std::cout << "SectorObject::unsubscribeToObservers(): " << name_ << " " << observers_.size() << std::endl; - for ( std::set < SectorObject * >::iterator it = observers_.begin(); it != observers_.end();){ - (*it++)->looseTarget( ); - } - - //std::cout << "SectorObject::unsubscribeToObservers(): " << observers_.size() << std::endl; -} - - -} // namespace OpenGate Deleted: trunk/src/SectorObject.h =================================================================== --- trunk/src/SectorObject.h 2009-12-21 18:33:14 UTC (rev 1158) +++ trunk/src/SectorObject.h 2009-12-21 22:41:44 UTC (rev 1159) @@ -1,120 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 _OPENGATE_SECTOROBJECT__H -#define _OPENGATE_SECTOROBJECT__H - -#include "Opengate.h" - -#include "BaseObject.h" -#include <OgreVector3.h> - -namespace OpenGate{ - -class SectorObject : public BaseObject { -public: - /*! Constructor for the base class. The Object need an unique name and ptr to the sector */ - SectorObject( const Ogre::String & name, Sector * sector, Uint32 userID = 0, Uint8 childID = 0 ); - - /*! Default destructor */ - virtual ~SectorObject(); - - /*! Runtime identification */ - inline virtual long rtti() const { return SECTOROBJECT_RTTI; } - - /*! */ - virtual bool update( Ogre::Real elapsedTime ){ return true; } - - /*! */ - virtual void collide( BaseObject * object ){ - // std::cout << "SectorObject " << name_ << " collide with " << object->rtti() << " " << object->name()<< std::endl; - } - - /*! Returns a pointer to the active sector*/ - Sector * sector() { return sector_; } - - Ogre::SceneNode * rotNode() { return mainNodeEntityRot_;} - - Ogre::SceneNode * scaleNode() { return mainNodeEntityScale_;} - - void setShape( const Ogre::String & meshname ); - - virtual Ogre::Entity * entity(){ return entity_; } - - void scale( const Ogre::Vector3 & scale ); - - void setBaseSize( const Ogre::Vector3 & targetSize ); - void setBaseRot( const Ogre::Real & yaw, const Ogre::Real & pitch = 0, const Ogre::Real & roll = 0 ); - - Ogre::Vector3 baseSize( ) const { return baseSize_; } - Ogre::Real maxBaseSize( ) const { return max( max( baseSize_[0], baseSize_[1] ), baseSize_[2] ); } - - bool isOnRadar() const { return isOnRadar_; } - void onRadar( bool onradar ) { isOnRadar_ = onradar; } - - virtual Ogre::Vector3 velocity() const { return Ogre::Vector3(0.0, 0.0, 0.0 ); } - - Ogre::OverlayElement * dotA() { return dotA_; } - Ogre::OverlayElement * dotB() { return dotB_; } - - /*! Add an object to the set of observers e.g. selected as target, dot on radar. - When this object dies the observers have to informed. */ - inline virtual void addObserver( SectorObject * obj ){ observers_.insert( obj ); } - - /*! Remove observer from, e.g. lost on radar, deselect as target */ - inline virtual void delObserver( SectorObject * obj ){ observers_.erase( obj ); } - - /*! Set Object as target, used for missiles, and avatar. This object becomes an observer for the target. */ - virtual void setTarget( SectorObject * target ); - - /*! The Object is not longer a target */ - virtual void looseTarget( ); - - /*! Return the current target. */ - virtual SectorObject * target( ){ return target_; } - - /*! unsubscribe this object from all objects that observe this object */ - void unsubscribeToObservers(); - -protected: - - virtual void inititialize_(); - - SectorObject * target_; - Ogre::Entity * entity_; - - Ogre::SceneNode * mainNodeEntityScale_; // Main character node for base size - Ogre::SceneNode * mainNodeEntityRot_; // Main character node for base rotation - - Ogre::OverlayElement * dotA_; - Ogre::OverlayElement * dotB_; - - bool isOnRadar_; - Ogre::Vector3 baseSize_; - Ogre::Vector3 baseScale_; - - std::set < SectorObject * > observers_; // better listener / e.g. radar -}; - -} //namespace OpenGate - -#endif - - Deleted: trunk/src/SectorObjectAvatar.cpp =================================================================== --- trunk/src/SectorObjectAvatar.cpp 2009-12-21 18:33:14 UTC (rev 1158) +++ trunk/src/SectorObjectAvatar.cpp 2009-12-21 22:41:44 UTC (rev 1159) @@ -1,166 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by OpenGate development team * - * spo...@us... * - * * - * 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 "SectorObjectAvatar.h" - -#include "GunObject.h" -#include "Equipment.h" -#include "Sector.h" -#include "Vessel.h" - -#include <OgreSceneManager.h> -#include <OgreEntity.h> -#include <OpenALSoundManager.h> - -namespace OpenGate{ - -SectorObjectAvatar::SectorObjectAvatar( const Ogre::String & name, Sector * sector, Uint32 userID, Vessel * vessel ) - : SectorObjectVessel( name, sector, userID, 0, vessel ) { - - thrustRate_ = 0; - - maxCapacity_ = 0; - if ( this->vessel()->capacitor() ) maxCapacity_ = this->vessel()->capacitor()->capacity(); - capacity_ = maxCapacity_; - - targetArrowNode_ = NULL; - flightArrowNode_ = NULL; - forceMovement_ = false; - thrustChange_ = 0.0; - - targetArrowNode_ = mainNode_->createChildSceneNode( name_ + "_TargetArrow" ); - Ogre::SceneNode * targetArrowTrans = targetArrowNode_->createChildSceneNode( name_ + "_TargetArrow_trans" ); - Ogre::Entity *targetArrowEntity = sceneMgr_->createEntity( name_ + "_TargetArrow_entity", "arrow.mesh" ); - targetArrowEntity->setMaterialName( "SimpleHUD/TargetArrow" ); - targetArrowTrans->attachObject( targetArrowEntity ); - targetArrowTrans->pitch( Ogre::Degree( -90 ) ); - targetArrowTrans->scale( 0.01, 0.01, 0.01 ); - targetArrowNode_->setPosition( 0.0, -0.1, -1.2 ); - targetArrowNode_->setOrientation( mainNode_->getOrientation() ); - - flightArrowNode_ = mainNode_->createChildSceneNode( name_ + "_FlightArrow" ); - Ogre::SceneNode * flightArrowTrans = flightArrowNode_->createChildSceneNode( name_ + "_FlightArrow_trans" ); - Ogre::Entity *flightArrowEntity = sceneMgr_->createEntity( name_ + "_FlightArrow_entity", "arrow.mesh" ); - flightArrowEntity->setMaterialName( "SimpleHUD/FlightArrow" ); - flightArrowTrans->attachObject( flightArrowEntity ); - flightArrowTrans->pitch( Ogre::Degree( -90 ) ); - flightArrowTrans->scale( 0.01, 0.01, 0.01 ); - flightArrowNode_->setPosition( 0.0, 0.1, -1.2 ); - flightArrowNode_->setOrientation( mainNode_->getOrientation() ); - - Ogre::Light * l = sceneMgr_->createLight("AvatarLight" ); - l->setDiffuseColour( Ogre::ColourValue(1.0, 1.0, 1.0) ); - l->setSpecularColour( Ogre::ColourValue(1.0, 1.0, 1.0) ); - l->setVisible( false ); - lightNode_ = mainNode_->createChildSceneNode( "AvatarLightNode" ); - lightNode_->translate(50,0,10); - lightNode_->attachObject( l ); - - if ( OpenALSoundManager::getSingleton().listener() ){ - soundListener_ = OpenALSoundManager::getSingleton().listener(); - } -} - -SectorObjectAvatar::~SectorObjectAvatar(){ - if ( flightArrowNode_ ){ - sceneMgr_->destroyEntity( name_ + "_FlightArrow_entity" ); - flightArrowNode_->removeAndDestroyChild( name_ + "_FlightArrow_trans" ); - mainNode_->removeAndDestroyChild( flightArrowNode_->getName() ); - } - if ( targetArrowNode_ ){ - sceneMgr_->destroyEntity( name_ + "_TargetArrow_entity" ); - targetArrowNode_->removeAndDestroyChild( name_ + "_TargetArrow_trans" ); - mainNode_->removeAndDestroyChild( targetArrowNode_->getName() ); - } - - sceneMgr_->destroyLight( "AvatarLight" ); - - if ( lightNode_ ){ - mainNode_->removeAndDestroyChild( lightNode_->getName() ); - } -} - -void SectorObjectAvatar::collide( BaseObject * object ){ - if ( name_ != object->name() ){ - SectorObjectMovable::collide( object ); - // if ( object->getTypeID( ) == PROJECTILE_RTTI ){ - // hitByProjectile( dynamic_cast< Projectile* >( object ) ); - // return; - // } - // std::cout << "Avatar " << name_ << " collide with " << object->getTypeID() << " " << object->name() << std::endl; - } -} - -void SectorObjectAvatar::decrementThrust( bool pressed ){ - if ( pressed ){ - thrustChange_ = -1.0; - } else { - thrustChange_ = 0.0; - } -} - -void SectorObjectAvatar::incrementThrust( bool pressed ){ - if ( pressed ){ - thrustChange_ = 1.0; - } else { - thrustChange_ = 0.0; - } -} - -bool SectorObjectAvatar::update( Ogre::Real elapsedTime ){ - - //** just for key autorepeat - thrustRate_ += (thrustChange_ * 0.5f * elapsedTime); - thrustRate_ = max( thrustRate_, 0.0f ); - thrustRate_ = min( 1.0f, thrustRate_ ); - if ( thrustChange_ != 0.0 ) updateThruster(); - - if ( soundListener_ ){ - soundListener_->setPosition( mainNode_->_getDerivedPosition() ); - soundListener_->setVelocity( vel_ ); - soundListener_->setOrientation( mainNode_->_getDerivedOrientation().zAxis(), - mainNode_->_getDerivedOrientation().yAxis() ); - } - return SectorObjectVessel::update( elapsedTime ); -} - -void SectorObjectAvatar::reset( ){ - deathSequence_ = false; - mainNode_->showBoundingBox( false ); - setShield( maxShield() ); - setArmor( this->vessel()->armor() ); - setThrustRate( 0.0 ); -} - -void SectorObjectAvatar::setVisible( bool visible ){ - mainNodeEntityScale_->setVisible( visible ); -} - -bool SectorObjectAvatar::deathSequence( Ogre::Real elapsedTime ){ - // if ( !deathSequence_ ){ sector_->avatarDied( ); } - return SectorObjectMovable::deathSequence( elapsedTime ); -} - -Ogre::Real SectorObjectAvatar::ammoSpeed() const { - if ( activeGuns_.size() > 0) return (*activeGuns_.begin() )->gun()->speed(); - return 0.0; -} - -} // namespace OpenGate{ Deleted: trunk/src/SectorObjectAvatar.h =================================================================== --- trunk/src/SectorObjectAvatar.h 2009-12-21 18:33:14 UTC (rev 1158) +++ trunk/src/SectorObjectAvatar.h 2009-12-21 22:41:44 UTC (rev 1159) @@ -1,93 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * 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 _OPENGATE_SECTOROBJECTAVATAR__H -#define _OPENGATE_SECTOROBJECTAVATAR__H - -#include "SectorObjectVessel.h" - -#include <OgreSceneNode.h> - -namespace OpenGate{ - -class OpenALListener; - -class SectorObjectAvatar : public SectorObjectVessel { -public: - SectorObjectAvatar( const Ogre::String & name, Sector * sector, Uint32 userID, Vessel * vessel ); - - virtual ~SectorObjectAvatar(); - - inline virtual long rtti() const { return AVATAR_RTTI; } - - virtual bool update( Ogre::Real elapsedTime ); - - virtual void collide( BaseObject * object ); - - virtual void reset( ); - - virtual void setVisible( bool visible ); - - inline void setFirePressed( bool fireStatus ){ - if ( fireStatus != firePressed_ ) statusChanged_ = true; - firePressed_ = fireStatus; - } - - inline bool firePressed( ) const { return firePressed_; } - - Ogre::Real ammoSpeed() const; - - virtual bool deathSequence( Ogre::Real elapsedTime ); - - Ogre::SceneNode * targetArrow() { return targetArrowNode_; } - - Ogre::SceneNode * flightArrow() { return flightArrowNode_; } - - void decrementThrust( bool pressed ); - - void incrementThrust( bool pressed ); - - virtual Uint32 thrust() const { - double thrust = thrust_; - if ( afterburnerPressed_ ) thrust *= 1.3; - if ( flashfire_ ) thrust *= 10; - return (Uint32)rint( thrust ); - } - - virtual bool isChild() const { return false; } - - inline Ogre::Real capacityRate() const { - if ( maxCapacity_ > 0 ) return (float)capacity_ / maxCapacity_; else return 0; - } - -protected: - Ogre::Real thrustChange_; - Ogre::SceneNode * targetArrowNode_; - Ogre::SceneNode * flightArrowNode_; - Ogre::SceneNode * lightNode_; - - OpenALListener * soundListener_; -}; - -} //namespace OpenGate - -#endif - - Deleted: trunk/src/SectorObjectMissile.cpp =================================================================== --- trunk/src/SectorObjectMissile.cpp 2009-12-21 18:33:14 UTC (rev 1158) +++ trunk/src/SectorObjectMissile.cpp 2009-12-21 22:41:44 UTC (rev 1159) @@ -1,174 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by OpenGate development team * - * spo...@us... * - * * - * 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 "SectorObjectMissile.h" -#include "OpcodeWrapper.h" -#include "Missile.h" -#include "Vessel.h" -#include "ResourceManager.h" - -#include <OgreParticleSystem.h> -#include <OgreParticleEmitter.h> -#include <OgreSceneManager.h> -#include <OgreRibbonTrail.h> - -namespace OpenGate{ - -SectorObjectMissile::SectorObjectMissile( const Ogre::String & name, Sector * sector, - Uint32 userID, Uint8 childID, Missile * missle ) - : SectorObjectMovable( name, sector, userID, childID, missle ), launched_( false ), thrustTrailNode_( NULL ){ - - Ogre::ParticleEmitter *pEmit = thrusterParticles_->addEmitter( "Point" ); - pEmit->setDirection( mainNode_->getOrientation().zAxis() ); - //engineMountPoints[ i ] - pEmit->setPosition( mainNodeEntityRot_->getOrientation() * Ogre::Vector3( 0.0, 0.0, 0.5 ) ); - pEmit->setColour( Ogre::ColourValue::Blue, Ogre::ColourValue::Green ); - - inititialize_(); -} - -SectorObjectMissile::~SectorObjectMissile(){ - // std::cout << "SectorObjectMissile::~SectorObjectMissile() " << name_ << " " << target_ << " " <<observers_.size() << std::endl; - thrustTrailNode_->detachObject( thrustTrail_ ); - sceneMgr_->getRootSceneNode()->removeAndDestroyChild( thrustTrailNode_->getName() ); - sceneMgr_->destroyRibbonTrail( thrustTrail_ ); - thrustTrailNode_ = NULL; - thrustTrail_ = NULL; - -} - -Missile * SectorObjectMissile::missile(){ return dynamic_cast < Missile * > ( movable_ ); } - -void SectorObjectMissile::inititialize_(){ - maxThrust_ = this->missile()->thrust(); - maxSpeed_ = movable_->maxSpeed(); - setThrustRate( 0.0 ); - setMass( movable_->mass() ); -} - -bool SectorObjectMissile::update( Ogre::Real elapsedTime ){ - if ( launched_ && !destroyRequest_) { - if ( target_ != NULL && elapsedTime > 1e-4 ) { - - Ogre::Vector3 currDir = mainNode_->_getDerivedOrientation() * Ogre::Vector3::NEGATIVE_UNIT_Z; - currDir.normalise(); - Ogre::Vector3 targetPos( target_->mainNode()->_getDerivedPosition() ); - - double timeToTarget= (targetPos - mainNode_->_getDerivedPosition() ).length() / speed(); - - if ( target_->rtti() == SECTOROBJECTMOVABLE_RTTI || - target_->rtti() == SECTOROBJECTVESSEL_RTTI || - target_->rtti() == SECTOROBJECTMISSILE_RTTI ){ - targetPos += dynamic_cast< SectorObjectMovable *>( target_ )->velocity() * timeToTarget; - } - - Ogre::Vector3 targetDir( targetPos - mainNode_->_getDerivedPosition() ); - targetDir.normalise(); - - Ogre::Degree yawTo; - Ogre::Degree pitchTo; - Ogre::Degree rollTo; - - if ( ( currDir + targetDir ).squaredLength() < 0.00005f ){ - //** fix gimbal look - yawTo = 180; - } else { - - Ogre::Quaternion rot = currDir.getRotationTo( targetDir ); - rot.normalise(); - - Ogre::Vector3 srcUp = mainNode_->_getDerivedOrientation() * Ogre::Vector3::NEGATIVE_UNIT_Y; - srcUp.normalise(); - - Ogre::Vector3 targetUp = target_->mainNode()->getOrientation() * Ogre::Vector3::NEGATIVE_UNIT_Y; - targetUp.normalise(); - - Ogre::Quaternion rotUp = srcUp.getRotationTo( targetUp ); - - // rot = rot * rotUp; - - yawTo = rot.getYaw(); - pitchTo = rot.getPitch(); - rollTo = rot.getRoll(); - } - Ogre::Real rotFric = 1.0; - - Ogre::Real scaledYaw = yawTo.valueDegrees() / ( elapsedTime * rotFric * movable_->yaw() ); - Ogre::Real scaledPitch = pitchTo.valueDegrees() / ( elapsedTime * rotFric * movable_->pitch() ); - // Ogre::Real scaledRoll = rollTo.valueDegrees() / ( elapsedTime * rotFric * moveable_->yaw() ); - - yaw_ = max( -1.0f, scaledYaw ); yaw_ = min( yaw_, 1.0f ); - pitch_ = max( -1.0f, scaledPitch ); pitch_ = min( pitch_, 1.0f ); - // roll_ = max( -1.0f, scaledRoll ); roll_ = min( roll_, 1.0f ); - } - missileLifetime_ -= elapsedTime; - } - - if (... [truncated message content] |
From: <spo...@us...> - 2009-12-21 18:33:26
|
Revision: 1158 http://opengate.svn.sourceforge.net/opengate/?rev=1158&view=rev Author: spom_spom Date: 2009-12-21 18:33:14 +0000 (Mon, 21 Dec 2009) Log Message: ----------- opengate-client: keybindings can now be altered via config-window Modified Paths: -------------- trunk/data/gui/looknfeel/opengateButtons.looknfeel trunk/data/gui/schemes/opengate.scheme trunk/src/BaseDialog.cpp trunk/src/ConfigDialog.cpp trunk/src/ConfigDialog.h trunk/src/Console.cpp trunk/src/KeyMap.cpp trunk/src/KeyMap.h trunk/src/ResourceManager.h Modified: trunk/data/gui/looknfeel/opengateButtons.looknfeel =================================================================== --- trunk/data/gui/looknfeel/opengateButtons.looknfeel 2009-12-20 23:46:01 UTC (rev 1157) +++ trunk/data/gui/looknfeel/opengateButtons.looknfeel 2009-12-21 18:33:14 UTC (rev 1158) @@ -497,95 +497,121 @@ </Layer> </StateImagery> </WidgetLook> + <!-- *************************************************** opengate/Editbox *************************************************** --> - <WidgetLook name="opengate/Editbox"> - <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" /> - <PropertyDefinition name="SelectedTextColour" initialValue="FF000000" redrawOnWrite="true" /> - <PropertyDefinition name="ActiveSelectionColour" initialValue="FF607FFF" redrawOnWrite="true" /> - <PropertyDefinition name="InactiveSelectionColour" initialValue="FF808080" redrawOnWrite="true" /> - <Property name="MouseCursorImage" value="set:opengate image:MouseTextBar" /> - <NamedArea name="TextArea"> - <Area> - <Dim type="LeftEdge" ><AbsoluteDim value="5" /></Dim> - <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim> - <Dim type="RightEdge" ><UnifiedDim scale="1.0" offset="-5" type="RightEdge" /></Dim> - <Dim type="BottomEdge" ><UnifiedDim scale="1.0" offset="-3" type="BottomEdge" /></Dim> - </Area> - </NamedArea> - <ImagerySection name="container_normal"> - <FrameComponent> - <Area> - <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> - <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> - <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim> - <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim> - </Area> - <Image type="LeftEdge" imageset="opengate" image="EditBoxLeft" /> - <Image type="RightEdge" imageset="opengate" image="EditBoxRight" /> - <Image type="Background" imageset="opengate" image="EditBoxMiddle" /> - </FrameComponent> - </ImagerySection> - <ImagerySection name="selection"> - <ImageryComponent> - <Area> - <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> - <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> - <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim> - <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim> - </Area> - <Image imageset="opengate" image="TextSelectionBrush" /> - <VertFormat type="Stretched" /> - <HorzFormat type="Stretched" /> - </ImageryComponent> - </ImagerySection> - <ImagerySection name="Carat"> - <ImageryComponent> - <Area> - <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> - <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> - <Dim type="Width" ><ImageDim imageset="opengate" image="EditBoxCarat" dimension="Width" /></Dim> - <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim> - </Area> - <Image imageset="opengate" image="EditBoxCarat" /> - <VertFormat type="Stretched" /> - <HorzFormat type="Stretched" /> - </ImageryComponent> - </ImagerySection> - <StateImagery name="Enabled"> - <Layer> - <Section section="container_normal" /> - </Layer> - </StateImagery> - <StateImagery name="ReadOnly"> - <Layer> - <Section section="container_normal" /> - </Layer> - </StateImagery> - <StateImagery name="Disabled"> - <Layer> - <Section section="container_normal"> - <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> - </Section> - </Layer> - </StateImagery> - <StateImagery name="ActiveSelection"> - <Layer> - <Section section="selection"> - <ColourProperty name="ActiveSelectionColour" /> - </Section> - </Layer> - </StateImagery> - <StateImagery name="InactiveSelection"> - <Layer> - <Section section="selection"> - <ColourProperty name="InactiveSelectionColour" /> - </Section> - </Layer> - </StateImagery> +<!-- + PropertyDefinition specifications (optional, defaults will be black): + + * NormalTextColour - property that accesses a colour value to be used to render normal unselected text. + * SelectedTextColour - property that accesses a colour value to be used to render selected text. +--> + <WidgetLook name="opengate/Editbox"> + <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" /> + <PropertyDefinition name="SelectedTextColour" initialValue="FF000000" redrawOnWrite="true" /> + <PropertyDefinition name="ActiveSelectionColour" initialValue="FF607FFF" redrawOnWrite="true" /> + <PropertyDefinition name="InactiveSelectionColour" initialValue="FF808080" redrawOnWrite="true" /> + <Property name="MouseCursorImage" value="set:opengate image:MouseTextBar" /> + +<!-- + NamedArea definitions: + + * TextArea - Defines the area where the text, carat, and any selection imagery will appear. +--> + <NamedArea name="TextArea"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="5" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim> + <Dim type="RightEdge" ><UnifiedDim scale="1.0" offset="-5" type="RightEdge" /></Dim> + <Dim type="BottomEdge" ><UnifiedDim scale="1.0" offset="-3" type="BottomEdge" /></Dim> + </Area> + </NamedArea> + + <ImagerySection name="container_normal"> + <FrameComponent> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim> + </Area> + <Image type="LeftEdge" imageset="opengate" image="EditBoxLeft" /> + <Image type="RightEdge" imageset="opengate" image="EditBoxRight" /> + <Image type="Background" imageset="opengate" image="EditBoxMiddle" /> + </FrameComponent> + </ImagerySection> + <ImagerySection name="selection"> + <ImageryComponent> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim> + <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim> + </Area> + <Image imageset="opengate" image="TextSelectionBrush" /> + <VertFormat type="Stretched" /> + <HorzFormat type="Stretched" /> + </ImageryComponent> + </ImagerySection> + <ImagerySection name="Carat"> + <ImageryComponent> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><ImageDim imageset="opengate" image="EditBoxCarat" dimension="Width" /></Dim> + <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim> + </Area> + <Image imageset="opengate" image="EditBoxCarat" /> + <VertFormat type="Stretched" /> + <HorzFormat type="Stretched" /> + </ImageryComponent> + </ImagerySection> +<!-- +StateImagery: + * Enabled - Imagery used when widget is enabled. + * Disabled - Imagery used when widget is disabled. + * ReadOnly - Imagery used when widget is in 'Read Only' state. + * ActiveSelection - Additional imagery used when a text selection is defined and the widget is active. The imagery for this state will be rendered within the selection area. + * InactiveSelection - Additional imagery used when a text selection is defined and the widget is not active. The imagery for this state will be rendered within the selection area. + --> + <StateImagery name="Enabled"> + <Layer> + <Section section="container_normal" /> + </Layer> + </StateImagery> + + <StateImagery name="Disabled"> + <Layer> + <Section section="container_normal"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + + <StateImagery name="ReadOnly"> + <Layer> + <Section section="container_normal" /> + </Layer> + </StateImagery> + + <StateImagery name="ActiveSelection"> + <Layer> + <Section section="selection"> + <ColourProperty name="ActiveSelectionColour" /> + </Section> + </Layer> + </StateImagery> + + <StateImagery name="InactiveSelection"> + <Layer> + <Section section="selection"> + <ColourProperty name="InactiveSelectionColour" /> + </Section> + </Layer> + </StateImagery> </WidgetLook> <!-- Modified: trunk/data/gui/schemes/opengate.scheme =================================================================== --- trunk/data/gui/schemes/opengate.scheme 2009-12-20 23:46:01 UTC (rev 1157) +++ trunk/data/gui/schemes/opengate.scheme 2009-12-21 18:33:14 UTC (rev 1158) @@ -42,12 +42,28 @@ <!-- opengateStatic.looknfeel --> + <!-- + new and renovated + --> <FalagardMapping WindowType="opengate/StaticFrame" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="opengate/StaticFrame" /> <FalagardMapping + WindowType="opengate/StaticTextLabel" + TargetType="DefaultWindow" + Renderer="Falagard/Default" + LookNFeel="opengate/StaticTextLabel" /> + <FalagardMapping + WindowType="opengate/Editbox" + TargetType="CEGUI/Editbox" + Renderer="Falagard/Editbox" + LookNFeel="opengate/Editbox"/> + <!-- + new and renovated + --> + <FalagardMapping WindowType="opengate/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" @@ -72,11 +88,7 @@ TargetType="DefaultWindow" Renderer="Falagard/StaticText" LookNFeel="opengate/StaticText" /> - <FalagardMapping - WindowType="opengate/StaticTextLabel" - TargetType="DefaultWindow" - Renderer="Falagard/Default" - LookNFeel="opengate/StaticTextLabel" /> + <FalagardMapping WindowType="opengate/StaticLabel" TargetType="CEGUI/PushButton" @@ -126,11 +138,6 @@ Renderer="Falagard/SystemButton" LookNFeel="opengate/ConsoleScrollButtonDown" /> <FalagardMapping - WindowType="opengate/Editbox" - TargetType="CEGUI/Editbox" - Renderer="Falagard/Editbox" - LookNFeel="opengate/Editbox"/> - <FalagardMapping WindowType="opengate/ConsoleEditbox" TargetType="CEGUI/Editbox" Renderer="Falagard/Editbox" Modified: trunk/src/BaseDialog.cpp =================================================================== --- trunk/src/BaseDialog.cpp 2009-12-20 23:46:01 UTC (rev 1157) +++ trunk/src/BaseDialog.cpp 2009-12-21 18:33:14 UTC (rev 1158) @@ -35,7 +35,7 @@ for ( unsigned int i = 0; i < parent->getChildCount(); i ++ ){ // std::cout << i << "accessing: "<< parent->getName() << std::endl; CEGUI::Window * child = parent->getChildAtIdx( i ); - child->rename( namePrefix + child->getName() ); + CEGUI::WindowManager::getSingleton().renameWindow( child , namePrefix + child->getName() ); renameClonedWindows( child, namePrefix ); } } Modified: trunk/src/ConfigDialog.cpp =================================================================== --- trunk/src/ConfigDialog.cpp 2009-12-20 23:46:01 UTC (rev 1157) +++ trunk/src/ConfigDialog.cpp 2009-12-21 18:33:14 UTC (rev 1158) @@ -22,9 +22,11 @@ #include "common.h" #include "GameStateManager.h" #include "KeyMap.h" +#include "LogManager.h" #include <CEGUI/CEGUIWindowManager.h> #include <CEGUI/elements/CEGUIPushButton.h> +#include <CEGUI/elements/CEGUIEditbox.h> #include <CEGUI/elements/CEGUIListbox.h> #include <CEGUI/elements/CEGUIListboxTextItem.h> @@ -63,16 +65,12 @@ } bool ConfigDialog::handleControlsButton_( const CEGUI::EventArgs & e ){ - //std::cout << "ConfigDialog::handleConfigButton_( const CEGUI::EventArgs & e ){" << std::endl; -// CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"Config/ControlSubFrame/Title" ) -// ->setProperty("Text", "" ); - activeWindow_ = static_cast<CEGUI::Listbox*>( CEGUI::WindowManager::getSingleton().getWindow( "Config/Controls" ) ); - KeyMap::KeyBindings keyBindings = resources_->keymap()->unDockedKeyBindings(); + KeyMap::KeyBindingsMap keyBindings = resources_->keymap()->unDockedKeyBindings(); uint count = 0; - for ( KeyMap::KeyBindings::iterator it = keyBindings.begin(); it != keyBindings.end(); it ++ ){ + for ( KeyMap::KeyBindingsMap::iterator it = keyBindings.begin(); it != keyBindings.end(); it ++ ){ CEGUI::Window *b; if ( CEGUI::WindowManager::getSingleton().isWindowPresent( activeWindow_->getName() + it->first ) ){ @@ -100,6 +98,7 @@ bool ConfigDialog::handleControlsCategoryButton_( const CEGUI::EventArgs & e ){ const CEGUI::WindowEventArgs & we = static_cast< const CEGUI::WindowEventArgs & >( e ); std::string category( we.window->getText().c_str() ); + fillControlsWindow_( category ); return true; } @@ -107,13 +106,18 @@ void ConfigDialog::fillControlsWindow_( const std::string & category ){ CEGUI::Window * window = CEGUI::WindowManager::getSingleton().getWindow( "Config/Controls/Body" ); + std::vector <CEGUI::Window *> removeList; for ( uint i = 0; i < window->getChildCount(); i ++ ) { - CEGUI::WindowManager::getSingleton().destroyWindow( window->getChildAtIdx( i ) ); + removeList.push_back( window->getChildAtIdx( i ) ); } + for ( uint i = 0; i < removeList.size(); i ++ ) { + CEGUI::WindowManager::getSingleton().destroyWindow( removeList[ i ] ); + } //window->show(); std::map < std::string, std::pair< uint, uint > > keyBindings( resources_->keymap()->unDockedKeyBindings()[ category ] ); uint count = 0; + double x = 0.0, y; for ( std::map < std::string, std::pair< uint, uint > >::iterator it = keyBindings.begin(); it != keyBindings.end(); it ++ ){ std::string keyName( it->first ); @@ -125,11 +129,17 @@ b->show(); } else { b = CEGUI::WindowManager::getSingleton().loadWindowLayout( "dialogs/ConfigControlKey.layout" ); - b->rename( keyWindowName ); + CEGUI::WindowManager::getSingleton().renameWindow( b, keyWindowName ); renameClonedWindows( b, keyWindowName ); window->addChildWindow( b ); - b->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0, 0.0 ), CEGUI::UDim( 0.0, count * 30 ) ) ); + + y = count * 30.0; + if ( y > window->getPixelSize().d_height - 30.0 ){ + x = b->getPixelSize().d_width + 10; y = 0.0; + count = 0; + } + b->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0, x ), CEGUI::UDim( 0.0, y ) ) ); CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/Name" )->setProperty( "Text", keyName ); CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton1" )->setProperty( "Text", @@ -137,13 +147,38 @@ CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton2" )->setProperty( "Text", resources_->keymap()->keycodeName( it->second.second ) ); - count ++; - + BIND_CEGUI_EVENT( CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton1" ), + CEGUI::PushButton::EventKeyDown, ConfigDialog::handleControlsKey1Button_ ); + BIND_CEGUI_EVENT( CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton2" ), + CEGUI::PushButton::EventKeyDown, ConfigDialog::handleControlsKey2Button_ ); } + count ++; b->show(); } } +bool ConfigDialog::handleControlsKeyButton_( const CEGUI::EventArgs & e, uint key ){ + const CEGUI::WindowEventArgs & we = static_cast< const CEGUI::WindowEventArgs & >( e ); + CEGUI::Window *b = we.window->getParent(); + + uint keycode = resources_->keymap()->lastKeycode(); + if ( resources_->keymap()->lastKeycode() == OIS::KC_ESCAPE ) return true; + + if ( !resources_->keymap()->haveKeyBinding( keycode ) ){ + CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton" + toStr( key ) )->setProperty( "Text", + resources_->keymap()->keycodeName( keycode ) ); + + + resources_->keymap()->setKeyBinding( CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/Name" )->getProperty( "Text").c_str(), keycode, key ); + } else { + resources_->log().warn( "there is allready a binding for " + resources_->keymap()->keycodeName( keycode ) ); + } + + + return true; +} + + bool ConfigDialog::handleCreditsButton_( const CEGUI::EventArgs & e ){ //std::cout << "ConfigDialog::handleCreditsButton_( const CEGUI::EventArgs & e ){" << std::endl; CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"Config/Credits/Header" ) Modified: trunk/src/ConfigDialog.h =================================================================== --- trunk/src/ConfigDialog.h 2009-12-20 23:46:01 UTC (rev 1157) +++ trunk/src/ConfigDialog.h 2009-12-21 18:33:14 UTC (rev 1158) @@ -44,6 +44,10 @@ bool handleControlsButton_( const CEGUI::EventArgs & e ); bool handleControlsCategoryButton_( const CEGUI::EventArgs & e ); + inline bool handleControlsKey1Button_( const CEGUI::EventArgs & e ){ return handleControlsKeyButton_( e, 1 ); } + inline bool handleControlsKey2Button_( const CEGUI::EventArgs & e ){ return handleControlsKeyButton_( e, 2 ); } + bool handleControlsKeyButton_( const CEGUI::EventArgs & e, uint key ); + std::map < std::string, std::set < CEGUI::Window * > > controlKeys_; CEGUI::Window * lastActiveWindow_; Modified: trunk/src/Console.cpp =================================================================== --- trunk/src/Console.cpp 2009-12-20 23:46:01 UTC (rev 1157) +++ trunk/src/Console.cpp 2009-12-21 18:33:14 UTC (rev 1158) @@ -126,27 +126,27 @@ } bool Console::keyPressed( const OIS::KeyEvent & e ){ + if ( e.key == OIS::KC_LCONTROL) resources_->keymap()->setGlobalKeyModifier( KEY_CONTROL ); + if ( e.key == OIS::KC_RCONTROL) resources_->keymap()->setGlobalKeyModifier( KEY_CONTROL ); + if ( e.key == OIS::KC_LSHIFT) resources_->keymap()->setGlobalKeyModifier( KEY_SHIFT ); + if ( e.key == OIS::KC_RSHIFT) resources_->keymap()->setGlobalKeyModifier( KEY_SHIFT ); + resources_->keymap()->setLastKeycode( e.key ); - CEGUI::System::getSingleton().injectKeyDown( e.key ); - CEGUI::System::getSingleton().injectChar( e.text ); + CEGUI::System::getSingleton().injectKeyDown( e.key ); + CEGUI::System::getSingleton().injectChar( e.text ); - //** for testings - if ( e.key == OIS::KC_BACK && resources_->keymap()->globalKeyModifier( ) == KEY_CONTROL ){ - resources_->renderWindow->setFullscreen( true, + //** for testings + if ( e.key == OIS::KC_BACK && resources_->keymap()->globalKeyModifier( ) == KEY_CONTROL ){ + resources_->renderWindow->setFullscreen( true, resources_->renderWindow->getWidth(), resources_->renderWindow->getHeight() ); - // resources_->renderWindow->resize( 1280, 1024 ); - std::cout << "Fullscreen: " << resources_->renderWindow->isFullScreen() << std::endl; - } + // resources_->renderWindow->resize( 1280, 1024 ); + std::cout << "Fullscreen: " << resources_->renderWindow->isFullScreen() << std::endl; + } - if ( e.key == OIS::KC_LCONTROL) resources_->keymap()->setGlobalKeyModifier( KEY_CONTROL ); - if ( e.key == OIS::KC_RCONTROL) resources_->keymap()->setGlobalKeyModifier( KEY_CONTROL ); - if ( e.key == OIS::KC_LSHIFT) resources_->keymap()->setGlobalKeyModifier( KEY_SHIFT ); - if ( e.key == OIS::KC_RSHIFT) resources_->keymap()->setGlobalKeyModifier( KEY_SHIFT ); - - if ( (this->*resources_->keymap()->consoleKeyAction( e ))( true ) ) return true; + if ( (this->*resources_->keymap()->consoleKeyAction( e ))( true ) ) return true; - return true; + return true; } bool Console::keyReleased( const OIS::KeyEvent & e ){ Modified: trunk/src/KeyMap.cpp =================================================================== --- trunk/src/KeyMap.cpp 2009-12-20 23:46:01 UTC (rev 1157) +++ trunk/src/KeyMap.cpp 2009-12-21 18:33:14 UTC (rev 1158) @@ -66,17 +66,17 @@ registerUnDockedKeyAction_( "Radar", "Select previous target", &UnDockedState::keyActionSelectPreviousTarget, keycode_( OIS::KC_P ) ); - registerUnDockedKeyAction_( "Camera", "Normal", &UnDockedState::keyActionCameraNormal, + registerUnDockedKeyAction_( "Camera", "1 Normal", &UnDockedState::keyActionCameraNormal, keycode_( OIS::KC_1 ) ); - registerUnDockedKeyAction_( "Camera", "Look left", &UnDockedState::keyActionCameraLeft, + registerUnDockedKeyAction_( "Camera", "2 Look left", &UnDockedState::keyActionCameraLeft, keycode_( OIS::KC_2 ) ); - registerUnDockedKeyAction_( "Camera", "Look right", &UnDockedState::keyActionCameraRight, + registerUnDockedKeyAction_( "Camera", "3 Look right", &UnDockedState::keyActionCameraRight, keycode_( OIS::KC_3 ) ); - registerUnDockedKeyAction_( "Camera", "Look up", &UnDockedState::keyActionCameraUp, + registerUnDockedKeyAction_( "Camera", "4 Look up", &UnDockedState::keyActionCameraUp, keycode_( OIS::KC_4 ) ); - registerUnDockedKeyAction_( "Camera", "Look down", &UnDockedState::keyActionCameraDown, + registerUnDockedKeyAction_( "Camera", "5 Look down", &UnDockedState::keyActionCameraDown, keycode_( OIS::KC_5 ) ); - registerUnDockedKeyAction_( "Camera", "Toggle mode", &UnDockedState::keyActionCameraToggle, + registerUnDockedKeyAction_( "Camera", "6 Toggle mode", &UnDockedState::keyActionCameraToggle, keycode_( OIS::KC_6 ) ); /*! Actions for development, will removed later. */ @@ -125,6 +125,8 @@ void KeyMap::registerUnDockedKeyAction_( const std::string & category, const std::string & name, bool (UnDockedState::*action)( bool ), uint key1, uint key2 ){ unDockedKeyBindings_[ category ].insert( std::pair < std::string, std::pair < uint, uint > > ( name, std::pair< uint, uint >( key1, key2 ) ) ); + unDockedKeyActions_[ name ] = action; + unDockedActionMap_[ key1 ] = action; if ( key2 ) unDockedActionMap_[ key2 ] = action; } @@ -160,6 +162,39 @@ return name; } +bool KeyMap::haveKeyBinding( uint keycode ){ + if ( unDockedActionMap_.count( keycode ) || consoleActionMap_.count( keycode ) ){ + return true; + } + return false; +} + +void KeyMap::setKeyBinding( const std::string & name, uint keycode, uint key ){ + for ( KeyBindingsMap::iterator it = unDockedKeyBindings_.begin(); it != unDockedKeyBindings_.end(); it ++ ){ + std::map < std::string, std::pair< uint, uint > >::iterator keyBinding = it->second.find( name ); + if ( keyBinding != it->second.end() ){ + uint oldKeyCode = 0; + if ( key == 1 ){ + oldKeyCode = keyBinding->second.first; + keyBinding->second.first = keycode; + } else { + oldKeyCode = keyBinding->second.second; + keyBinding->second.second = keycode; + } + + if ( unDockedActionMap_.count( oldKeyCode ) ){ + unDockedActionMap_.erase( oldKeyCode ); + } + + unDockedActionMap_[ keycode ] = unDockedKeyActions_[ name ]; + std::cout << " KeyMap::setKeyBinding: " << name << "->" << keycodeName( keycode ) << std::endl; + break; + } else { + std::cerr << " KeyMap::setKeyBinding: no key action for " << name << " registered" << std::endl; + } + } +} + uint KeyMap::keycode_( uint key, GlobalKeyModifier modifier ){ return modifier * 65565 + key; } Modified: trunk/src/KeyMap.h =================================================================== --- trunk/src/KeyMap.h 2009-12-20 23:46:01 UTC (rev 1157) +++ trunk/src/KeyMap.h 2009-12-21 18:33:14 UTC (rev 1158) @@ -37,7 +37,7 @@ class KeyMap{ public: - typedef std::map< std::string, std::map < std::string, std::pair< uint, uint > > > KeyBindings; + typedef std::map< std::string, std::map < std::string, std::pair< uint, uint > > > KeyBindingsMap; KeyMap(); @@ -58,6 +58,14 @@ /*! Return literal name for the key bindings. e.g. 'Shift-A', or 'Ctrl-B' */ std::string keycodeName( uint keycode ); + void setLastKeycode( uint key ) { lastKeycode_ = keycode_( key, modifier_ ); } + + uint lastKeycode() const { return lastKeycode_; } + + void setKeyBinding( const std::string & name, uint keycode, uint key ); + + bool haveKeyBinding( uint keycode ); + protected: /*! Return unique key identifier. */ uint keycode_( uint key, GlobalKeyModifier modifier = KEY_NONE ); @@ -71,9 +79,11 @@ GlobalKeyModifier modifier_; + uint lastKeycode_; // categorie < name, (key1, key2) > - KeyBindings unDockedKeyBindings_; + KeyBindingsMap unDockedKeyBindings_; + std::map < std::string, bool (UnDockedState::*)( bool ) > unDockedKeyActions_; }; Modified: trunk/src/ResourceManager.h =================================================================== --- trunk/src/ResourceManager.h 2009-12-20 23:46:01 UTC (rev 1157) +++ trunk/src/ResourceManager.h 2009-12-21 18:33:14 UTC (rev 1158) @@ -83,6 +83,8 @@ bool mappingCapability() const { return mapping_; } KeyMap * keymap() { return keymap_; } + + inline LogManager & log() { return * log_; } protected: Ogre::Root * ogreRoot_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-20 23:46:10
|
Revision: 1157 http://opengate.svn.sourceforge.net/opengate/?rev=1157&view=rev Author: spom_spom Date: 2009-12-20 23:46:01 +0000 (Sun, 20 Dec 2009) Log Message: ----------- opengate client: add gui for keymap config Modified Paths: -------------- trunk/data/gui/layouts/dialogs/ConfigDialog.layout trunk/data/gui/looknfeel/opengateStatic.looknfeel trunk/data/gui/schemes/opengate.scheme trunk/src/BaseDialog.cpp trunk/src/BaseDialog.h trunk/src/ConfigDialog.cpp trunk/src/ConfigDialog.h trunk/src/GameStateManager.cpp trunk/src/InputManager.h trunk/src/KeyMap.cpp trunk/src/KeyMap.h Added Paths: ----------- trunk/data/gui/layouts/dialogs/ConfigControlKey.layout Added: trunk/data/gui/layouts/dialogs/ConfigControlKey.layout =================================================================== --- trunk/data/gui/layouts/dialogs/ConfigControlKey.layout (rev 0) +++ trunk/data/gui/layouts/dialogs/ConfigControlKey.layout 2009-12-20 23:46:01 UTC (rev 1157) @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<Window Type="opengate/StaticFrame" Name="Config/Controls/Key" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{0,400},{0,30}}" /> + <Window Type="opengate/StaticTextLabel" Name="Config/Controls/Key/Name" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="KeyName" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-14" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="LeftAligned" /> + <Property Name="UnifiedPosition" Value="{{0,10},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,-210},{1,0}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/Controls/Key/KeyButton1" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Key 1" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="HoverTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{1,-205},{0,5}}" /> + <Property Name="UnifiedSize" Value="{{0,100},{1,-10}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/Controls/Key/KeyButton2" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Key 2" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="HoverTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{1,-100},{0,5}}" /> + <Property Name="UnifiedSize" Value="{{0,100},{1,-10}}" /> + </Window> +</Window> \ No newline at end of file Modified: trunk/data/gui/layouts/dialogs/ConfigDialog.layout =================================================================== --- trunk/data/gui/layouts/dialogs/ConfigDialog.layout 2009-12-20 00:18:05 UTC (rev 1156) +++ trunk/data/gui/layouts/dialogs/ConfigDialog.layout 2009-12-20 23:46:01 UTC (rev 1157) @@ -18,7 +18,7 @@ <Property Name="Visible" Value="True" /> <Property Name="Text" Value="" /> <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> + <Property Name="RiseOnClick" Value="False" /> <Property Name="AlwaysOnTop" Value="False" /> <Property Name="FrameEnabled" Value="False" /> <Property Name="InheritsAlpha" Value="True" /> @@ -33,7 +33,7 @@ <Property Name="Visible" Value="True" /> <Property Name="Text" Value="" /> <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> + <Property Name="RiseOnClick" Value="False" /> <Property Name="AlwaysOnTop" Value="False" /> <Property Name="FrameEnabled" Value="False" /> <Property Name="InheritsAlpha" Value="True" /> @@ -48,7 +48,7 @@ <Property Name="Visible" Value="True" /> <Property Name="Text" Value="" /> <Property Name="Disabled" Value="False" /> - <Property Name="RiseOnClick" Value="True" /> + <Property Name="RiseOnClick" Value="False" /> <Property Name="AlwaysOnTop" Value="False" /> <Property Name="FrameEnabled" Value="False" /> <Property Name="InheritsAlpha" Value="True" /> @@ -142,7 +142,7 @@ <Window Type="opengate/Button" Name="Config/ControlsButton" > <Property Name="Visible" Value="True" /> <Property Name="Text" Value="Controls" /> - <Property Name="Disabled" Value="True" /> + <Property Name="Disabled" Value="False" /> <Property Name="RiseOnClick" Value="True" /> <Property Name="AlwaysOnTop" Value="False" /> <Property Name="InheritsAlpha" Value="True" /> @@ -219,7 +219,7 @@ <Property Name="UnifiedPosition" Value="{{0,100},{0,670}}" /> <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> </Window> - <Window Type="opengate/StaticImage" Name="Config/SubFrame" > + <Window Type="opengate/StaticFrame" Name="Config/Credits" > <Property Name="Visible" Value="True" /> <Property Name="Text" Value="" /> <Property Name="Disabled" Value="False" /> @@ -233,7 +233,7 @@ <Property Name="Image" Value="" /> <Property Name="UnifiedPosition" Value="{{0,100},{0,200}}" /> <Property Name="UnifiedSize" Value="{{1,-180},{0,450}}" /> - <Window Type="opengate/StaticLabel" Name="Config/SubFrame/Title" > + <Window Type="opengate/StaticTextLabel" Name="Config/Credits/Header" > <Property Name="Visible" Value="True" /> <Property Name="Text" Value="" /> <Property Name="Disabled" Value="False" /> @@ -243,17 +243,13 @@ <Property Name="MousePassThroughEnabled" Value="False" /> <Property Name="Font" Value="BlueHighway-18" /> <Property Name="NormalTextColour" Value="FF88D997" /> - <Property Name="HoverTextColour" Value="FF88D997" /> <Property Name="DisabledTextColour" Value="FF7F7F7F" /> <Property Name="VertLabelFormatting" Value="LeftAligned" /> <Property Name="HorzLabelFormatting" Value="TopAligned" /> - <Property Name="HoverImage" Value="" /> - <Property Name="NormalImage" Value="" /> - <Property Name="PushedImage" Value="" /> <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> <Property Name="UnifiedSize" Value="{{1,0},{0,30}}" /> </Window> - <Window Type="opengate/ConsoleListbox" Name="Config/SubFrame/CreditsText" > + <Window Type="opengate/ConsoleListbox" Name="Config/Credits/Body" > <Property Name="Visible" Value="True" /> <Property Name="Text" Value="" /> <Property Name="Disabled" Value="False" /> @@ -263,7 +259,52 @@ <Property Name="MousePassThroughEnabled" Value="False" /> <Property Name="Font" Value="BlueHighway-12" /> <Property Name="UnifiedPosition" Value="{{0,0},{0,35}}" /> - <Property Name="UnifiedSize" Value="{{1,0},{1,0}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{1,-35}}" /> </Window> </Window> + <Window Type="opengate/StaticFrame" Name="Config/Controls" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,200}}" /> + <Property Name="UnifiedSize" Value="{{1,-180},{0,450}}" /> + <Window Type="opengate/StaticFrame" Name="Config/Controls/Header" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{0,35}}" /> + </Window> + <Window Type="opengate/StaticFrame" Name="Config/Controls/Body" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,35}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{1,-35}}" /> + </Window> + </Window> </Window> \ No newline at end of file Modified: trunk/data/gui/looknfeel/opengateStatic.looknfeel =================================================================== --- trunk/data/gui/looknfeel/opengateStatic.looknfeel 2009-12-20 00:18:05 UTC (rev 1156) +++ trunk/data/gui/looknfeel/opengateStatic.looknfeel 2009-12-20 23:46:01 UTC (rev 1157) @@ -8,51 +8,120 @@ --> <WidgetLook name="opengate/StaticShared"> - <ImagerySection name="frame"> - <FrameComponent> - <Area> - <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> - <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> - <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim> - <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim> - </Area> - <Image type="TopLeftCorner" imageset="opengate" image="StaticTopLeft" /> - <Image type="TopRightCorner" imageset="opengate" image="StaticTopRight" /> - <Image type="BottomLeftCorner" imageset="opengate" image="StaticBottomLeft" /> - <Image type="BottomRightCorner" imageset="opengate" image="StaticBottomRight" /> - <Image type="LeftEdge" imageset="opengate" image="StaticLeft" /> - <Image type="RightEdge" imageset="opengate" image="StaticRight" /> - <Image type="TopEdge" imageset="opengate" image="StaticTop" /> - <Image type="BottomEdge" imageset="opengate" image="StaticBottom" /> - </FrameComponent> - </ImagerySection> - <ImagerySection name="background"> - <ImageryComponent> - <Area> - <Dim type="LeftEdge" ><ImageDim imageset="opengate" image="StaticLeft" dimension="Width" /></Dim> - <Dim type="TopEdge" ><ImageDim imageset="opengate" image="StaticTop" dimension="Height" /></Dim> - <Dim type="RightEdge" > - <UnifiedDim scale="1" type="RightEdge"> - <DimOperator op="Subtract"> - <ImageDim imageset="opengate" image="StaticRight" dimension="Width" /> - </DimOperator> - </UnifiedDim> - </Dim> - <Dim type="BottomEdge" > - <UnifiedDim scale="1" type="BottomEdge"> - <DimOperator op="Subtract"> - <ImageDim imageset="opengate" image="StaticBottom" dimension="Height" /> - </DimOperator> - </UnifiedDim> - </Dim> - </Area> - <Image imageset="opengate" image="StaticBackdrop" /> - <VertFormat type="Stretched" /> - <HorzFormat type="Stretched" /> - </ImageryComponent> - </ImagerySection> + <ImagerySection name="frame"> + <FrameComponent> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim> + </Area> + <Image type="TopLeftCorner" imageset="opengate" image="StaticTopLeft" /> + <Image type="TopRightCorner" imageset="opengate" image="StaticTopRight" /> + <Image type="BottomLeftCorner" imageset="opengate" image="StaticBottomLeft" /> + <Image type="BottomRightCorner" imageset="opengate" image="StaticBottomRight" /> + <Image type="LeftEdge" imageset="opengate" image="StaticLeft" /> + <Image type="RightEdge" imageset="opengate" image="StaticRight" /> + <Image type="TopEdge" imageset="opengate" image="StaticTop" /> + <Image type="BottomEdge" imageset="opengate" image="StaticBottom" /> + </FrameComponent> + </ImagerySection> + <ImagerySection name="background"> + <ImageryComponent> + <Area> + <Dim type="LeftEdge" ><ImageDim imageset="opengate" image="StaticLeft" dimension="Width" /></Dim> + <Dim type="TopEdge" ><ImageDim imageset="opengate" image="StaticTop" dimension="Height" /></Dim> + <Dim type="RightEdge" > + <UnifiedDim scale="1" type="RightEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="opengate" image="StaticRight" dimension="Width" /> + </DimOperator> + </UnifiedDim> + </Dim> + <Dim type="BottomEdge" > + <UnifiedDim scale="1" type="BottomEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="opengate" image="StaticBottom" dimension="Height" /> + </DimOperator> + </UnifiedDim> + </Dim> + </Area> + <Image imageset="opengate" image="StaticBackdrop" /> + <VertFormat type="Stretched" /> + <HorzFormat type="Stretched" /> + </ImageryComponent> + </ImagerySection> + <ImagerySection name="background_noframe"> + <ImageryComponent> + <Area> + <Dim type="LeftEdge" ><ImageDim imageset="opengate" image="StaticLeft" dimension="Width" /></Dim> + <Dim type="TopEdge" ><ImageDim imageset="opengate" image="StaticTop" dimension="Height" /></Dim> + <Dim type="RightEdge" > + <UnifiedDim scale="1" type="RightEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="opengate" image="StaticRight" dimension="Width" /> + </DimOperator> + </UnifiedDim> + </Dim> + <Dim type="BottomEdge" > + <UnifiedDim scale="1" type="BottomEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="opengate" image="StaticBottom" dimension="Height" /> + </DimOperator> + </UnifiedDim> + </Dim> + </Area> + <Image imageset="opengate" image="StaticBackdrop" /> + <VertFormat type="Stretched" /> + <HorzFormat type="Stretched" /> + </ImageryComponent> + </ImagerySection> </WidgetLook> +<WidgetLook name="opengate/StaticFrame"> + <Property name="FrameEnabled" value="True" /> + <Property name="BackgroundEnabled" value="True" /> + + <StateImagery name="Enabled" > + </StateImagery> + + <StateImagery name="Disabled" > + </StateImagery> + + <StateImagery name="EnabledFrame"> + <Layer> + <Section look="opengate/StaticShared" section="frame" /> + </Layer> + </StateImagery> + + <StateImagery name="DisabledFrame"> + </StateImagery> + + <StateImagery name="WithFrameEnabledBackground"> + <Layer> + <Section look="opengate/StaticShared" section="background" /> + </Layer> + </StateImagery> + + <StateImagery name="WithFrameDisabledBackground"> + <Layer> + <Section look="opengate/StaticShared" section="frame" /> + </Layer> + </StateImagery> + + <StateImagery name="NoFrameEnabledBackground"> + <Layer> + <Section look="opengate/StaticShared" section="background" /> + </Layer> + </StateImagery> + + <StateImagery name="NoFrameDisabledBackground"> + </StateImagery> + +</WidgetLook> + + + <!-- *************************************************** opengate/StaticImage Modified: trunk/data/gui/schemes/opengate.scheme =================================================================== --- trunk/data/gui/schemes/opengate.scheme 2009-12-20 00:18:05 UTC (rev 1156) +++ trunk/data/gui/schemes/opengate.scheme 2009-12-20 23:46:01 UTC (rev 1157) @@ -42,6 +42,11 @@ <!-- opengateStatic.looknfeel --> + <FalagardMapping + WindowType="opengate/StaticFrame" + TargetType="DefaultWindow" + Renderer="Falagard/StaticImage" + LookNFeel="opengate/StaticFrame" /> <FalagardMapping WindowType="opengate/StaticImage" TargetType="DefaultWindow" Modified: trunk/src/BaseDialog.cpp =================================================================== --- trunk/src/BaseDialog.cpp 2009-12-20 00:18:05 UTC (rev 1156) +++ trunk/src/BaseDialog.cpp 2009-12-20 23:46:01 UTC (rev 1157) @@ -32,17 +32,17 @@ void renameClonedWindows( const CEGUI::Window * parent, const CEGUI::String & namePrefix) { // std::cout << parent->getName() << ": " << parent->getChildCount() << std::endl; - for ( unsigned int i = 0; i < parent->getChildCount(); i ++ ){ + for ( unsigned int i = 0; i < parent->getChildCount(); i ++ ){ // std::cout << i << "accessing: "<< parent->getName() << std::endl; - CEGUI::Window * child = parent->getChildAtIdx( i ); - child->rename( namePrefix + child->getName() ); - renameClonedWindows( child, namePrefix ); - } + CEGUI::Window * child = parent->getChildAtIdx( i ); + child->rename( namePrefix + child->getName() ); + renameClonedWindows( child, namePrefix ); + } } -void showRecursive( CEGUI::Window * w ){ - w->show(); - for ( uint i = 0; i < w->getChildCount(); i ++ ) showRecursive( w->getChildAtIdx( i ) ); +void showRecursive( CEGUI::Window * w, bool show ){ + if ( show ) w->show(); else w->hide(); + for ( uint i = 0; i < w->getChildCount(); i ++ ) showRecursive( w->getChildAtIdx( i ), show ); } void fitWindowToImage( const std::string & name, CEGUI::Window * win ){ Modified: trunk/src/BaseDialog.h =================================================================== --- trunk/src/BaseDialog.h 2009-12-20 00:18:05 UTC (rev 1156) +++ trunk/src/BaseDialog.h 2009-12-20 23:46:01 UTC (rev 1157) @@ -28,7 +28,7 @@ namespace OpenGate{ void renameClonedWindows( const CEGUI::Window * parent, const CEGUI::String & namePrefix ); -void showRecursive( CEGUI::Window * w ); +void showRecursive( CEGUI::Window * w, bool show = true ); void fitWindowToImage( const std::string & name, CEGUI::Window * win ); float windowHeight( const CEGUI::Window * child ); float windowWidth( const CEGUI::Window * child ); Modified: trunk/src/ConfigDialog.cpp =================================================================== --- trunk/src/ConfigDialog.cpp 2009-12-20 00:18:05 UTC (rev 1156) +++ trunk/src/ConfigDialog.cpp 2009-12-20 23:46:01 UTC (rev 1157) @@ -21,6 +21,8 @@ #include "ConfigDialog.h" #include "common.h" #include "GameStateManager.h" +#include "KeyMap.h" + #include <CEGUI/CEGUIWindowManager.h> #include <CEGUI/elements/CEGUIPushButton.h> #include <CEGUI/elements/CEGUIListbox.h> @@ -34,59 +36,146 @@ namespace OpenGate{ ConfigDialog::ConfigDialog( ) - : BaseDialog( "dialogs/ConfigDialog.layout" ){ - setupEventHandlers(); + : BaseDialog( "dialogs/ConfigDialog.layout" ){ + setupEventHandlers(); - creditsListBox_ = static_cast<CEGUI::Listbox*> (CEGUI::WindowManager::getSingleton().getWindow( "Config/SubFrame/CreditsText" ) ); - - fillCreditsWindow(); - creditsListBox_->hide(); + lastActiveWindow_ = NULL; + activeWindow_ = NULL; } ConfigDialog::~ConfigDialog(){ } void ConfigDialog::setupEventHandlers(){ - CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton(); + CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton(); - BIND_CEGUI_EVENT( wmgr.getWindow( (CEGUI::utf8*)"Config/QuitButton" ), - CEGUI::PushButton::EventClicked, ConfigDialog::handleQuitButton ); - BIND_CEGUI_EVENT( wmgr.getWindow( (CEGUI::utf8*)"Config/CreditsButton" ), - CEGUI::PushButton::EventClicked, ConfigDialog::handleCreditsButton ); + BIND_CEGUI_EVENT( wmgr.getWindow( (CEGUI::utf8*)"Config/QuitButton" ), + CEGUI::PushButton::EventClicked, ConfigDialog::handleQuitButton_ ); + BIND_CEGUI_EVENT( wmgr.getWindow( (CEGUI::utf8*)"Config/CreditsButton" ), + CEGUI::PushButton::EventClicked, ConfigDialog::handleCreditsButton_ ); + BIND_CEGUI_EVENT( wmgr.getWindow( (CEGUI::utf8*)"Config/ControlsButton" ), + CEGUI::PushButton::EventClicked, ConfigDialog::handleControlsButton_ ); } -bool ConfigDialog::handleQuitButton( const CEGUI::EventArgs & e ){ - resources_->gameStateRoot->shutdown(); - return true; +bool ConfigDialog::handleQuitButton_( const CEGUI::EventArgs & e ){ + resources_->gameStateRoot->shutdown(); + return true; } -void ConfigDialog::fillCreditsWindow( ){ - std::string fileName = resources_->findFullFileName( "credits.txt" ); +bool ConfigDialog::handleControlsButton_( const CEGUI::EventArgs & e ){ + //std::cout << "ConfigDialog::handleConfigButton_( const CEGUI::EventArgs & e ){" << std::endl; +// CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"Config/ControlSubFrame/Title" ) +// ->setProperty("Text", "" ); + + activeWindow_ = static_cast<CEGUI::Listbox*>( CEGUI::WindowManager::getSingleton().getWindow( "Config/Controls" ) ); + + KeyMap::KeyBindings keyBindings = resources_->keymap()->unDockedKeyBindings(); + uint count = 0; + + for ( KeyMap::KeyBindings::iterator it = keyBindings.begin(); it != keyBindings.end(); it ++ ){ + CEGUI::Window *b; + + if ( CEGUI::WindowManager::getSingleton().isWindowPresent( activeWindow_->getName() + it->first ) ){ + b = CEGUI::WindowManager::getSingleton().getWindow( activeWindow_->getName() + it->first ); + } else { + b = CEGUI::WindowManager::getSingleton().createWindow( "opengate/Button", activeWindow_->getName() + it->first ); + b->setProperty( "Text", it->first ); + b->setSize( CEGUI::UVector2( CEGUI::UDim( 0.0, 80.0 ), CEGUI::UDim( 0.0, 25.0 ) ) ); + b->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0, 85.0 * count ), CEGUI::UDim( 0.0, 0.0 ) ) ); + CEGUI::WindowManager::getSingleton().getWindow( "Config/Controls/Header" )->addChildWindow( b ); + count ++; + BIND_CEGUI_EVENT( b, CEGUI::PushButton::EventClicked, ConfigDialog::handleControlsCategoryButton_ ); + } - std::fstream file; file.open( fileName.c_str() ); + b->show(); + } + + if ( lastActiveWindow_ ) lastActiveWindow_->hide(); + activeWindow_->show(); + lastActiveWindow_ = activeWindow_; + + return true; +} - std::vector < std::string > row; - while( !file.eof() ){ - row = getRowSubstrings( file ); +bool ConfigDialog::handleControlsCategoryButton_( const CEGUI::EventArgs & e ){ + const CEGUI::WindowEventArgs & we = static_cast< const CEGUI::WindowEventArgs & >( e ); + std::string category( we.window->getText().c_str() ); + fillControlsWindow_( category ); + return true; +} - CEGUI::String str; - for ( uint i = 0; i < row.size(); i ++ ){ - str += row[ i ] + " "; - } - CEGUI::ListboxTextItem * item = new CEGUI::ListboxTextItem( str ); - creditsListBox_->addItem ( item ); - } - creditsListBox_->ensureItemIsVisible( creditsListBox_->getItemCount() ); - file.close(); +void ConfigDialog::fillControlsWindow_( const std::string & category ){ + CEGUI::Window * window = CEGUI::WindowManager::getSingleton().getWindow( "Config/Controls/Body" ); + + for ( uint i = 0; i < window->getChildCount(); i ++ ) { + CEGUI::WindowManager::getSingleton().destroyWindow( window->getChildAtIdx( i ) ); + } + //window->show(); + + std::map < std::string, std::pair< uint, uint > > keyBindings( resources_->keymap()->unDockedKeyBindings()[ category ] ); + uint count = 0; + for ( std::map < std::string, std::pair< uint, uint > >::iterator it = keyBindings.begin(); it != keyBindings.end(); it ++ ){ + std::string keyName( it->first ); + CEGUI::Window * b; + CEGUI::String keyWindowName( window->getName() + keyName ); + + if ( CEGUI::WindowManager::getSingleton().isWindowPresent( keyWindowName ) ){ + b = CEGUI::WindowManager::getSingleton().getWindow( keyWindowName ); + b->show(); + } else { + b = CEGUI::WindowManager::getSingleton().loadWindowLayout( "dialogs/ConfigControlKey.layout" ); + b->rename( keyWindowName ); + renameClonedWindows( b, keyWindowName ); + + window->addChildWindow( b ); + b->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0, 0.0 ), CEGUI::UDim( 0.0, count * 30 ) ) ); + + CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/Name" )->setProperty( "Text", keyName ); + CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton1" )->setProperty( "Text", + resources_->keymap()->keycodeName( it->second.first ) ); + CEGUI::WindowManager::getSingleton().getWindow( b->getName() + "Config/Controls/Key/KeyButton2" )->setProperty( "Text", + resources_->keymap()->keycodeName( it->second.second ) ); + + count ++; + + } + b->show(); + } } -bool ConfigDialog::handleCreditsButton( const CEGUI::EventArgs & e ){ - CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"Config/SubFrame/Title" ) - ->setProperty("Text", "Credits" ); - creditsListBox_->show(); +bool ConfigDialog::handleCreditsButton_( const CEGUI::EventArgs & e ){ + //std::cout << "ConfigDialog::handleCreditsButton_( const CEGUI::EventArgs & e ){" << std::endl; + CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"Config/Credits/Header" ) + ->setProperty("Text", "Credits" ); + + activeWindow_ = static_cast<CEGUI::Listbox*> (CEGUI::WindowManager::getSingleton().getWindow( "Config/Credits/Body" ) ); + fillCreditsWindow_( dynamic_cast<CEGUI::Listbox*>( activeWindow_ ) ); + if ( lastActiveWindow_ ) lastActiveWindow_->hide(); + activeWindow_->show(); + lastActiveWindow_ = activeWindow_; + return true; +} - return true; +void ConfigDialog::fillCreditsWindow_( CEGUI::Listbox * window ){ + window->resetList(); + std::string fileName = resources_->findFullFileName( "credits.txt" ); + + std::fstream file; file.open( fileName.c_str() ); + + std::vector < std::string > row; + while( !file.eof() ){ + row = getRowSubstrings( file ); + + CEGUI::String str; + for ( uint i = 0; i < row.size(); i ++ ){ + str += row[ i ] + " "; + } + CEGUI::ListboxTextItem * item = new CEGUI::ListboxTextItem( str ); + window->addItem ( item ); + } + window->ensureItemIsVisible( window->getItemCount() ); + file.close(); } } // namespace OpenGate Modified: trunk/src/ConfigDialog.h =================================================================== --- trunk/src/ConfigDialog.h 2009-12-20 00:18:05 UTC (rev 1156) +++ trunk/src/ConfigDialog.h 2009-12-20 23:46:01 UTC (rev 1157) @@ -28,21 +28,26 @@ class ConfigDialog : public BaseDialog{ public: - ConfigDialog( ); + ConfigDialog( ); - virtual ~ConfigDialog(); + virtual ~ConfigDialog(); - virtual void setupEventHandlers(); + virtual void setupEventHandlers(); protected: - void fillCreditsWindow(); + void fillCreditsWindow_( CEGUI::Listbox * window ); + void fillControlsWindow_( const std::string & category ); - bool handleQuitButton( const CEGUI::EventArgs & e ); - bool handleBackButton( const CEGUI::EventArgs & e ); - bool handleCreditsButton( const CEGUI::EventArgs & e ); + bool handleQuitButton_( const CEGUI::EventArgs & e ); + bool handleBackButton_( const CEGUI::EventArgs & e ); + bool handleCreditsButton_( const CEGUI::EventArgs & e ); + bool handleControlsButton_( const CEGUI::EventArgs & e ); + bool handleControlsCategoryButton_( const CEGUI::EventArgs & e ); - CEGUI::Listbox * creditsListBox_; + std::map < std::string, std::set < CEGUI::Window * > > controlKeys_; + CEGUI::Window * lastActiveWindow_; + CEGUI::Window * activeWindow_; }; } //namespace OpenGate Modified: trunk/src/GameStateManager.cpp =================================================================== --- trunk/src/GameStateManager.cpp 2009-12-20 00:18:05 UTC (rev 1156) +++ trunk/src/GameStateManager.cpp 2009-12-20 23:46:01 UTC (rev 1157) @@ -385,11 +385,8 @@ CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"opengate.scheme" ); resources_.guiSystem->setDefaultFont( (CEGUI::utf8*)"BlueHighway-12" ); - CEGUI::WindowFactoryManager::getSingleton() - - - - return true; +// CEGUI::WindowFactoryManager::getSingleton() + return true; } bool GameStateManager::initialiseInputManager( ) { Modified: trunk/src/InputManager.h =================================================================== --- trunk/src/InputManager.h 2009-12-20 00:18:05 UTC (rev 1156) +++ trunk/src/InputManager.h 2009-12-20 23:46:01 UTC (rev 1157) @@ -107,6 +107,8 @@ static InputManager & getSingleton( ); static InputManager * getSingletonPtr( ); + + inline OIS::Keyboard * keybord() { return keyboard_; } protected: Modified: trunk/src/KeyMap.cpp =================================================================== --- trunk/src/KeyMap.cpp 2009-12-20 00:18:05 UTC (rev 1156) +++ trunk/src/KeyMap.cpp 2009-12-20 23:46:01 UTC (rev 1157) @@ -32,88 +32,137 @@ } void KeyMap::setDefaults(){ - /*! Actions for undocked state */ - unDockedActionMap_[ keycode( 70 ) ] = &UnDockedState::keyActionSwitchMinMaxConsole; + registerUnDockedKeyAction_( "General", "Min/Max Console", &UnDockedState::keyActionSwitchMinMaxConsole, + keycode_( 70 ) ); - unDockedActionMap_[ keycode( OIS::KC_A ) ] = &UnDockedState::keyActionAvatarIncreaseYaw; - unDockedActionMap_[ keycode( OIS::KC_NUMPAD4 ) ] = &UnDockedState::keyActionAvatarIncreaseYaw; - unDockedActionMap_[ keycode( OIS::KC_D ) ] = &UnDockedState::keyActionAvatarDecreaseYaw; - unDockedActionMap_[ keycode( OIS::KC_NUMPAD6 ) ] = &UnDockedState::keyActionAvatarDecreaseYaw; - - unDockedActionMap_[ keycode( OIS::KC_W ) ] = &UnDockedState::keyActionAvatarIncreasePitch; - unDockedActionMap_[ keycode( OIS::KC_NUMPAD8 ) ] = &UnDockedState::keyActionAvatarIncreasePitch; - unDockedActionMap_[ keycode( OIS::KC_S ) ] = &UnDockedState::keyActionAvatarDecreasePitch; - unDockedActionMap_[ keycode( OIS::KC_NUMPAD2 ) ] = &UnDockedState::keyActionAvatarDecreasePitch; - - unDockedActionMap_[ keycode( 181 ) ] = &UnDockedState::keyActionAvatarIncreaseRoll; - unDockedActionMap_[ keycode( OIS::KC_NUMPAD0 ) ] = &UnDockedState::keyActionAvatarIncreaseRoll; - unDockedActionMap_[ keycode( 55 ) ] = &UnDockedState::keyActionAvatarDecreaseRoll; - unDockedActionMap_[ keycode( OIS::KC_NUMPADCOMMA ) ] = &UnDockedState::keyActionAvatarDecreaseRoll; - - unDockedActionMap_[ keycode( OIS::KC_NUMPAD5 ) ] = &UnDockedState::keyActionAvatarCenter; - - unDockedActionMap_[ keycode( OIS::KC_NUMPAD7 ) ] = &UnDockedState::keyActionAvatarIncrementThrust; - unDockedActionMap_[ keycode( OIS::KC_NUMPAD1 ) ] = &UnDockedState::keyActionAvatarDecrementThrust; - unDockedActionMap_[ keycode( OIS::KC_NUMPAD3 ) ] = &UnDockedState::keyActionAvatarBreakPressed; - unDockedActionMap_[ keycode( OIS::KC_NUMPAD9 ) ] = &UnDockedState::keyActionAvatarAfterburnerPressed; - - unDockedActionMap_[ keycode( OIS::KC_N ) ] = &UnDockedState::keyActionSelectTextTarget; - unDockedActionMap_[ keycode( OIS::KC_P ) ] = &UnDockedState::keyActionSelectPreviousTarget; - - unDockedActionMap_[ keycode( OIS::KC_1 ) ] = &UnDockedState::keyActionCameraNormal; - unDockedActionMap_[ keycode( OIS::KC_2 ) ] = &UnDockedState::keyActionCameraLeft; - unDockedActionMap_[ keycode( OIS::KC_3 ) ] = &UnDockedState::keyActionCameraRight; - unDockedActionMap_[ keycode( OIS::KC_4 ) ] = &UnDockedState::keyActionCameraUp; - unDockedActionMap_[ keycode( OIS::KC_5 ) ] = &UnDockedState::keyActionCameraDown; - unDockedActionMap_[ keycode( OIS::KC_6 ) ] = &UnDockedState::keyActionCameraToggle; + registerUnDockedKeyAction_( "Flight", "1 Rudder increase yaw", &UnDockedState::keyActionAvatarIncreaseYaw, + keycode_( OIS::KC_A ), keycode_( OIS::KC_NUMPAD4 ) ); + registerUnDockedKeyAction_( "Flight", "2 Rudder decrease yaw", &UnDockedState::keyActionAvatarDecreaseYaw, + keycode_( OIS::KC_D ), keycode_( OIS::KC_NUMPAD6 ) ); + registerUnDockedKeyAction_( "Flight", "3 Rudder increase pitch", &UnDockedState::keyActionAvatarIncreasePitch, + keycode_( OIS::KC_W ), keycode_( OIS::KC_NUMPAD8 ) ); + registerUnDockedKeyAction_( "Flight", "4 Rudder decrease pitch", &UnDockedState::keyActionAvatarDecreasePitch, + keycode_( OIS::KC_S ), keycode_( OIS::KC_NUMPAD2 ) ); + registerUnDockedKeyAction_( "Flight", "5 Rudder increase roll", &UnDockedState::keyActionAvatarIncreaseRoll, + keycode_( 181 ), keycode_( OIS::KC_NUMPAD0 ) ); + registerUnDockedKeyAction_( "Flight", "6 Rudder decrease roll", &UnDockedState::keyActionAvatarDecreaseRoll, + keycode_( 55 ), keycode_( OIS::KC_NUMPADCOMMA ) ); + registerUnDockedKeyAction_( "Flight", "7 Rudder center", &UnDockedState::keyActionAvatarCenter, + keycode_( OIS::KC_NUMPAD5 ) ); - unDockedActionMap_[ keycode( OIS::KC_A, KEY_SHIFT ) ] = &UnDockedState::keyActionDockAssist; + registerUnDockedKeyAction_( "Flight", "8 Increase thrust", &UnDockedState::keyActionAvatarIncrementThrust, + keycode_( OIS::KC_NUMPAD7 ) ); + registerUnDockedKeyAction_( "Flight", "9 Decrease thrust", &UnDockedState::keyActionAvatarDecrementThrust, + keycode_( OIS::KC_NUMPAD1 ) ); + registerUnDockedKeyAction_( "Flight", "Break", &UnDockedState::keyActionAvatarBreakPressed, + keycode_( OIS::KC_NUMPAD3 ) ); + registerUnDockedKeyAction_( "Flight", "Afterburner", &UnDockedState::keyActionAvatarAfterburnerPressed, + keycode_( OIS::KC_NUMPAD9 ) ); + registerUnDockedKeyAction_( "Flight", "Docking assistant", &UnDockedState::keyActionDockAssist, + keycode_( OIS::KC_A, KEY_SHIFT ) ); + + registerUnDockedKeyAction_( "Radar", "Select next target", &UnDockedState::keyActionSelectTextTarget, + keycode_( OIS::KC_N ) ); + registerUnDockedKeyAction_( "Radar", "Select previous target", &UnDockedState::keyActionSelectPreviousTarget, + keycode_( OIS::KC_P ) ); + + registerUnDockedKeyAction_( "Camera", "Normal", &UnDockedState::keyActionCameraNormal, + keycode_( OIS::KC_1 ) ); + registerUnDockedKeyAction_( "Camera", "Look left", &UnDockedState::keyActionCameraLeft, + keycode_( OIS::KC_2 ) ); + registerUnDockedKeyAction_( "Camera", "Look right", &UnDockedState::keyActionCameraRight, + keycode_( OIS::KC_3 ) ); + registerUnDockedKeyAction_( "Camera", "Look up", &UnDockedState::keyActionCameraUp, + keycode_( OIS::KC_4 ) ); + registerUnDockedKeyAction_( "Camera", "Look down", &UnDockedState::keyActionCameraDown, + keycode_( OIS::KC_5 ) ); + registerUnDockedKeyAction_( "Camera", "Toggle mode", &UnDockedState::keyActionCameraToggle, + keycode_( OIS::KC_6 ) ); + + /*! Actions for development, will removed later. */ + registerUnDockedKeyAction_( "Development", "Toggle filtering", &UnDockedState::keyActionToggleFiltering_DEV, + keycode_( OIS::KC_F ) ); + registerUnDockedKeyAction_( "Development", "Toggle polygone", &UnDockedState::keyActionTogglePolygonMode_DEV, + keycode_( OIS::KC_R, KEY_CONTROL ) ); + registerUnDockedKeyAction_( "Development", "1 Increase ambient light", &UnDockedState::keyActionIncreaseAmbientLight_DEV, + keycode_( OIS::KC_L, KEY_SHIFT ) ); + registerUnDockedKeyAction_( "Development", "2 Decrease ambient light", &UnDockedState::keyActionDecreaseAmbientLight_DEV, + keycode_( OIS::KC_L ) ); + registerUnDockedKeyAction_( "Development", "3 Increase time zoom", &UnDockedState::keyActionIncreaseTimeZoom_DEV, + keycode_( OIS::KC_T, KEY_SHIFT ) ); + registerUnDockedKeyAction_( "Development", "4 Decrease time zoom", &UnDockedState::keyActionDecreaseTimeZoom_DEV, + keycode_( OIS::KC_T ) ); + registerUnDockedKeyAction_( "Development", "5 Increase shader scheme", &UnDockedState::keyActionIncreaseShaderScheme_DEV, + keycode_( OIS::KC_O, KEY_SHIFT ) ); + registerUnDockedKeyAction_( "Development", "6 Decrease shader scheme", &UnDockedState::keyActionDecreaseShaderScheme_DEV, + keycode_( OIS::KC_O ) ); - /*! Actions for console. */ - consoleActionMap_[ keycode( OIS::KC_SYSRQ ) ] = &Console::keyActionScreenshot; - consoleActionMap_[ keycode( OIS::KC_Q, KEY_CONTROL ) ]= &Console::keyActionShutdown_DEV; - // consoleActionMap_[ keycode( OIS::KC_F4, KEY_ALT ) ] = &Console::keyActionShutdown_DEV; - - /*! Actions for development, will removed later. */ - unDockedActionMap_[ keycode( OIS::KC_F ) ] = &UnDockedState::keyActionToggleFiltering_DEV; - unDockedActionMap_[ keycode( OIS::KC_R, KEY_CONTROL ) ] = &UnDockedState::keyActionTogglePolygonMode_DEV; - - unDockedActionMap_[ keycode( OIS::KC_L, KEY_SHIFT ) ] = &UnDockedState::keyActionIncreaseAmbientLight_DEV; - unDockedActionMap_[ keycode( OIS::KC_L ) ] = &UnDockedState::keyActionDecreaseAmbientLight_DEV; - - unDockedActionMap_[ keycode( OIS::KC_T, KEY_SHIFT ) ] = &UnDockedState::keyActionIncreaseTimeZoom_DEV; - unDockedActionMap_[ keycode( OIS::KC_T ) ] = &UnDockedState::keyActionDecreaseTimeZoom_DEV; + registerUnDockedKeyAction_( "Development", "Toggle pilot duelist", &UnDockedState::keyActionAvatarSwitchDuelistPilot_DEV, + keycode_( OIS::KC_F5 ) ); + registerUnDockedKeyAction_( "Development", "Toggle pilot target", &UnDockedState::keyActionAvatarSwitchDuelistTarget_DEV, + keycode_( OIS::KC_F6 ) ); + registerUnDockedKeyAction_( "Development", "Instant dock/launch", &UnDockedState::keyActionAvatarChangeDockedState_DEV, + keycode_( OIS::KC_F4 ) ); + registerUnDockedKeyAction_( "Development", "Selfdestruct", &UnDockedState::keyActionAvatarSelfDestruct_DEV, + keycode_( OIS::KC_F8 ) ); + registerUnDockedKeyAction_( "Development", "Spawn autodocking ai", &UnDockedState::keyActionSpawnAi_DEV, + keycode_( OIS::KC_F7 ) ); + registerUnDockedKeyAction_( "Development", "Show infos", &UnDockedState::keyActionShowInfos_DEV, + keycode_( OIS::KC_I, KEY_CONTROL ) ); + registerUnDockedKeyAction_( "Development", "Show ecliptic", &UnDockedState::keyActionShowEcliptic_DEV, + keycode_( OIS::KC_E, KEY_SHIFT ) ); + registerUnDockedKeyAction_( "Development", "7 test inc", &UnDockedState::keyActionTmpUp_DEV, + keycode_( OIS::KC_G, KEY_SHIFT ) ); + registerUnDockedKeyAction_( "Development", "8 test dec", &UnDockedState::keyActionTmpDown_DEV, + keycode_( OIS::KC_G ) ); - unDockedActionMap_[ keycode( OIS::KC_O, KEY_SHIFT ) ] = &UnDockedState::keyActionIncreaseShaderScheme_DEV; - unDockedActionMap_[ keycode( OIS::KC_O ) ] = &UnDockedState::keyActionDecreaseShaderScheme_DEV; + /*! Actions for console. */ + consoleActionMap_[ keycode_( OIS::KC_SYSRQ ) ] = &Console::keyActionScreenshot; + consoleActionMap_[ keycode_( OIS::KC_Q, KEY_CONTROL ) ]= &Console::keyActionShutdown_DEV; + // consoleActionMap_[ keycode_( OIS::KC_F4, KEY_ALT ) ] = &Console::keyActionShutdown_DEV; +} - unDockedActionMap_[ keycode( OIS::KC_F5 ) ] = &UnDockedState::keyActionAvatarSwitchDuelistPilot_DEV; - unDockedActionMap_[ keycode( OIS::KC_F6 ) ] = &UnDockedState::keyActionAvatarSwitchDuelistTarget_DEV; - unDockedActionMap_[ keycode( OIS::KC_F4 ) ] = &UnDockedState::keyActionAvatarChangeDockedState_DEV; - unDockedActionMap_[ keycode( OIS::KC_F8 ) ] = &UnDockedState::keyActionAvatarSelfDestruct_DEV; - unDockedActionMap_[ keycode( OIS::KC_F7 ) ] = &UnDockedState::keyActionSpawnAi_DEV; - unDockedActionMap_[ keycode( OIS::KC_I, KEY_CONTROL ) ] = &UnDockedState::keyActionShowInfos_DEV; - unDockedActionMap_[ keycode( OIS::KC_E, KEY_SHIFT ) ] = &UnDockedState::keyActionShowEcliptic_DEV; - - unDockedActionMap_[ keycode( OIS::KC_G, KEY_SHIFT ) ] = &UnDockedState::keyActionTmpUp_DEV; - unDockedActionMap_[ keycode( OIS::KC_G ) ] = &UnDockedState::keyActionTmpDown_DEV; +void KeyMap::registerUnDockedKeyAction_( const std::string & category, const std::string & name, bool (UnDockedState::*action)( bool ), + uint key1, uint key2 ){ + unDockedKeyBindings_[ category ].insert( std::pair < std::string, std::pair < uint, uint > > ( name, std::pair< uint, uint >( key1, key2 ) ) ); + unDockedActionMap_[ key1 ] = action; + if ( key2 ) unDockedActionMap_[ key2 ] = action; } - + + bool(UnDockedState::*KeyMap::unDockedKeyAction( const OIS::KeyEvent & e ))(bool) { - uint key = keycode( e.key, modifier_ ); - if ( unDockedActionMap_.count( key ) > 0 ) return unDockedActionMap_[ key ]; - return &UnDockedState::keyActionDoNothing; + uint key = keycode_( e.key, modifier_ ); + if ( unDockedActionMap_.count( key ) > 0 ) return unDockedActionMap_[ key ]; + return &UnDockedState::keyActionDoNothing; } bool(Console::*KeyMap::consoleKeyAction( const OIS::KeyEvent & e ))(bool) { - uint key = keycode( e.key, modifier_ ); - if ( consoleActionMap_.count( key ) > 0 ) return consoleActionMap_[ key ]; - return &Console::keyActionDoNothing; + uint key = keycode_( e.key, modifier_ ); + if ( consoleActionMap_.count( key ) > 0 ) return consoleActionMap_[ key ]; + return &Console::keyActionDoNothing; } - -uint KeyMap::keycode( uint key, GlobalKeyModifier modifier ){ - return modifier * 65565 + key; + +std::string KeyMap::keycodeName( uint keycode ){ + GlobalKeyModifier modifier = (GlobalKeyModifier)( keycode / 65565 ); + uint key = keycode - modifier * 65565; + + std::string name; + switch ( modifier ){ + case KEY_CONTROL: name += "Ctrl-"; break; + case KEY_SHIFT: name += "Shift-"; break; + default: break; + } + + std::string keyname( ResourceManager::getSingletonPtr()->inputManager->keybord()->getAsString( OIS::KeyCode( key ) ) ); + if ( keyname != "Unknown" ){ + name += keyname; + } + return name; } + +uint KeyMap::keycode_( uint key, GlobalKeyModifier modifier ){ + return modifier * 65565 + key; +} } // namespace OpenGate Modified: trunk/src/KeyMap.h =================================================================== --- trunk/src/KeyMap.h 2009-12-20 00:18:05 UTC (rev 1156) +++ trunk/src/KeyMap.h 2009-12-20 23:46:01 UTC (rev 1157) @@ -37,28 +37,43 @@ class KeyMap{ public: + typedef std::map< std::string, std::map < std::string, std::pair< uint, uint > > > KeyBindings; + KeyMap(); ~KeyMap(); - void setDefaults(); + void setDefaults(); - bool (UnDockedState::*unDockedKeyAction( const OIS::KeyEvent & e ))( bool ); + bool (UnDockedState::*unDockedKeyAction( const OIS::KeyEvent & e ))( bool ); - bool (Console::*consoleKeyAction( const OIS::KeyEvent & e ))( bool ); + bool (Console::*consoleKeyAction( const OIS::KeyEvent & e ))( bool ); - void setGlobalKeyModifier( GlobalKeyModifier modifier ){ modifier_ = modifier; } + void setGlobalKeyModifier( GlobalKeyModifier modifier ){ modifier_ = modifier; } - GlobalKeyModifier globalKeyModifier( ) const { return modifier_; } - - uint keycode( uint key, GlobalKeyModifier modifier = KEY_NONE ); - + GlobalKeyModifier globalKeyModifier( ) const { return modifier_; } + + std::map< std::string, std::map < std::string, std::pair< uint, uint > > > & unDockedKeyBindings() { return unDockedKeyBindings_; } + + /*! Return literal name for the key bindings. e.g. 'Shift-A', or 'Ctrl-B' */ + std::string keycodeName( uint keycode ); + protected: + /*! Return unique key identifier. */ + uint keycode_( uint key, GlobalKeyModifier modifier = KEY_NONE ); + + void registerUnDockedKeyAction_( const std::string & category, const std::string & name, + bool (UnDockedState::*unDockedKeyAction)( bool ), + uint key1, uint key2 = 0 ); - std::map< uint, bool (UnDockedState::*)( bool ) > unDockedActionMap_; - std::map< uint, bool (Console::*)( bool ) > consoleActionMap_; + std::map< uint, bool (UnDockedState::*)( bool ) > unDockedActionMap_; + std::map< uint, bool (Console::*)( bool ) > consoleActionMap_; - GlobalKeyModifier modifier_; + GlobalKeyModifier modifier_; + + + // categorie < name, (key1, key2) > + KeyBindings unDockedKeyBindings_; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-20 01:27:39
|
Revision: 1156 http://opengate.svn.sourceforge.net/opengate/?rev=1156&view=rev Author: spom_spom Date: 2009-12-20 00:18:05 +0000 (Sun, 20 Dec 2009) Log Message: ----------- changed client config window layout Modified Paths: -------------- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py doc/Doxyfile doc/milestones.txt trunk/data/gui/layouts/dialogs/ConfigDialog.layout trunk/data/gui/schemes/opengate.scheme trunk/data/misc/credits.txt trunk/src/GameStateManager.cpp Added Paths: ----------- trunk/data/gui/imagesets/opengateConfigWindow.imageset Modified: branches/ogEditor/ogEditor/apps/opengate/opengateedit.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-19 16:17:41 UTC (rev 1155) +++ branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-20 00:18:05 UTC (rev 1156) @@ -129,6 +129,8 @@ self.childWindows = [] self.layout = None + def getToolBar( self, parent ): return self.layout.getToolBar( parent ) + def createPropertyPanel( self, parent ): if not HAVE_PROPGRID: return wx.Panel( parent ) @@ -173,7 +175,11 @@ self.window.setProperty( name, str( value ) ) #getattr( self.axes, name )( value ) if self.layout is not None: - self.layout.toolBar_.EnableTool( self.layout.tbSave.GetId(), True ) + try: + self.layout.toolBar_.EnableTool( self.layout.tbSave.GetId(), True ) + self.layout.toolBar_.Refresh() + except: + pass def onNameChanged( self, name ): print "onNameChanged:", name @@ -269,6 +275,8 @@ def onReload( self, event = None ): if self.layout is not None: CEGUI.WindowManager.getSingleton().destroyWindow( self.layout ) + #CEGUI.SchemeManager.getSingleton().unloadScheme("opengate") + #CEGUI.SchemeManager.getSingleton().loadScheme("opengate.scheme") self.load() self.guiSystem.setGUISheet( self.layout ) self.parent.statusBar.setStatusMessage( "reloaded: " + self.fullFileName ) @@ -283,6 +291,7 @@ self.window.writeXML( xml ) outfile.close() self.toolBar_.EnableTool( self.tbSave.GetId(), False ) + self.toolBar_.Refresh() print "wrote: ", self.fullFileName self.parent.statusBar.setStatusMessage( "wrote: " + self.fullFileName ) @@ -351,6 +360,26 @@ self.renderer_.addListener( wxCEGUIListener( self.GUIRenderer ) ) + ############################## + # hackish parsing CEGUI.log for reading of CEGUI Factory content until CEGUI.*.getIterator() lacks python converter + ############################## + self.ceguiWindowFactories = [] + self.ceguiWindowRendererFactories = [] + fi = open( 'CEGUI.log', 'r') + for line in fi: + if 'WindowFactory for ' in line: + f = line.split("'") + if CEGUI.WindowFactoryManager.getSingleton().isFactoryPresent( f[ 1 ] ): + self.ceguiWindowFactories.append( f[ 1 ] ) + elif 'WindowRendererFactory ' in line: + f = line.split("'") + #if CEGUI.WindowFactoryManager.getSingleton().isFactoryPresent( f[ 1 ] ): + self.ceguiWindowRendererFactories.append( f[ 1 ] ) + + print self.ceguiWindowRendererFactories + fi.close() + ############################## + #self.frameListener = GuiFrameListener( self.renderer_.renderWindow, self.renderer_.camera, self.GUIRenderer) #self.sceneManager) #self.frameListener.MenuMode = True # this stop the camera moving with the mouse cursor.. Modified: doc/Doxyfile =================================================================== --- doc/Doxyfile 2009-12-19 16:17:41 UTC (rev 1155) +++ doc/Doxyfile 2009-12-20 00:18:05 UTC (rev 1156) @@ -1,277 +1,1310 @@ -# Doxyfile 1.5.2 +# Doxyfile 1.5.4 +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = opengate -PROJECT_NUMBER = 0.0.1 -OUTPUT_DIRECTORY = ./ + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct (or union) is +# documented as struct with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code where the coding convention is that all structs are +# typedef'ed and only the typedef is referenced never the struct's name. + +TYPEDEF_HIDES_STRUCT = NO + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + EXTRACT_PRIVATE = YES -EXTRACT_STATIC = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = YES -HIDE_UNDOC_MEMBERS = YES -HIDE_UNDOC_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be extracted +# and appear in the documentation as a namespace called 'anonymous_namespace{file}', +# where file will be replaced with the base name of the file that contains the anonymous +# namespace. By default anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command <command> <input-file>, where <command> is the value of +# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + FILE_VERSION_FILTER = + #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + WARN_LOGFILE = + #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = ../src/ + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../trunk/src + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + INPUT_ENCODING = UTF-8 -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.d \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.mm \ - *.dox \ - *.py \ - *.C \ - *.CC \ - *.C++ \ - *.II \ - *.I++ \ - *.H \ - *.HH \ - *.H++ \ - *.CS \ - *.PHP \ - *.PHP3 \ - *.M \ - *.MM \ - *.PY -RECURSIVE = YES + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + EXAMPLE_PATH = -EXAMPLE_PATTERNS = * + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + FILTER_SOURCE_FILES = NO + #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH +# then you must also enable this option. If you don't then doxygen will produce +# a warning and turn it on anyway + SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + USE_HTAGS = NO -VERBATIM_HEADERS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + IGNORE_PREFIX = + #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + GENERATE_HTMLHELP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + TREEVIEW_WIDTH = 250 + #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + LATEX_HIDE_INDICES = NO + #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + RTF_EXTENSIONS_FILE = + #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + MAN_LINKS = NO + #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + XML_PROGRAMLISTING = YES + #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + GENERATE_AUTOGEN_DEF = NO + #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + PERLMOD_MAKEVAR_PREFIX = + #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + SKIP_FUNCTION_MACROS = YES + #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + PERL_PATH = /usr/bin/perl + #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + CALL_GRAPH = NO + +# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the number +# of direct children of the root node in a graph is already larger than +# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + DOT_GRAPH_MAX_NODES = 50 -DOT_TRANSPARENT = NO + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path ... [truncated message content] |
From: <spo...@us...> - 2009-12-19 16:17:50
|
Revision: 1155 http://opengate.svn.sourceforge.net/opengate/?rev=1155&view=rev Author: spom_spom Date: 2009-12-19 16:17:41 +0000 (Sat, 19 Dec 2009) Log Message: ----------- ogedit: cegui-layout-save-button overwrite appropriate layouts in trunk/data/gui/layouts Modified Paths: -------------- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py branches/ogEditor/ogEditor/main/mainApp.py Modified: branches/ogEditor/ogEditor/apps/opengate/opengateedit.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-19 16:15:09 UTC (rev 1154) +++ branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-19 16:17:41 UTC (rev 1155) @@ -105,9 +105,15 @@ , [ "RiseOnClick", bool ] , [ "AlwaysOnTop", bool ] , [ "FrameEnabled", bool ] + , [ "InheritsAlpha", bool ] , [ "BackgroundEnabled", bool ] , [ "MousePassThroughEnabled", bool ] , [ "Font", str ] + , [ "NormalTextColour", str ] + , [ "HoverTextColour", str ] + , [ "DisabledTextColour", str ] + , [ "VertLabelFormatting", str ] + , [ "HorzLabelFormatting", str ] , [ "Image", str ] , [ "HoverImage", str ] , [ "NormalImage", str ] @@ -121,6 +127,7 @@ AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) self.window = None self.childWindows = [] + self.layout = None def createPropertyPanel( self, parent ): if not HAVE_PROPGRID: @@ -140,7 +147,7 @@ def fillPG( self, panel, obj, target ): #self.window.getIterator lacks python converter :( - for k in props: + for k in self.props: name = k[0] typ = k[1] @@ -165,23 +172,24 @@ print "onWindowPropertyChanged:", name, value self.window.setProperty( name, str( value ) ) #getattr( self.axes, name )( value ) - + if self.layout is not None: + self.layout.toolBar_.EnableTool( self.layout.tbSave.GetId(), True ) + def onNameChanged( self, name ): print "onNameChanged:", name def onTypeChanged( self, name ): print "onTypeChanged:", name - def onPrefixChanged( self, name ): - print "onPrefixChanged:", name - def expand( self ): self.childWindows = [] for c in range( self.window.ChildCount ): - it = self.createChildItem( CEGUIWindow, str( self.window.getChildAtIdx( c ).getName() ) ) - it.window = self.window.getChildAtIdx( c ) - it.expand() - self.childWindows.append( it ) + if '__auto_' not in str( self.window.getChildAtIdx( c ).getName() ): + it = self.createChildItem( CEGUIWindow, str( self.window.getChildAtIdx( c ).getName() ) ) + it.window = self.window.getChildAtIdx( c ) + it.layout = self.layout + it.expand() + self.childWindows.append( it ) self.parent.resourceTree.Expand( self.treeItem ) @@ -208,6 +216,7 @@ def __init__( self, parent, rendererSlot, propertyInspectorSlot ): AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) + self.fullFileName = None self.layoutName = None self.guiSystem = None self.layout = None @@ -239,7 +248,7 @@ , "Reload the current layout" ) - #self.toolBar_.EnableTool( self.tbSave.GetId(), False ) + self.toolBar_.EnableTool( self.tbSave.GetId(), False ) wx.EVT_TOOL( self.toolBar_, self.tbReload.GetId(), self.onReload ) wx.EVT_TOOL( self.toolBar_, self.tbSave.GetId(), self.onSave ) @@ -254,6 +263,7 @@ self.window = self.createChildItem( CEGUIWindow, str( self.layout.getName() ) ) self.window.window = self.layout + self.window.layout = self self.window.expand() def onReload( self, event = None ): @@ -261,18 +271,20 @@ CEGUI.WindowManager.getSingleton().destroyWindow( self.layout ) self.load() self.guiSystem.setGUISheet( self.layout ) + self.parent.statusBar.setStatusMessage( "reloaded: " + self.fullFileName ) def onSave( self, event = None ): #outfile = std.ostream( "test-layout.xml" ) #CEGUI.WindowManager.getSingleton().writeWindowLayoutToStream( self.layout, outfile) - - outfile = open( "test.layout", "w" ) + outfile = open( self.fullFileName, "w" ) xml = XMLSerializer( outfile ) self.window.writeXML( xml ) outfile.close() - + self.toolBar_.EnableTool( self.tbSave.GetId(), False ) + print "wrote: ", self.fullFileName + self.parent.statusBar.setStatusMessage( "wrote: " + self.fullFileName ) class OpengateEditor( AppResource ): def __init__( self, parent, rendererSlot, propertyInspectorSlot ): @@ -390,8 +402,9 @@ if layouts: layoutNode = tree.addItem( None, 'layouts', ceguiNode, True ) for l in layouts: - it = self.createChildItem( CEGUILayout, name = l, parentTreeItem = layoutNode) - it.layoutName = l + it = self.createChildItem( CEGUILayout, name = l[0], parentTreeItem = layoutNode) + it.layoutName = l[0] + it.fullFileName = l[1] it.guiSystem = self.GUISystem @@ -408,7 +421,7 @@ for p in paths: if p[-1] is not '~': if pattern in p: - ret.append( cummulativPath + p ) + ret.append( [cummulativPath + p, os.path.join( path, p ) ] ) elif os.path.isdir( os.path.join( path, p ) ) and p[0] is not '.': dirs.append( p ) Modified: branches/ogEditor/ogEditor/main/mainApp.py =================================================================== --- branches/ogEditor/ogEditor/main/mainApp.py 2009-12-19 16:15:09 UTC (rev 1154) +++ branches/ogEditor/ogEditor/main/mainApp.py 2009-12-19 16:17:41 UTC (rev 1155) @@ -152,7 +152,7 @@ def setStatusMessage( self, msg ): self.statusMsg_ = msg; - #self.SetStatusText( st0, self.msgPosId_ ) + self.SetStatusText( msg, self.msgPosId_ ) def setStatusCounter( self, counter ): self.statusCounter_ = counter; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-19 16:15:18
|
Revision: 1154 http://opengate.svn.sourceforge.net/opengate/?rev=1154&view=rev Author: spom_spom Date: 2009-12-19 16:15:09 +0000 (Sat, 19 Dec 2009) Log Message: ----------- replaced hand-generate cegui-layouts by ogedit-generated Modified Paths: -------------- trunk/data/gui/layouts/dialogs/ConfigDialog.layout trunk/data/gui/layouts/dialogs/MarketDialog.layout trunk/data/gui/layouts/dialogs/MarketItemShortDialog.layout trunk/data/gui/layouts/dialogs/ShipConfigDialog.layout trunk/data/gui/layouts/dialogs/ShipConfigEquipmentButton.layout trunk/data/gui/layouts/opengateConsole.layout trunk/data/gui/layouts/opengateDocked.layout trunk/data/gui/layouts/opengateUnDocked.layout trunk/data/gui/looknfeel/opengateStatic.looknfeel trunk/data/gui/schemes/opengate.scheme trunk/src/BaseDialog.cpp trunk/src/BaseDialog.h trunk/src/GameStateManager.cpp trunk/src/Hud.cpp trunk/src/MarketDialog.cpp trunk/src/SectorMovableObject.h Modified: trunk/data/gui/layouts/dialogs/ConfigDialog.layout =================================================================== --- trunk/data/gui/layouts/dialogs/ConfigDialog.layout 2009-12-18 19:42:42 UTC (rev 1153) +++ trunk/data/gui/layouts/dialogs/ConfigDialog.layout 2009-12-19 16:15:09 UTC (rev 1154) @@ -1,83 +1,226 @@ <?xml version="1.0" encoding="UTF-8"?> -<GUILayout > - <Window Type="opengate/StaticImage" Name="Config/Main" > - <Property Name="InheritsAlpha" Value="False" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> - <Window Type="opengate/StaticImage" Name="Config/MainWindow" > - <Property Name="Image" Value="set:ConfigMainWindow image:full_image" /> +<Window Type="opengate/StaticImage" Name="Config/Main" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="True" /> + <Property Name="InheritsAlpha" Value="False" /> + <Property Name="BackgroundEnabled" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{1,0}}" /> + <Window Type="opengate/StaticImage" Name="Config/MainWindow" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="set:ConfigMainWindow image:full_image" /> + <Property Name="UnifiedPosition" Value="{{0.5,-202},{0,10}}" /> + <Property Name="UnifiedSize" Value="{{0,405},{0,705}}" /> + <Window Type="opengate/StaticImage" Name="Config/MainFrame" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> <Property Name="FrameEnabled" Value="False" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0.5,-202},{0,10},{0.5,203},{0,715}}" /> + <Property Name="InheritsAlpha" Value="True" /> <Property Name="BackgroundEnabled" Value="False" /> - <Window Type="opengate/StaticImage" Name="Config/MainFrame" > + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,60},{0,109}}" /> + <Property Name="UnifiedSize" Value="{{1,-98},{1,-115}}" /> + <Window Type="opengate/Button" Name="Config/ConnectButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Connect" /> + <Property Name="Disabled" Value="True" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,10},{0,10}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/GraphicButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Graphic" /> + <Property Name="Disabled" Value="True" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,10},{0,60}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/SoundButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Sound" /> + <Property Name="Disabled" Value="True" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,10},{0,110}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/ControlsButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Controls" /> + <Property Name="Disabled" Value="True" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,10},{0,160}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/CreditsButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Credits" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,10},{0,210}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/QuitButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Quit" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,10},{0,260}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/Button" Name="Config/BackButton" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Back" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FFFFFFFF" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="CentreAligned" /> + <Property Name="HorzLabelFormatting" Value="CentreAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,10},{1,-40}}" /> + <Property Name="UnifiedSize" Value="{{0,70},{0,30}}" /> + </Window> + <Window Type="opengate/StaticImage" Name="Config/SubFrame" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> <Property Name="FrameEnabled" Value="False" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0,60},{0,109},{1,-38},{1,-6}}" /> + <Property Name="InheritsAlpha" Value="True" /> <Property Name="BackgroundEnabled" Value="False" /> - <Window Type="opengate/Button" Name="Config/ConnectButton" > - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Text" Value="Connect" /> - <Property Name="Disabled" Value="True" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0,10},{0,10},{0,80},{0,40}}" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,90},{0,10}}" /> + <Property Name="UnifiedSize" Value="{{1,-100},{1,-20}}" /> + <Window Type="opengate/StaticLabel" Name="Config/SubFrame/Title" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-18" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{0,30}}" /> </Window> - <Window Type="opengate/Button" Name="Config/GraphicButton" > + <Window Type="opengate/ConsoleListbox" Name="Config/SubFrame/CreditsText" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Text" Value="Graphic" /> - <Property Name="Disabled" Value="True" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0,10},{0,60},{0,80},{0,90}}" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,30}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{1,-30}}" /> </Window> - <Window Type="opengate/Button" Name="Config/SoundButton" > - <Property Name="Text" Value="Sound" /> - <Property Name="Disabled" Value="True" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0,10},{0,110},{0,80},{0,140}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/ControlsButton" > - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Text" Value="Controls" /> - <Property Name="Disabled" Value="True" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0,10},{0,160},{0,80},{0,190}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/CreditsButton" > - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Text" Value="Credits" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0,10},{0,210},{0,80},{0,240}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/QuitButton" > - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="Text" Value="Quit" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0,10},{0,260},{0,80},{0,290}}" /> - </Window> - <Window Type="opengate/Button" Name="Config/BackButton" > - <Property Name="Text" Value="Back" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0,10},{1,-40},{0,80},{1,-10}}" /> - </Window> - <Window Type="opengate/StaticImage" Name="Config/SubFrame" > - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="FrameEnabled" Value="False" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0,90},{0,10},{1,-10},{1,-10}}" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Window Type="opengate/StaticLabel" Name="Config/SubFrame/Title" > - <Property Name="Font" Value="BlueHighway-18" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{0,30}}" /> - </Window> - <Window Type="opengate/ConsoleListbox" Name="Config/SubFrame/CreditsText" > - <Property Name="Font" Value="BlueHighway-12" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedAreaRect" Value="{{0,0},{0,30},{1,0},{1,0}}" /> - </Window> - </Window> </Window> </Window> </Window> -</GUILayout> +</Window> \ No newline at end of file Modified: trunk/data/gui/layouts/dialogs/MarketDialog.layout =================================================================== --- trunk/data/gui/layouts/dialogs/MarketDialog.layout 2009-12-18 19:42:42 UTC (rev 1153) +++ trunk/data/gui/layouts/dialogs/MarketDialog.layout 2009-12-19 16:15:09 UTC (rev 1154) @@ -1,939 +1,2476 @@ -<?xml version="1.0" ?> -<GUILayout> -<!-- used ingame --> - <Window Type="opengate/StaticGreenImage" Name="MarketDialog"> - <Property Name="MousePassThroughEnabled" Value="True" /> - <Property Name="UnifiedPosition" Value="{{0.0, 100},{0.0, 115}}" /> - <Property Name="UnifiedSize" Value="{{1.0, -167},{1.0, -217}}" /> - <Property Name="Text" Value="Market" /> +<?xml version="1.0" encoding="UTF-8"?> -<!-- ********************* --> -<!-- Item Detailed View --> -<!-- ********************* --> - -<!-- used ingame --> - <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView"> - <Property Name="UnifiedPosition" Value="{{0,220},{0.0,10}}" /> - <Property Name="UnifiedSize" Value="{{1.0,-230},{1.0,-170}}" /> - <Property Name="BackgroundEnabled" Value="True" /> - <Property Name="FrameEnabled" Value="True" /> - <Property Name="Visible" Value="False" /> - <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/TopLeft"> - <Property Name="UnifiedPosition" Value="{{0.0, 0},{0.0, 0}}" /> - <Property Name="UnifiedSize" Value="{{0.0, 31},{0.0, 31}}" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Property Name="Image" Value="set:opengate image:StaticGreenTopLeft"/> - </Window> - <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/Top"> - <Property Name="UnifiedPosition" Value="{{0.0, 31},{ 0.0, 0}}" /> - <Property Name="UnifiedSize" Value="{{1.0, -62},{ 0.0, 31}}" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Property Name="Image" Value="set:opengate image:StaticGreenTop"/> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/Top/Title"> - <Property Name="UnifiedPosition" Value="{{0.0, 10},{ 0.0, 10}}" /> - <Property Name="UnifiedSize" Value="{{1.0, 0},{ 0.0, 20}}" /> - <Property Name="Text" Value="Would you like to purchase this item?" /> - <Property Name="Font" Value="BlueHighway-16" /> - </Window> - </Window> - <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/TopRight"> - <Property Name="UnifiedPosition" Value="{{1.0, -31},{ 0.0, 0}}" /> - <Property Name="UnifiedSize" Value="{{0.0, 31},{ 0.0, 31}}" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Property Name="Image" Value="set:opengate image:StaticGreenTopRight"/> - </Window> - <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/Image/Frame"> - <!-- Filled within game --> - <Property Name="UnifiedPosition" Value="{{0.0, 20},{0.5, -145}}" /> - <Property Name="UnifiedSize" Value="{{0.0, 290},{0.0, 290}}" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/Image"> - <!-- Filled within game --> - <Property Name="UnifiedPosition" Value="{{0.0, 0},{0.0, 0}}" /> - <Property Name="UnifiedSize" Value="{{1.0, 0},{1.0, 0}}" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - </Window> - </Window> - <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/TextFrame"> - <Property Name="UnifiedPosition" Value="{{0.0, 330},{0.5, -145}}" /> - <Property Name="UnifiedSize" Value="{{0.0, 250},{0.0, 290}}" /> - <Property Name="BackgroundEnabled" Value="False" /> - <Property Name="FrameEnabled" Value="False" /> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Name"> - <Property Name="UnifiedPosition" Value="{{0.0, 0},{0.0, 0}}" /> - <Property Name="UnifiedSize" Value="{{1.0, 0},{0.0, 20}}" /> - <Property Name="Text" Value="Name:" /> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Name/Text"> - <Property Name="UnifiedPosition" Value="{{0.0, 100},{0.0, 0}}" /> - <Property Name="UnifiedSize" Value="{{1.0, -100},{1.0, 0}}" /> - </Window> - </Window> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Size"> - <Property Name="UnifiedPosition" Value="{{0.0, 0},{0.0, 20}}" /> - <Property Name="UnifiedSize" Value="{{1.0, 0},{0.0, 20}}" /> - <Property Name="Text" Value="Size:" /> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Size/Text"> - <Property Name="UnifiedPosition" Value="{{0.0, 100},{0.0, 0}}" /> - <Property Name="UnifiedSize" Value="{{1.0, -100},{1.0, 0}}" /> - </Window> - </Window> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Mass"> - <Property Name="UnifiedPosition" Value="{{0.0, 0},{0.0, 40}}" /> - <Property Name="UnifiedSize" Value="{{1.0, 0},{0.0, 20}}" /> - <Property Name="Text" Value="Mass:" /> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Mass/Text"> - <Property Name="UnifiedPosition" Value="{{0.0, 100},{0.0, 0}}" /> - <Property Name="UnifiedSize" Value="{{1.0, -100},{1.0, 0}}" /> - </Window> - </Window> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs"> - <Property Name="UnifiedPosition" Value="{{0.0, 0},{0.0, 100}}" /> - <Property Name="UnifiedSize" Value="{{1.0, 0},{1.0, -80}}" /> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs1a"> - <Property Name="UnifiedPosition" Value="{{0.0, 0},{0.0, 0}}" /> - <Property Name="UnifiedSize" Value="{{0.0, 100},{0.0, 20}}" /> +<Window Type="opengate/StaticGreenImage" Name="MarketDialog" > + <Property Name="Visible" Value="True" /> + <Property Name="Text" Value="Market" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="True" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="True" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,115}}" /> + <Property Name="UnifiedSize" Value="{{1,-167},{1,-217}}" /> + <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="False" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="True" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,220},{0,10}}" /> + <Property Name="UnifiedSize" Value="{{1,-230},{1,-170}}" /> + <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/TopLeft" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="set:opengate image:StaticGreenTopLeft" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{0,31},{0,31}}" /> + </Window> + <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/Top" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="set:opengate image:StaticGreenTop" /> + <Property Name="UnifiedPosition" Value="{{0,31},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,-62},{0,31}}" /> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/Top/Title" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="Would you like to purchase this item?" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="False" /> + <Property Name="AlwaysOnTop" Value="True" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-16" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,10},{0,10}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{0,20}}" /> </Window> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs1b"> - <Property Name="UnifiedPosition" Value="{{0.0, 100},{0.0, 0}}" /> - <Property Name="UnifiedSize" Value="{{0.0, 50},{0.0, 20}}" /> + </Window> + <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/TopRight" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="set:opengate image:StaticGreenTopRight" /> + <Property Name="UnifiedPosition" Value="{{1,-31},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{0,31},{0,31}}" /> + </Window> + <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/Image/Frame" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,20},{0.5,-145}}" /> + <Property Name="UnifiedSize" Value="{{0,290},{0,290}}" /> + <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/Image" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{1,0}}" /> </Window> - - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs2a"> - <Property Name="UnifiedPosition" Value="{{0.0, 0},{0.0, 20}}" /> - <Property Name="UnifiedSize" Value="{{0.0, 100},{0.0, 20}}" /> + </Window> + <Window Type="opengate/StaticGreenImage" Name="MarketItemDetailedView/TextFrame" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="FrameEnabled" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="BackgroundEnabled" Value="False" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="Image" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,330},{0.5,-145}}" /> + <Property Name="UnifiedSize" Value="{{0,250},{0,290}}" /> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Name" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="Name:" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{0,20}}" /> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Name/Text" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,-100},{1,0}}" /> + </Window> </Window> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs2b"> - <Property Name="UnifiedPosition" Value="{{0.0, 100},{0.0, 20}}" /> - <Property Name="UnifiedSize" Value="{{0.0, 50},{0.0, 20}}" /> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Size" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="Size:" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,20}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{0,20}}" /> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Size/Text" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,-100},{1,0}}" /> + </Window> </Window> - - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs3a"> - <Property Name="UnifiedPosition" Value="{{0.0, 0},{0.0, 40}}" /> - <Property Name="UnifiedSize" Value="{{0.0, 100},{0.0, 20}}" /> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Mass" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="Mass:" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,40}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{0,20}}" /> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/TextFrame/Mass/Text" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{1,-100},{1,0}}" /> + </Window> </Window> - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs3b"> - <Property Name="UnifiedPosition" Value="{{0.0, 100},{0.0, 40}}" /> - <Property Name="UnifiedSize" Value="{{0.0, 50},{0.0, 20}}" /> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,100}}" /> + <Property Name="UnifiedSize" Value="{{1,0},{1,-80}}" /> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs1a" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{0,100},{0,20}}" /> + </Window> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs1b" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,0}}" /> + <Property Name="UnifiedSize" Value="{{0,50},{0,20}}" /> + </Window> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs2a" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,20}}" /> + <Property Name="UnifiedSize" Value="{{0,100},{0,20}}" /> + </Window> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs2b" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,20}}" /> + <Property Name="UnifiedSize" Value="{{0,50},{0,20}}" /> + </Window> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs3a" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,40}}" /> + <Property Name="UnifiedSize" Value="{{0,100},{0,20}}" /> + </Window> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs3b" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,40}}" /> + <Property Name="UnifiedSize" Value="{{0,50},{0,20}}" /> + </Window> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs4a" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,60}}" /> + <Property Name="UnifiedSize" Value="{{0,100},{0,20}}" /> + </Window> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs4b" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,60}}" /> + <Property Name="UnifiedSize" Value="{{0,50},{0,20}}" /> + </Window> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs5a" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,0},{0,80}}" /> + <Property Name="UnifiedSize" Value="{{0,100},{0,20}}" /> + </Window> + <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs5b" > + <Property Name="Visible" Value="False" /> + <Property Name="Text" Value="" /> + <Property Name="Disabled" Value="False" /> + <Property Name="RiseOnClick" Value="True" /> + <Property Name="AlwaysOnTop" Value="False" /> + <Property Name="InheritsAlpha" Value="True" /> + <Property Name="MousePassThroughEnabled" Value="False" /> + <Property Name="Font" Value="BlueHighway-12" /> + <Property Name="NormalTextColour" Value="FF88D997" /> + <Property Name="HoverTextColour" Value="00000000" /> + <Property Name="DisabledTextColour" Value="FF7F7F7F" /> + <Property Name="VertLabelFormatting" Value="LeftAligned" /> + <Property Name="HorzLabelFormatting" Value="TopAligned" /> + <Property Name="HoverImage" Value="" /> + <Property Name="NormalImage" Value="" /> + <Property Name="PushedImage" Value="" /> + <Property Name="UnifiedPosition" Value="{{0,100},{0,80}}" /> + <Property Name="UnifiedSize" Value="{{0,50},{0,20}}" /> + </Window> </Window> - - <Window Type="opengate/StaticLabel" Name="MarketItemDetailedView/EquipmentSpecs4a"> - <Property Name="UnifiedPosition" Value="{{0.0, 0},{0.0, 60}}" /> - <Property Name="UnifiedSize" Value="{{0.0, 100},{0.0, ... [truncated message content] |
From: <spo...@us...> - 2009-12-18 19:42:51
|
Revision: 1153 http://opengate.svn.sourceforge.net/opengate/?rev=1153&view=rev Author: spom_spom Date: 2009-12-18 19:42:42 +0000 (Fri, 18 Dec 2009) Log Message: ----------- ogedit: cegui layouts can now be saved Modified Paths: -------------- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py Modified: branches/ogEditor/ogEditor/apps/opengate/opengateedit.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-18 16:13:36 UTC (rev 1152) +++ branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-18 19:42:42 UTC (rev 1153) @@ -21,48 +21,140 @@ from ogEditor.wxpg import wxpg, HAVE_PROPGRID, wxPropGridWrapper +class XMLSerializer(): + """ + based on CEGUI::XMLSerializer since there are some "No to_python (by-value) converter found for C++ type" + """ + def __init__( self, fi, indentSpace = 4 ): + self.fi = fi + self.indentSpace_ = indentSpace + self.tagCount_ = 0 + self.fi.write( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ) + self.needClose_ = False + self.lastIsText_ = False + self.depth_ = 0 + self.tagStack_ = [] + + def __del__( self ): + self.fi.close() + + def openTag( self, name ): + self.tagCount_ += 1 + if self.needClose_: self.fi.write( '>') + + if not self.lastIsText_: + self.fi.write( '\n') + self.indentLine(); + + self.fi.write( '<' + str( name ) + ' ' ) + self.tagStack_.append( name ) + self.depth_ += 1 + self.needClose_ = True + self.lastIsText_ = False + + return self + + def closeTag( self ): + back = self.tagStack_.pop( -1 ) + + self.depth_ -= 1; + if self.needClose_: + self.fi.write( "/>" ) + elif not self.lastIsText_: + self.fi.write( "\n" ) + self.indentLine(); + self.fi.write( "</" + str( back )+ '>' ); + else: + self.fi.write( "</" + str( back )+ '>' ); + + self.lastIsText_ = False + self.needClose_ = False; + + return self + + def attribute( self, name, value): + if not self.needClose_: + pass + else: + self.fi.write( str( name ) + '="' + str( value ) + '" ' ); + + self.lastIsText_ = False + return self + + def text( self, text ): + if self.needClose_: + self.fi.write( '>' ) + self.needClose_ = False; + + self.fi.write( str( text ) ) + self.lastIsText_ = True; + + return self + + def getTagCount( self ): return self.tagCount_ + + def indentLine( self ): + for i in range( self.depth_ * self.indentSpace_ ): + self.fi.write( ' ' ) + + class CEGUIWindow( AppResource ): + props = [ [ "Visible", bool ] + , [ "Text", str ] + , [ "Disabled", bool ] + , [ "RiseOnClick", bool ] + , [ "AlwaysOnTop", bool ] + , [ "FrameEnabled", bool ] + , [ "BackgroundEnabled", bool ] + , [ "MousePassThroughEnabled", bool ] + , [ "Font", str ] + , [ "Image", str ] + , [ "HoverImage", str ] + , [ "NormalImage", str ] + , [ "PushedImage", str ] + #, [ "UnifiedAreaRect", str ] + , [ "UnifiedPosition", str ] + , [ "UnifiedSize", str ] + ] + def __init__( self, parent, rendererSlot, propertyInspectorSlot ): AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) self.window = None - + self.childWindows = [] + def createPropertyPanel( self, parent ): if not HAVE_PROPGRID: return wx.Panel( parent ) panel = wxPropGridWrapper( parent ) panel.Append( wxpg.PropertyCategory("CEGUI.Window") ) + + prop = wxpg.StringProperty( "Name", value = str( self.window.getName() ) ) + panel.append( prop, self.onNameChanged ) + prop = wxpg.StringProperty( "Type", value = str( self.window.getType() ) ) + panel.append( prop, self.onTypeChanged ) + self.fillPG( panel, self.window, self.onWindowPropertyChanged ) return panel def fillPG( self, panel, obj, target ): #self.window.getIterator lacks python converter :( - props = [ [ "Text", str ] - , [ "Disabled", bool ] - , [ "RiseOnClick", bool ] - , [ "FrameEnabled", bool ] - , [ "BackgroundEnabled", bool ] - , [ "MousePassThroughEnabled", bool ] - , [ "Font", str ] - , [ "Image", str ] - , [ "HoverImage", str ] - , [ "NormalImage", str ] - , [ "PushedImage", str ] - , [ "UnifiedAreaRect", str ] - - ] + for k in props: name = k[0] typ = k[1] - print "name", name, typ + if obj.isPropertyPresent( name ): val = obj.getProperty( name ) - print "val:", val, str( val ) if typ == bool: - if val == True: + if val == 'True': prop = wxpg.BoolProperty( name, value = True ) else: prop = wxpg.BoolProperty( name, value = False ) + + prop.DoSetAttribute( 'UseCheckbox', 1 ) + prop.DoSetAttribute( 'UseDClickCycling', 1 ) + elif typ == str: prop = wxpg.StringProperty( name, value = str( val ) )#str( val ) ) @@ -74,14 +166,43 @@ self.window.setProperty( name, str( value ) ) #getattr( self.axes, name )( value ) - + def onNameChanged( self, name ): + print "onNameChanged:", name + + def onTypeChanged( self, name ): + print "onTypeChanged:", name + + def onPrefixChanged( self, name ): + print "onPrefixChanged:", name + def expand( self ): + self.childWindows = [] for c in range( self.window.ChildCount ): it = self.createChildItem( CEGUIWindow, str( self.window.getChildAtIdx( c ).getName() ) ) it.window = self.window.getChildAtIdx( c ) it.expand() + self.childWindows.append( it ) self.parent.resourceTree.Expand( self.treeItem ) + + def writeXML( self, xml ): + xml.openTag( 'Window' ) + xml.attribute( "Type", self.window.getType()); + xml.attribute( "Name", self.window.getName()); + for p in self.props: + name = p[0] + typ = p[1] + if self.window.isPropertyPresent( name ): + val = self.window.getProperty( name ) + xml.openTag( 'Property' ) + xml.attribute( "Name", name ); + xml.attribute( "Value", str( val ) ); + xml.closeTag( ) + + for c in self.childWindows: + c.writeXML( xml ) + + xml.closeTag( ) class CEGUILayout( AppResource ): def __init__( self, parent, rendererSlot, propertyInspectorSlot ): @@ -91,6 +212,7 @@ self.guiSystem = None self.layout = None self.toolBar_ = None + self.window = None def activate( self, active ): self.activateToolBar_( self.getToolBar( self.parent ), active ) @@ -129,13 +251,11 @@ self.parent.resourceTree.DeleteChildren( self.treeItem ) - it = self.createChildItem( CEGUIWindow, str( self.layout.getName() ) ) + self.window = self.createChildItem( CEGUIWindow, str( self.layout.getName() ) ) - it.window = self.layout - it.expand() - + self.window.window = self.layout + self.window.expand() - def onReload( self, event = None ): if self.layout is not None: CEGUI.WindowManager.getSingleton().destroyWindow( self.layout ) @@ -143,10 +263,16 @@ self.guiSystem.setGUISheet( self.layout ) def onSave( self, event = None ): - #outfile = open( "test-layout.xml", "w" ) - outfile = std.ostream( "test-layout.xml" ) - CEGUI.WindowManager.getSingleton().writeWindowLayoutToStream( self.layout, outfile) + + #outfile = std.ostream( "test-layout.xml" ) + #CEGUI.WindowManager.getSingleton().writeWindowLayoutToStream( self.layout, outfile) + + outfile = open( "test.layout", "w" ) + + xml = XMLSerializer( outfile ) + self.window.writeXML( xml ) outfile.close() + class OpengateEditor( AppResource ): def __init__( self, parent, rendererSlot, propertyInspectorSlot ): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-18 16:13:46
|
Revision: 1152 http://opengate.svn.sourceforge.net/opengate/?rev=1152&view=rev Author: spom_spom Date: 2009-12-18 16:13:36 +0000 (Fri, 18 Dec 2009) Log Message: ----------- ogedit. opengate layouts can now be edited (basically) Modified Paths: -------------- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py branches/ogEditor/ogEditor/base/base.py branches/ogEditor/ogEditor/controls/resourceTree.py branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py Added Paths: ----------- branches/ogEditor/ogEditor/resources/icons/document-save.png branches/ogEditor/ogEditor/resources/icons/view-refresh.png branches/ogEditor/ogEditor/wxpg/ branches/ogEditor/ogEditor/wxpg/__init__.py branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py Modified: branches/ogEditor/ogEditor/apps/opengate/opengateedit.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-17 23:21:18 UTC (rev 1151) +++ branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-18 16:13:36 UTC (rev 1152) @@ -10,25 +10,144 @@ import ogre.gui.CEGUI as CEGUI +try: + from agw import aui + from agw.aui import aui_switcherdialog as ASD +except ImportError: # if it's not there locally, try the wxPython lib. + import wx.lib.agw.aui as aui + from wx.lib.agw.aui import aui_switcherdialog as ASD -#from ogEditor.resources import loadIcon, MakeDisabledBitmap +from ogEditor.resources import loadIcon, MakeDisabledBitmap +from ogEditor.wxpg import wxpg, HAVE_PROPGRID, wxPropGridWrapper -class CEGUILayout(): - def __init__( self, name, system ): - self.layoutName = name - self.guiSystem = system +class CEGUIWindow( AppResource ): + def __init__( self, parent, rendererSlot, propertyInspectorSlot ): + AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) + self.window = None + + def createPropertyPanel( self, parent ): + if not HAVE_PROPGRID: + return wx.Panel( parent ) + + panel = wxPropGridWrapper( parent ) + panel.Append( wxpg.PropertyCategory("CEGUI.Window") ) + self.fillPG( panel, self.window, self.onWindowPropertyChanged ) + return panel + + def fillPG( self, panel, obj, target ): + #self.window.getIterator lacks python converter :( + props = [ [ "Text", str ] + , [ "Disabled", bool ] + , [ "RiseOnClick", bool ] + , [ "FrameEnabled", bool ] + , [ "BackgroundEnabled", bool ] + , [ "MousePassThroughEnabled", bool ] + , [ "Font", str ] + , [ "Image", str ] + , [ "HoverImage", str ] + , [ "NormalImage", str ] + , [ "PushedImage", str ] + , [ "UnifiedAreaRect", str ] + + ] + for k in props: + name = k[0] + typ = k[1] + print "name", name, typ + if obj.isPropertyPresent( name ): + val = obj.getProperty( name ) + print "val:", val, str( val ) + if typ == bool: + if val == True: + prop = wxpg.BoolProperty( name, value = True ) + else: + prop = wxpg.BoolProperty( name, value = False ) + elif typ == str: + prop = wxpg.StringProperty( name, value = str( val ) )#str( val ) ) + + panel.append( prop, self.onWindowPropertyChanged ) #, toolTip = obj.__getattribute__( att ).__doc__ ) + + + def onWindowPropertyChanged( self, name, value ): + print "onWindowPropertyChanged:", name, value + self.window.setProperty( name, str( value ) ) + #getattr( self.axes, name )( value ) + + + def expand( self ): + for c in range( self.window.ChildCount ): + it = self.createChildItem( CEGUIWindow, str( self.window.getChildAtIdx( c ).getName() ) ) + it.window = self.window.getChildAtIdx( c ) + it.expand() + + self.parent.resourceTree.Expand( self.treeItem ) + +class CEGUILayout( AppResource ): + def __init__( self, parent, rendererSlot, propertyInspectorSlot ): + AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) + + self.layoutName = None + self.guiSystem = None self.layout = None + self.toolBar_ = None def activate( self, active ): - print "activate ", active, self.layoutName + self.activateToolBar_( self.getToolBar( self.parent ), active ) if active: if self.layout is None: - self.layout = CEGUI.WindowManager.getSingleton().loadWindowLayout( self.layoutName ) + self.load( ) + self.guiSystem.setGUISheet( self.layout ) + def getToolBar( self, parent ): + if self.toolBar_ is None: + self.toolBar_ = aui.AuiToolBar( parent, -1, wx.DefaultPosition, wx.DefaultSize, + aui.AUI_TB_DEFAULT_STYLE | aui.AUI_TB_PLAIN_BACKGROUND ) + + self.toolBar_.SetName( "CEGUI-layout Toolbar" ) + + self.toolBar_.SetToolBitmapSize( wx.Size( 22, 22 ) ) + + self.tbSave = self.toolBar_.AddSimpleTool( wx.NewId(), "Save", loadIcon( "document-save.png" ) + , "Save current project" + ) + self.tbSave.SetDisabledBitmap( MakeDisabledBitmap( loadIcon( "document-save.png" ) ) ) + + self.tbReload = self.toolBar_.AddSimpleTool( wx.NewId(), "Reload", loadIcon( "view-refresh.png" ) + , "Reload the current layout" + ) + + #self.toolBar_.EnableTool( self.tbSave.GetId(), False ) + + wx.EVT_TOOL( self.toolBar_, self.tbReload.GetId(), self.onReload ) + wx.EVT_TOOL( self.toolBar_, self.tbSave.GetId(), self.onSave ) + + return self.toolBar_ + + def load( self ): + self.layout = CEGUI.WindowManager.getSingleton().loadWindowLayout( self.layoutName ) + + self.parent.resourceTree.DeleteChildren( self.treeItem ) + + it = self.createChildItem( CEGUIWindow, str( self.layout.getName() ) ) + + it.window = self.layout + it.expand() + + + + def onReload( self, event = None ): + if self.layout is not None: + CEGUI.WindowManager.getSingleton().destroyWindow( self.layout ) + self.load() self.guiSystem.setGUISheet( self.layout ) + + def onSave( self, event = None ): + #outfile = open( "test-layout.xml", "w" ) + outfile = std.ostream( "test-layout.xml" ) + CEGUI.WindowManager.getSingleton().writeWindowLayoutToStream( self.layout, outfile) + outfile.close() -#class OgreTest( ): class OpengateEditor( AppResource ): def __init__( self, parent, rendererSlot, propertyInspectorSlot ): AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) @@ -39,31 +158,13 @@ self.sceneManager = None self.GUIRenderer = None self.GUISystem = None - ## optionaly load content informations for this application, generated by an gui-builder that wrote xrc-files - ## eg. wxFormBuilder, __file__ is needed to find the xrc-file - #self.loadXRC( 'testapp.xrc', __file__ ) + self.parentResource = self - ## register a menu to the main-MenuBar, using this function ensures that this menu will be shown/hiden respective to the activate status of the application - #self.mbTestMenu = self.createMainMenu( '&Test Ogre' ) - - ## create an item to to the test menu - #self.createMenuItem( self.mbTestMenu - #, name = "Test Menu item" - #, help = "Test Menu item" - #, function = self.menuFunction ) - - ## the application has some properties that can be altered by the property inspector (PI), loaded and saved - #self.titleTextProp = self.appendProperty( "Title", default = 'unknown', valType = str ) - - # do some stuff after this application has created and registered to the resourcetree - #self.parent.addCommandToOnIdleQueue( self.postCreate ) pass def postCreate( self ): pass - #self.createSubPanel( TestMPLApp, "wxMPL" ) - #self.createSubPanel( TestVTKApp, "wxVTK" ) - + #def createPropertyPanel( self, parent ): #""" #Define and return panel that is shown in the property-inspector (PI) @@ -96,7 +197,6 @@ if CEGUI.Version__.startswith ("0.6"): self.GUIRenderer = CEGUI.OgreCEGUIRenderer(self.renderer_.renderWindow, - #self.GUIRenderer = CEGUI.OgreRenderer(self.renderWindow, ogre.RENDER_QUEUE_OVERLAY, False, 3000, self.sceneManager) self.GUISystem = CEGUI.System(self.GUIRenderer) else: @@ -162,9 +262,11 @@ layouts = self.findResources( 'gui/layouts', '.layout' ) if layouts: - layoutNode = tree.addItem( None, 'layouts', ceguiNode ) + layoutNode = tree.addItem( None, 'layouts', ceguiNode, True ) for l in layouts: - tree.addItem( CEGUILayout( l, self.GUISystem ), l, layoutNode ) + it = self.createChildItem( CEGUILayout, name = l, parentTreeItem = layoutNode) + it.layoutName = l + it.guiSystem = self.GUISystem def findResources( self, filesystem, pattern ): @@ -178,10 +280,11 @@ dirs = [] for p in paths: - if pattern in p: - ret.append( cummulativPath + p ) - elif os.path.isdir( os.path.join( path, p ) ) and p[0] is not '.': - dirs.append( p ) + if p[-1] is not '~': + if pattern in p: + ret.append( cummulativPath + p ) + elif os.path.isdir( os.path.join( path, p ) ) and p[0] is not '.': + dirs.append( p ) for d in dirs: findFiles( os.path.join( path, d), pattern, ret, cummulativPath + d + '/' ) Modified: branches/ogEditor/ogEditor/base/base.py =================================================================== --- branches/ogEditor/ogEditor/base/base.py 2009-12-17 23:21:18 UTC (rev 1151) +++ branches/ogEditor/ogEditor/base/base.py 2009-12-18 16:13:36 UTC (rev 1152) @@ -420,41 +420,25 @@ r.AddPage( panel, name, False ); self.parent.resourceTree.addItem( panel, name, self.treeItem ) - panel.parentResource = self + panel.parentResource = self.parentResource self.subPanels.append( panel ) return panel else: raise Exception( "createSubPanel only defined for application with notebook renderer" ) + + def createChildItem( self, classname, name = None, parentTreeItem = None): + if parentTreeItem is None: + parentTreeItem = self.treeItem + item = classname( self.parent, None, self.propertyInspectorSlot_ ) + self.parent.resourceTree.addItem( item, name, parentTreeItem ) + item.parentResource = self.parentResource - #def parentActivate( self, active ): - #if active == self.parentActive: - #return + return item - #self.parentActive = active - #r = self.getRendererTab( self.rendererSlot ) - #if active: - ##print "activate: ", self.titleTextProp() - #self.rendererSlot.GetSizer().Add( r, 1, wx.EXPAND, 0 ) - #self.rendererSlot.GetSizer().Layout() - #r.Show() - #else: - ##print "deactivate: ", self.titleTextProp() - #r.Hide() - #self.rendererSlot.GetSizer().Detach( r ) - #self.rendererSlot.GetSizer().Layout() - - #if active: - #self.parent.GetMenuBar().Insert( 1, self.mbProfileMenu, "&Profile" ) - #else: - #self.parent.GetMenuBar().Remove( 1 ) - - #self.activateToolBar( active ) - #self.parent.auiMgr.Update() - def propertyChanged( self ): """ - """ + """ if self.parentResource is not None: self.parentResource.propertyChanged() Modified: branches/ogEditor/ogEditor/controls/resourceTree.py =================================================================== --- branches/ogEditor/ogEditor/controls/resourceTree.py 2009-12-17 23:21:18 UTC (rev 1151) +++ branches/ogEditor/ogEditor/controls/resourceTree.py 2009-12-18 16:13:36 UTC (rev 1152) @@ -33,6 +33,7 @@ parentNode = self.root item = self.AppendItem( parentNode, name ); + #print "append", name, " at ", self.GetItemText( parentNode ) if data is not None: self.SetPyData( item, data ) data.treeItem = item Added: branches/ogEditor/ogEditor/resources/icons/document-save.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/ogEditor/resources/icons/document-save.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/ogEditor/resources/icons/view-refresh.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/ogEditor/resources/icons/view-refresh.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py =================================================================== --- branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-17 23:21:18 UTC (rev 1151) +++ branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-18 16:13:36 UTC (rev 1152) @@ -40,8 +40,7 @@ baseClass = wx.PyWindow - -if os.name == "Posix": +if os.name == "posix": import wx.glcanvas baseClass = wx.glcanvas.GLCanvas @@ -52,23 +51,20 @@ def __init__( self, parent, ID = -1, size = wx.Size( 1280, 1024 ), renderSystem = "OpenGL", **kwargs ): if 'resourceFile' in kwargs: self.resourceFile = kwargs[ 'resourceFile' ] - del kwargs[ 'resourceFile' ] + del kwargs[ 'resourceFile' ] else: self.resourceFile = 'resources.cfg' - if os.name == "Posix": + if os.name == "posix": wx.glcanvas.GLCanvas.__init__( self, parent , size = parent.GetSize() #, style = wx.WANTS_CHARS | , style = wx.NO_FULL_REPAINT_ON_RESIZE , attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER] ) - else: - wx.PyWindow.__init__( self, parent, ID, size = size, **kwargs ) - - - + else: + wx.PyWindow.__init__( self, parent, ID, size = size, **kwargs ) - print self.resourceFile +# print self.resourceFile self.parent = parent self.parent.Show() @@ -125,7 +121,7 @@ parent = lastValid.GetParent() #print "windowhandle = ", handle - if os.name == 'Posix': + if os.name == 'posix': handle = wx.glcanvas.GLCanvas.GetHandle( self ) else: handle = wx.PyWindow.GetHandle( self ) Added: branches/ogEditor/ogEditor/wxpg/__init__.py =================================================================== --- branches/ogEditor/ogEditor/wxpg/__init__.py (rev 0) +++ branches/ogEditor/ogEditor/wxpg/__init__.py 2009-12-18 16:13:36 UTC (rev 1152) @@ -0,0 +1,15 @@ +# -*- coding: iso-8859-1 -*- + +try: + from wxPropGridWrapper import wxpg, wxPropGridWrapper + HAVE_PROPGRID = True +except Exception, e: + print e + print "no wxPropertyGrid installation found" + print "for wxPython-2.8 install from http://wxpropgrid.sourceforge.net/cgi-bin/index" + print "wxPython-2.9 and later should contain wxpg" + + HAVE_PROPGRID = False + wxpg = None + wxPropGridWrapper = None + Added: branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py =================================================================== --- branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py (rev 0) +++ branches/ogEditor/ogEditor/wxpg/wxPropGridWrapper.py 2009-12-18 16:13:36 UTC (rev 1152) @@ -0,0 +1,37 @@ +# -*- coding: iso-8859-1 -*- + +import wx.propgrid as wxpg + +import wx + +class wxPropGridWrapper( wxpg.PropertyGridManager ): + def __init__( self, parent ): + wxpg.PropertyGridManager.__init__( self, parent, style = wxpg.PG_SPLITTER_AUTO_CENTER) + # Show help as tooltips + self.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) + self.proxyList = [] + + self.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) + self.Bind( wxpg.EVT_PG_CHANGED, self.onPropGridChange ) + + def append( self, prop, cback = None, toolTip = None, parent = None ): + prop.SetClientData( cback ) + if toolTip: + prop.SetHelpString( toolTip ) + else: + prop.SetHelpString( "no help for this" ) + + if not parent: + self.Append( prop ) + else: + self.AppendIn( parent, prop ) + return prop + + def onPropGridChange(self, event): + p = event.GetProperty() + if p: + print '%s changed to "%s"'%(p.GetName(),p.GetValueAsString()) + print "GetValue", p.GetValue() + #print "GetValueRef", p.GetValueRef() + if p.GetClientData(): + p.GetClientData()( name = p.GetName(), value = p.GetValue() ) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |