genesis-3d_engine/Engine/players/DemoUI/simplegamestatehandler.h

182 lines
4.3 KiB
C
Raw Normal View History

/** \file simplegamestatehandler.h
* \brief <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD>
* Copyright (c) 2011,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>WebJet<EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>
* All rights reserved.
* Date Ver Author Comment
* 2011:11:16 1.0 libin
*/
#ifndef __simplegamestatehandler_H__
#define __simplegamestatehandler_H__
#include "appframework/statehandler.h"
#include "appframework/actor.h"
#include "math/ray.h"
#include "math/color.h"
#include "gyrostat.h"
#include "particles/particlesystem.h"
#include "guifeature/gui.h"
namespace Sample
{
using namespace Particles;
class SimpleStateHandler : public App::StateHandler
{
__DeclareClass(SimpleStateHandler);
public:
/// constructor
SimpleStateHandler();
/// destructor
virtual ~SimpleStateHandler();
//static Func for Web
static void ChangeParticleUp();
static void ChangeParticleDown();
/// called when the state represented by this state handler is entered
virtual void OnStateEnter(const Util::String& prevState);
/// called when the state represented by this state handler is left
virtual void OnStateLeave(const Util::String& nextState);
/// called each frame as long as state is current, return new state
virtual Util::String OnFrame();
/// set level filename, required by setup mode LoadLevel
void SetSceneName(const Util::String& n);
/// get level name
const Util::String& GetSceneName() const;
//ʾ<><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ
void UpdateWorldCoord(void);
// ʾ<><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ν<EFBFBD><CEBD><EFBFBD>ʰȡ<CAB0><C8A1><EFBFBD><EFBFBD>
void IntersectActor();
// ʾ<><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>
void UpdateLine(void);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void UpdateGyrostat();
//check circle actor
bool IsCircleSelected(const Ptr<App::Actor>& actor );
// ʾ<><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʿ<EFBFBD><CABF>
void UpdateSoldier(void);
// ʾ<><CABE><EFBFBD><EFBFBD><EFBFBD>ҽӲ<D2BD><D3B2><EFBFBD>
void ProcessAttach();
// <20><><EFBFBD>Ƴ<EFBFBD>ʰȡ<CAB0><C8A1><EFBFBD><EFBFBD>actor<6F>İ<EFBFBD>Χ<EFBFBD><CEA7>
void CreateOrUpdateBoundActor(const Ptr<App::Actor>& actor );
void CreateParticleFromTemplate();
void CreateScene();
//
void SetKeyDown(int key);
void ChangeEmitter();
//
void createParSys(Util::Array<Util::StringAtom>& outTexture);
void LoadTemplate();
void UpdateParticle();
void InitParticleTexutre(Util::Array<Util::StringAtom>& outTexture);
private:
Util::String mSceneName;
App::Actor::FastId mMeshActorID;
Util::String mCurMeshName;
Util::String mCurShaderName;
Util::String mCurTexName;
bool mShowAll; // <09><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>Χ<EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽڵ<D3BD><DAB5>İ<EFBFBD>Χ<EFBFBD><CEA7>
bool mShowParticle;
Ptr<App::Scene> mScene;
Ptr<App::Actor> mCamera;
Ptr<App::Actor> mLight;
Ptr<App::Actor> mLineActor; // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
Ptr<App::Actor> mSoldierActor; // <09><><EFBFBD>ƴ<EFBFBD><C6B4><EFBFBD>
Ptr<App::Actor> mSoldierActorChild;
Ptr<App::Actor> mSelectActor; // <09><>ǰѡ<C7B0>е<EFBFBD>actor
Ptr<App::Actor> mIntersectBoundActor; // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Χ<EFBFBD>е<EFBFBD>actor
Ptr<App::Actor> mWorldCoordsActor; // <09>ο<EFBFBD><CEBF><EFBFBD><EFBFBD><EFBFBD>
//mGyrostatActor //need attach a circleActors , acoordsActor, three taper,
Ptr<App::Actor> mSelectOpActor; // <09><>ǰѡ<C7B0>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>actor
Gyrostat* mGyrostat;
float2 mMouseScreenPos;//<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
Ptr<App::Actor> ParticleAct;
Util::Array<Util::StringAtom> outlist;
Ptr<ParticleSystem> ParSystem;
// ===================== UI test ======================
void _initUI();
bool _frameUI();
MyGUI::VectorWidgetPtr _addLayout(char* name);
void _emptyWindowClick(MyGUI::Widget* _sender);
void _radioClick(MyGUI::Widget* _sender);
void _checkClick(MyGUI::Widget* _sender);
void _nextPtc(MyGUI::Widget* _sender);
void _prevPtc(MyGUI::Widget* _sender);
void _clearPtc(MyGUI::Widget* _sender);
void _requestCreateWidgetItem(MyGUI::ItemBox* _sender, MyGUI::Widget* _item);
void _notifyScrollChangePosition(MyGUI::ScrollBar* _sender, size_t _position);
MyGUI::VectorWidgetPtr mEmptyWin;
MyGUI::Button* mEmtyWinBtn;
MyGUI::EditBox* mPressTxt;
MyGUI::ScrollBar* mRed;
MyGUI::ScrollBar* mGreen;
MyGUI::ScrollBar* mBlue;
MyGUI::Widget* mColor;
MyGUI::EditBox* mColorText;
Util::Array<MyGUI::Button*> mRadios;
};
//------------------------------------------------------------------------------
/**
*/
inline void
SimpleStateHandler::SetSceneName(const Util::String& n)
{
this->mSceneName = n;
}
//------------------------------------------------------------------------------
/**
*/
inline const Util::String&
SimpleStateHandler::GetSceneName() const
{
return this->mSceneName;
}
}
#endif // __simplegamestatehandler_H__