From: Mike G. <xo...@us...> - 2005-08-31 19:08:17
|
Update of /cvsroot/planeshift/planeshift/src/eedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5908/eedit Modified Files: eeditfpstoolbox.cpp eeditfpstoolbox.h Log Message: - Some 64-bit error and warning fixes by Arianna. Index: eeditfpstoolbox.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/eedit/eeditfpstoolbox.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** eeditfpstoolbox.cpp 3 Aug 2005 08:50:40 -0000 1.1 --- eeditfpstoolbox.cpp 31 Aug 2005 19:08:07 -0000 1.2 *************** *** 1,103 **** ! /* ! * Author: Andrew Robberts ! * ! * Copyright (C) 2003 Atomic Blue (in...@pl..., http://www.atomicblue.org) ! * ! * ! * 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 (version 2 of the License) ! * 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 <psconfig.h> ! #include <iutil/cfgmgr.h> ! ! #include "eeditfpstoolbox.h" ! #include "eeditglobals.h" ! ! #include "paws/pawsmanager.h" ! #include "paws/pawstextbox.h" ! #include "paws/pawsspinbox.h" ! ! SCF_IMPLEMENT_IBASE(EEditFPSToolbox) ! SCF_IMPLEMENT_IBASE_END ! ! EEditFPSToolbox::EEditFPSToolbox(PawsManager* manager) ! :EEditToolbox(), pawsWidget(manager) ! { ! SCF_CONSTRUCT_IBASE(0); ! ! fps = 60.0f; ! framesCount = 0; ! framesElapsed = 0; ! } ! ! EEditFPSToolbox::~EEditFPSToolbox() ! { ! editApp->SetConfigFloat("EEdit.TargetFPS", fpsTarget->GetValue()); ! SCF_DESTRUCT_IBASE(); ! } ! ! float EEditFPSToolbox::GetFPS() const ! { ! return fps; ! } ! ! float EEditFPSToolbox::GetTargetFPS() const ! { ! return fpsTarget->GetValue(); ! } ! ! ! void EEditFPSToolbox::Update(unsigned int elapsed) ! { ! ++framesCount; ! framesElapsed += elapsed; ! if (framesElapsed > 1000) ! { ! fps = ((float)framesCount / (float)framesElapsed) * 1000.0f; ! framesCount = 0; ! framesElapsed = 0; ! ! csString fpsText; ! fpsText.Format("%5.1f", fps); ! fpsDisplay->SetText(fpsText); ! SetTitle("FPS - " + fpsText); ! } ! } ! ! size_t EEditFPSToolbox::GetType() const ! { ! return T_FPS; ! } ! ! char * EEditFPSToolbox::GetName() const ! { ! return "FPS"; ! } ! ! bool EEditFPSToolbox::PostSetup() ! { ! fpsDisplay = (pawsTextBox *) FindWidget("fps"); CS_ASSERT(fps); ! fpsTarget = (pawsSpinBox *) FindWidget("fps_target"); CS_ASSERT(fpsTarget); ! float target = editApp->GetConfigFloat("EEdit.TargetFPS", 60.0f); ! if (target < 1.0f) ! target = 1.0f; ! fpsTarget->SetValue(target); ! ! return true; ! } ! ! bool EEditFPSToolbox::OnButtonPressed(int mouseButton, int keyModifier, pawsWidget * widget) ! { ! return false; ! } ! --- 1,206 ---- ! /* ! ! * Author: Andrew Robberts ! ! * ! ! * Copyright (C) 2003 Atomic Blue (in...@pl..., http://www.atomicblue.org) ! ! * ! ! * ! ! * 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 (version 2 of the License) ! ! * 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 <psconfig.h> ! ! #include <iutil/cfgmgr.h> ! ! ! ! #include "eeditfpstoolbox.h" ! ! #include "eeditglobals.h" ! ! ! ! #include "paws/pawsmanager.h" ! ! #include "paws/pawstextbox.h" ! ! #include "paws/pawsspinbox.h" ! ! ! ! SCF_IMPLEMENT_IBASE(EEditFPSToolbox) ! ! SCF_IMPLEMENT_IBASE_END ! ! ! ! EEditFPSToolbox::EEditFPSToolbox(PawsManager* manager) ! ! :EEditToolbox(), pawsWidget(manager) ! ! { ! ! SCF_CONSTRUCT_IBASE(0); ! ! ! ! fps = 60.0f; ! ! framesCount = 0; ! ! framesElapsed = 0; ! ! } ! ! ! ! EEditFPSToolbox::~EEditFPSToolbox() ! ! { ! ! editApp->SetConfigFloat("EEdit.TargetFPS", fpsTarget->GetValue()); ! ! SCF_DESTRUCT_IBASE(); ! ! } ! ! ! ! float EEditFPSToolbox::GetFPS() const ! ! { ! ! return fps; ! ! } ! ! ! ! float EEditFPSToolbox::GetTargetFPS() const ! ! { ! ! return fpsTarget->GetValue(); ! ! } ! ! ! ! ! ! void EEditFPSToolbox::Update(unsigned int elapsed) ! ! { ! ! ++framesCount; ! ! framesElapsed += elapsed; ! ! if (framesElapsed > 1000) ! ! { ! ! fps = ((float)framesCount / (float)framesElapsed) * 1000.0f; ! ! framesCount = 0; ! ! framesElapsed = 0; ! ! ! ! csString fpsText; ! ! fpsText.Format("%5.1f", fps); ! ! fpsDisplay->SetText(fpsText); ! ! SetTitle("FPS - " + fpsText); ! ! } ! ! } ! ! ! ! size_t EEditFPSToolbox::GetType() const ! ! { ! ! return T_FPS; ! ! } ! ! ! ! char * EEditFPSToolbox::GetName() const ! ! { ! ! return "FPS"; ! ! } ! ! ! ! bool EEditFPSToolbox::PostSetup() ! ! { ! ! fpsDisplay = (pawsTextBox *) FindWidget("fps"); CS_ASSERT(fps); ! ! fpsTarget = (pawsSpinBox *) FindWidget("fps_target"); CS_ASSERT(fpsTarget); ! ! float target = editApp->GetConfigFloat("EEdit.TargetFPS", 60.0f); ! ! if (target < 1.0f) ! ! target = 1.0f; ! ! fpsTarget->SetValue(target); ! ! ! ! return true; ! ! } ! ! ! ! bool EEditFPSToolbox::OnButtonPressed(int mouseButton, int keyModifier, pawsWidget * widget) ! ! { ! ! return false; ! ! } ! ! ! Index: eeditfpstoolbox.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/eedit/eeditfpstoolbox.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** eeditfpstoolbox.h 3 Aug 2005 08:50:40 -0000 1.1 --- eeditfpstoolbox.h 31 Aug 2005 19:08:07 -0000 1.2 *************** *** 1,70 **** ! /* ! * Author: Andrew Robberts ! * ! * Copyright (C) 2003 Atomic Blue (in...@pl..., http://www.atomicblue.org) ! * ! * ! * 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 (version 2 of the License) ! * 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 EEDIT_FPS_TOOLBOX_WINDOW_HEADER ! #define EEDIT_FPS_TOOLBOX_WINDOW_HEADER ! ! #include "eedittoolbox.h" ! #include "paws/pawswidget.h" ! ! class pawsTextBox; ! class pawsSpinBox; ! ! /** This handles the displaying of FPS and controlling the cap. ! */ ! class EEditFPSToolbox : public EEditToolbox, public pawsWidget ! { ! public: ! SCF_DECLARE_IBASE; ! ! EEditFPSToolbox(PawsManager * manager); ! virtual ~EEditFPSToolbox(); ! ! /** Retrieves the current FPS. ! * \return The current FPS. ! */ ! float GetFPS() const; ! ! /** Retrieves the current target FPS. ! * \return The current target FPS. ! */ ! float GetTargetFPS() const; ! ! // inheritted from EEditToolbox ! virtual void Update(unsigned int elapsed); ! virtual size_t GetType() const; ! virtual char * GetName() const; ! ! // inheritted from pawsWidget ! virtual bool PostSetup(); ! virtual bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget ); ! ! private: ! ! pawsTextBox * fpsDisplay; ! pawsSpinBox * fpsTarget; ! ! float fps; ! unsigned int framesCount; ! unsigned int framesElapsed; ! }; ! ! CREATE_PAWS_FACTORY(EEditFPSToolbox); ! ! #endif --- 1,140 ---- ! /* ! ! * Author: Andrew Robberts ! ! * ! ! * Copyright (C) 2003 Atomic Blue (in...@pl..., http://www.atomicblue.org) ! ! * ! ! * ! ! * 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 (version 2 of the License) ! ! * 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 EEDIT_FPS_TOOLBOX_WINDOW_HEADER ! ! #define EEDIT_FPS_TOOLBOX_WINDOW_HEADER ! ! ! ! #include "eedittoolbox.h" ! ! #include "paws/pawswidget.h" ! ! ! ! class pawsTextBox; ! ! class pawsSpinBox; ! ! ! ! /** This handles the displaying of FPS and controlling the cap. ! ! */ ! ! class EEditFPSToolbox : public EEditToolbox, public pawsWidget ! ! { ! ! public: ! ! SCF_DECLARE_IBASE; ! ! ! ! EEditFPSToolbox(PawsManager * manager); ! ! virtual ~EEditFPSToolbox(); ! ! ! ! /** Retrieves the current FPS. ! ! * \return The current FPS. ! ! */ ! ! float GetFPS() const; ! ! ! ! /** Retrieves the current target FPS. ! ! * \return The current target FPS. ! ! */ ! ! float GetTargetFPS() const; ! ! ! ! // inheritted from EEditToolbox ! ! virtual void Update(unsigned int elapsed); ! ! virtual size_t GetType() const; ! ! virtual char * GetName() const; ! ! ! ! // inheritted from pawsWidget ! ! virtual bool PostSetup(); ! ! virtual bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget ); ! ! ! ! private: ! ! ! ! pawsTextBox * fpsDisplay; ! ! pawsSpinBox * fpsTarget; ! ! ! ! float fps; ! ! unsigned int framesCount; ! ! unsigned int framesElapsed; ! ! }; ! ! ! ! CREATE_PAWS_FACTORY(EEditFPSToolbox); ! ! ! ! #endif ! |