Visual Studio macht probleme
-
Hey also ich werde gleich mal weitersuchen.
Jedoch stelle ich einfach mal den Code der 3 klassen hier rein mit der Hoffnung dass es biiitttteee jemand nachguckt.IMenuSystem.h
#ifndef IMENUSYSTEM_H_ #define IMENUSYSTEM_H_ #include "IComponent.h" #include "engine.h" #include "PathDefine.h" #include "IEngineSystem.h" #include "IMenuPane.h" #include "IProfileManager.h" class IMenuButton; class IMenuSystem : public IComponent { public: friend class IMenuButton; friend class IMenuPane; IMenuSystem(); ~IMenuSystem(); IResult Initialize(); IResult Terminate(); void Update(); inline void ButtonQuitCode() { MessageBoxA(0,"Quit",0,0); } IResult AddPane(IMenuPane*,TVec3,TVec3); bool _stateReady; TVec3 rot; //------------Effects-------------------------// int rand_min; int rand_max; float rand_out; float chromatic_strenght; //--------------------------------------------// private: TCamera _cSceneCamera; TEntity _sMenuScene; ISmartPointer<IEngineSystem> _iEngineSystem; IMenuPane* _pFocusPane; std::vector<IMenuPane*> _vPanes; IResult ChangePane(IMenuPane* signal); void IncreaseValue(std::string name,float value); void DecreaseValue(std::string name,float value); TVec3 position; TVec3 rotation; float move,strafe,mx,my; //********************************************// void UpdateEffects(); //********************************************// private: // option values for slider std::map<std::string,float> _optionsMap; private: //Camera movement from node to node TVec3 _currentPosition; TVec3 _currentRotation; TEntity _nextNode; TVec3 _posAccels; TVec3 _rotAccels; int _currentSteps; bool _cameraMovement; double _startDistance; double _currentFunctionValue; void UpdateCameraMovement(); void UpdatePaneChanges(); inline void SetCameraMovement(TEntity node) { _currentSteps = (int)(30.0f / AppSpeed()); _currentPosition = EntityPosition(_cSceneCamera,1); _currentRotation = EntityRotation(_cSceneCamera,1); _cameraMovement = true; _nextNode = node; _posAccels = (EntityPosition(node,1) - EntityPosition(_cSceneCamera,1)) / (float)_currentSteps; _rotAccels = (EntityRotation(node,1) - EntityRotation(_cSceneCamera,1)) / (float)_currentSteps; _currentFunctionValue = -90.0f; _startDistance = EntityDistance(IEngineSystem::Inst()->GetCamera(),_nextNode); } private: /////////////////////////////////////////////////////////////// // Signals // void HandleSignals(); // // /////////////////////////////////////////////////////////////// private: /////////////////////////////////////////////////////////////// // /brief // // // This is a section for the Profilemanager. // Manager here the function of the continue and new game button // // With the profilemanager a new profile is created and saved // For cthe continue button just check if a profile is allready // created and change the state to the game state // //////////////////////////////////////////////////////////////// ISmartPointer<IProfileManager> _pProfileManager; ///////////////////////////////////// // Create bool for signal activision // // ///////////////////////////////////// bool b_signal_continue; bool b_signal_newgame; }; #endifIMenuSystem.cpp
#include "IMenuSystem.h" #include "IConsole.h" #include "IMenuButton.h" #include "ISoundSystem.h" #include "IMenuSlider.h" #include "IMenuLabel.h" #include "IMenuTextSlider.h" #include "PathDefine.h" IMenuSystem::IMenuSystem() : _stateReady(false), _iEngineSystem(IEngineSystem::Inst()), _pProfileManager(new IProfileManager()) { rot = Vec3(0); move = 0.0f; strafe = 0.0f; mx = 0.0f; my = 0.0f; _cameraMovement = false; ////////////////////////////////////////////// // Signals reset // b_signal_continue = false; b_signal_newgame = false; // // ////////////////////////////////////////////// } IMenuSystem::~IMenuSystem() { } IResult IMenuSystem::Initialize() { IConsole::inst()->Debug("IMenuSystem Initialized!"); IEngineSystem::Inst()->ActivateRendering(true); // enable rendering for video _cSceneCamera = _iEngineSystem->GetCamera(); _sMenuScene = LoadScene("abstract::menu_sc.sbx"); if(!_sMenuScene) IConsole::inst()->Debug("No Menu Scene "); ///////////////////////////////////////////////////////////////////////////////////// IMenuPane* _pmain = new IMenuPane(FindChild(_sMenuScene,"menu_main"),this); IMenuPane* _p_options = new IMenuPane(FindChild(_sMenuScene,"menu_options"),this); IMenuPane* _p_options_display = new IMenuPane(FindChild(_sMenuScene,"menu_display"),this); IMenuPane* _p_singleplayer = new IMenuPane(FindChild(_sMenuScene,"menu_singleplayer"),this); _pmain->Initialize(); _p_options->Initialize(); _p_options_display->Initialize(); _p_singleplayer->Initialize(); _pFocusPane = _pmain; // set the main menu in focus PositionEntity(_cSceneCamera,EntityPosition(_pmain->_camNode,1),1); RotateEntity(_cSceneCamera,EntityRotation(_pmain->_camNode,1),1); //************************************************************************// IMenuButton* _msingleplayer = new IMenuButton(this); IMenuButton* _mmultiplayer = new IMenuButton(this); IMenuButton* _moptions = new IMenuButton(this); IMenuButton* _mmods = new IMenuButton(this); IMenuButton* _mcredits = new IMenuButton(this); IMenuButton* _mquit = new IMenuButton(this); _msingleplayer->Initialize(LoadMesh("abstract::singleplayer.gmf")); _mmultiplayer->Initialize(LoadMesh("abstract::multiplayer.gmf")); _moptions->Initialize(LoadMesh("abstract::options.gmf")); _mmods->Initialize(LoadMesh("abstract::mods.gmf")); _mcredits->Initialize(LoadMesh("abstract::credits.gmf")); _mquit->Initialize(LoadMesh("abstract::quit.gmf")); //_mquit->SetActiveSignal(&IEngineSystem::Inst()->_quitSystems); _pmain->AddComp(_msingleplayer,Vec3(0,4.5,0),Vec3(0,0,0)); _pmain->AddComp(_mmultiplayer,Vec3(-0.4,3.3,0),Vec3(0,0,0)); _pmain->AddComp(_moptions,Vec3(0,2.1,0),Vec3(0,0,0)); _pmain->AddComp(_mmods,Vec3(0.2,0.9,0),Vec3(0,0,0)); _pmain->AddComp(_mcredits,Vec3(0.5,-0.3,0),Vec3(0,0,0)); _pmain->AddComp(_mquit,Vec3(-0.1,-1.5,0),Vec3(0,0,0)); AddPane(_pmain,Vec3(0,1,2.52),Vec3(0)); //Add to menu system _pmain->SetButtonSignalPane(_msingleplayer,_p_singleplayer); // Set button singla for singleplayer _pmain->SetButtonSignalPane(_moptions,_p_options); // Set button signal of options //************************************************************************// IMenuButton* _button_options_graphics = new IMenuButton(this); IMenuButton* _button_options_display = new IMenuButton(this); IMenuButton* _button_options_sound = new IMenuButton(this); IMenuButton* _button_options_control = new IMenuButton(this); _button_options_display->Initialize(LoadMesh("abstract::button_display.gmf")); _button_options_sound->Initialize(LoadMesh("abstract::button_sound.gmf")); _button_options_graphics->Initialize(LoadMesh("abstract::button_graphics.gmf")); _button_options_control->Initialize(LoadMesh("abstract::button_control.gmf")); _p_options->AddComp(_button_options_display,Vec3(0.1f,1.0f,0.0f),Vec3(0.0f,0.0f,0.0f)); _p_options->AddComp(_button_options_graphics,Vec3(0.2f,-0.2f,0.0f),Vec3(0.0f,0.0f,0.0f)); _p_options->AddComp(_button_options_sound,Vec3(-0.2f,-1.5f,0.0f),Vec3(0.0f,0.0f,0.0f)); _p_options->AddComp(_button_options_control,Vec3(0.0f,-2.7f,0.0f),Vec3(0.0f,0.0f,0.0f)); AddPane(_p_options,Vec3(2.0f,1.0f,1.2f),Vec3(0.0f,-90.0f,0.0f)); _p_options->SetButtonSignalPane(_button_options_display,_p_options_display); IMenuLabel* _label_options_display_resolution = new IMenuLabel(this); IMenuLabel* _label_options_display_fullscreen = new IMenuLabel(this); IMenuTextSlider* _slider_options_display = new IMenuTextSlider(this); IMenuSlider* _slider_options_display_fullscreen = new IMenuSlider(this,1,1.0); IMenuLabel* _label_options_display_vsync = new IMenuLabel(this); IMenuSlider* _slider_options_display_vsync = new IMenuSlider(this,1,1.0); IMenuLabel* _label_options_display_brightness = new IMenuLabel(this); IMenuSlider* _slider_options_display_brightness = new IMenuSlider(this,9,1.0); _label_options_display_resolution->Initialize(LoadMesh("abstract::label_resolution.gmf")); _slider_options_display->Initialize(NULL); _label_options_display_fullscreen->Initialize(LoadMesh("abstract::label_fullscreen.gmf")); _slider_options_display_fullscreen->Initialize(NULL); _slider_options_display_vsync->Initialize(NULL); _label_options_display_vsync->Initialize(LoadMesh("abstract::label_vsync.gmf")); _label_options_display_brightness->Initialize(LoadMesh("abstract::label_brightness.gmf")); _slider_options_display_brightness->Initialize(NULL); _slider_options_display->AddOption("abstract::800x600.gmf",800,600); _slider_options_display->AddOption("abstract::1024x768.gmf",1024,768); _slider_options_display->AddOption("abstract::1280x800.gmf",1280,800); _slider_options_display->AddOption("abstract::1280x1024.gmf",1280,1024); _slider_options_display->AddOption("abstract::1366x768.gmf",1366,768); _slider_options_display->AddOption("abstract::1440x900.gmf",1440,900); _slider_options_display->AddOption("abstract::1600x900.gmf",1600,900); _slider_options_display->AddOption("abstract::1680x1050.gmf",1680,1050); _slider_options_display->AddOption("abstract::1920x1080.gmf",1920,1080); _slider_options_display->AddOption("abstract::1920x1200.gmf",1920,1200); _p_options_display->AddComp(_label_options_display_resolution,Vec3(0.52f,0.7f,0),Vec3(0)); _p_options_display->AddComp(_slider_options_display,Vec3(0.7f,0.5f,-0.1f),Vec3(0.0f,-45.0f,0.0f)); _p_options_display->AddComp(_label_options_display_fullscreen,Vec3(0.55f,0.30,0),Vec3(0)); _p_options_display->AddComp(_slider_options_display_fullscreen,Vec3(1.0f,0.13f,-0.2f),Vec3(0.0f,-45.0f,0.0f)); _p_options_display->AddComp(_label_options_display_vsync,Vec3(0.55f,0.0f,0),Vec3(0)); _p_options_display->AddComp(_slider_options_display_vsync,Vec3(1.0f,-0.11f,-0.2f),Vec3(0.0f,-45.0f,0.0f)); _p_options_display->AddComp(_label_options_display_brightness,Vec3(0.55f,-0.35f,0),Vec3(0)); _p_options_display->AddComp(_slider_options_display_brightness,Vec3(0.7f,-0.5f,-0.1f),Vec3(0.0f,-45.0f,0.0f)); AddPane(_p_options_display,Vec3(2.0f,1.3f,-1.2f),Vec3(0.0f,-90.0f,0.0f)); IMenuButton* _button_singleplayer_continue = new IMenuButton(this); IMenuButton* _button_singleplayer_newgame = new IMenuButton(this); _button_singleplayer_continue->Initialize(LoadMesh("abstract::sp_continue.gmf")); _button_singleplayer_newgame->Initialize(LoadMesh("abstract::sp_newgame.gmf")); _p_singleplayer->AddComp(_button_singleplayer_continue,Vec3(-0.4f,0.0f,0.0f),Vec3(0)); _p_singleplayer->AddComp(_button_singleplayer_newgame,Vec3(0.0f,-1.2f,0.0f),Vec3(0)); _button_singleplayer_continue->SetActiveSignal(&b_signal_continue); _button_singleplayer_newgame->SetActiveSignal(&b_signal_newgame); AddPane(_p_singleplayer,Vec3(0.0f,2.2f,0.5f),Vec3(-90.0f,0.0f,0.0f)); //************************************************************************// ///////////////////////////////////////////////////////////////////////////////////// _currentSteps = 70; IConsole::inst()->AddItem("Function",_currentSteps); ///////////////////////////////////////////////////////////////////////////////////// rand_min = 0; rand_max = 30; chromatic_strenght = 1.0f; IConsole::inst()->AddItem("Lol",_iEngineSystem->Inst()->_fchromatic_shader); ISoundSystem::Inst()->Play_Menu_Background(); //Play Background sound ShowEntity(IEngineSystem::Inst()->GetCamera()); return IRESULT_OK; } IResult IMenuSystem::Terminate() { return IRESULT_OK; } void IMenuSystem::Update() { if(MouseDown(2)) { mx = MouseX() - GraphicsWidth()/2; my = MouseY() - GraphicsHeight()/2; MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); rot.X += my/20.0f; rot.Y -= mx/20.0f; RotateEntity(_cSceneCamera,rot); } move = (KeyDown(KEY_W)-KeyDown(KEY_S))/10.0f; strafe = (KeyDown(KEY_D)-KeyDown(KEY_A))/10.0f; MoveEntity(_cSceneCamera,Vec3(strafe,0,move)); UpdateEffects(); for(std::vector<IMenuPane*>::iterator it = _vPanes.begin(); it != _vPanes.end();it++) { static_cast<IMenuPane*>(*it)->Update(); } UpdateCameraMovement(); UpdatePaneChanges(); HandleSignals(); } void IMenuSystem::UpdateEffects() { //----------Chromatic----------// rand_out = (float)rand() / rand_max; if(rand_out > 17.0) { chromatic_strenght = LE::Curve(rand_out/300.0,chromatic_strenght,10.0f); } else { chromatic_strenght = LE::Curve(0.0f,chromatic_strenght,5.0f); } _iEngineSystem->Inst()->_fchromatic_shader = chromatic_strenght; } IResult IMenuSystem::AddPane(IMenuPane* pane,TVec3 pos,TVec3 rot) { _vPanes.push_back(pane); PositionEntity(pane->_piv,pos); RotateEntity(pane->_piv,rot); return IRESULT_OK; } IResult IMenuSystem::ChangePane(IMenuPane* signal) { SetCameraMovement(signal->_camNode); ISoundSystem::Inst()->Play_Menu_Whoosh(); _pFocusPane = signal; return IRESULT_OK; } void IMenuSystem::UpdateCameraMovement() { if(_cameraMovement) { if(EntityDistance(IEngineSystem::Inst()->GetCamera(),_nextNode) > 0.01) { _currentPosition += _posAccels * (sin(_currentFunctionValue * 3.14159636 / 180.0)+1.2); _currentRotation += _rotAccels * (sin(_currentFunctionValue * 3.14159636 / 180.0)+1.2); } else { _cameraMovement = false; } PositionEntity(_cSceneCamera,_currentPosition,1); RotateEntity(_cSceneCamera,_currentRotation,1); _currentFunctionValue = -(360 / _startDistance) * EntityDistance(IEngineSystem::Inst()->GetCamera(),_nextNode) + 270.0; } } void IMenuSystem::UpdatePaneChanges() { if(KeyHit(KEY_ESCAPE)) { if(_pFocusPane && _pFocusPane->_backPane.get()) { ChangePane(_pFocusPane->_backPane.get()); } } } void IMenuSystem::HandleSignals() { if(b_signal_continue) { ///////////////////////////////// // // // // Else do nothing ///////////////////////////////// if(IProfileManager::CheckForExistingProfile() == IRESULT_OK) { _stateReady = true; //change state } } if(b_signal_newgame) { ///////////////////////////////// // // Create a new Profile struct // and save it in a file // ///////////////////////////////// IProfile _tmp_profile; ///////////////////////////////// // // Create Profile, standartconstructor // makes name and progressfilename // to unnamed and unnamed.prf // ///////////////////////////////// IProfileManager::SaveProfile(_tmp_profile); // Save new profile with standart data ///////////////////////////////// // // Change state to Game state _stateReady = true; // !!!!!!!!!!!!!!!!!! // // ///////////////////////////////// } }IMenuPane.h
#ifndef IMENUPANE_H_ #define IMENUPANE_H_ #pragma once #include "GlobalDefine.h" #include "IMenuComponent.h" #include "engine.h" #include "IMenuButton.h" class IMenuPane : public IMenuComponent { public: friend class IMenuSystem; friend class IMenuButton; IMenuPane(TEntity node,IMenuSystem* parent); ~IMenuPane(); void Update(); IResult Initialize(); IResult Terminate(); IResult AddComp(IMenuComponent*,TVec3,TVec3); inline IResult SetBackPane(IMenuPane* p) { _backPane.reset(p); return IRESULT_OK; } IMenuComponent* CheckEntity(TEntity check); void ButtonSignal(IMenuButton* b); inline void SetButtonSignalPane(IMenuButton* b,IMenuPane* p) { _mButtonSignals.insert( std::pair<IMenuButton*,IMenuPane*>(b,p)); p->_backPane.reset(this); } bool GetInteractState() { return _bPaneInteract; } private: float pos; TEntity _piv; std::vector<IMenuComponent*> _components; std::vector<IMenuComponent*>::iterator _iterator; std::map<IMenuButton*,IMenuPane*> _mButtonSignals; IMenuSystem* const _parent ; ISmartPointer<IMenuPane> _backPane; bool _bPaneInteract; TEntity _camNode; TPick _raycast; }; #endifIMenuPane.cpp
#include "IMenuPane.h" #include "IEngineSystem.h" #include "IConsole.h" #include "ISoundSystem.h" #include "IMenuSlider.h" #include "IMenuSystem.h" IMenuPane::IMenuPane(TEntity node,IMenuSystem* parent) : _parent(parent) { _camNode = node; _state = P_NONE; } IMenuPane::~IMenuPane() { } //---------------Filter----------------// int _stdcall Raycast_Filter(TEntity entity) { return ( GetEntityType(entity) == 7 ) ? 1 : 0; } IResult IMenuPane::Initialize() { //Create Pivote _piv = CreatePivot(); pos = 0.0f; return IRESULT_OK; } IResult IMenuPane::Terminate() { return IRESULT_OK; } void IMenuPane::Update() { if(KeyHit(KEY_ENTER)) { _bPaneInteract = true; } else { _bPaneInteract = false; } for(_iterator = _components.begin(); _iterator != _components.end(); _iterator++) { static_cast<IMenuComponent*>(*_iterator)->Update(); } if(CameraPick(&_raycast,IEngineSystem::Inst()->GetCamera(),Vec3(MouseX(),MouseY(),200),1.0f,1)) { if(!strcmp("BUTTON",GetEntityKey(_raycast.entity,"MENU"))) { IMenuComponent* temp = (IMenuComponent*)GetEntityUserData(_raycast.entity); if(MouseHit(1)) // if moousehit click event to the button { if(temp->_state == B_SELECTED) temp->_state = B_PRECLICKED; } else { if(temp->_state == B_UNSELECTED) temp->_state = B_PRESELECTED; } } else if(!strcmp("SLIDER_L",GetEntityKey(_raycast.entity,"MENU"))) { IMenuComponent* temp = (IMenuComponent*)GetEntityUserData(_raycast.entity); if(MouseHit(1) && temp->_state == S_SELECTED_LEFT) { temp->_state = S_PRECLICKED_LEFT; IConsole::inst()->Debug("Click"); } else if(temp->_state == S_UNSELECTED) { temp->_state = S_SELECTED_LEFT; } } else if(!strcmp("SLIDER_R",GetEntityKey(_raycast.entity,"MENU"))) { IMenuComponent* temp = (IMenuComponent*)GetEntityUserData(_raycast.entity); if(MouseHit(1) && temp->_state == S_SELECTED_RIGHT) { temp->_state = S_PRECLICKED_RIGHT; } else if(temp->_state == S_UNSELECTED) { temp->_state = S_SELECTED_RIGHT; } } for(_iterator = _components.begin(); _iterator != _components.end(); _iterator++) { if(!strcmp("BUTTON",GetEntityKey(static_cast<IMenuComponent*>(*_iterator)->_mesh,"MENU"))) { if(static_cast<IMenuComponent*>(*_iterator)->_mesh != _raycast.entity) { static_cast<IMenuComponent*>(*_iterator)->_state = B_UNSELECTED; } } if(!strcmp("SLIDER",GetEntityKey(static_cast<IMenuComponent*>(*_iterator)->_mesh,"MENU"))) { if(static_cast<IMenuSlider*>(*_iterator)->_arrow_left != _raycast.entity && static_cast<IMenuSlider*>(*_iterator)->_arrow_right != _raycast.entity ) { static_cast<IMenuSlider*>(*_iterator)->_state = S_UNSELECTED; } } } } } IResult IMenuPane::AddComp(IMenuComponent* comp,TVec3 pos,TVec3 rot) { _components.push_back(comp); PositionEntity(comp->_mesh,EntityPosition(_piv)); RotateEntity(comp->_mesh,EntityRotation(_piv)); EntityParent(comp->_mesh,_piv); MoveEntity(comp->_mesh,pos); RotateEntity(comp->_mesh,rot); comp->_parentPane = this; return IRESULT_OK; } IMenuComponent* IMenuPane::CheckEntity(TEntity check) { for(_iterator = _components.begin(); _iterator != _components.end(); _iterator++) { if(static_cast<IMenuComponent*>(*_iterator)->_mesh == check) { return static_cast<IMenuComponent*>(*_iterator); break; } } return NULL; } void IMenuPane::ButtonSignal(IMenuButton* b ) { if(b) { std::map<IMenuButton*,IMenuPane*>::iterator it; for(it = _mButtonSignals.begin(); it != _mButtonSignals.end(); it++) { if(it->first == b ) { it->second->_parent->ChangePane(it->second); break; } } } }IMenuButton.h
#ifndef IMENUBUTTON_H_ #define IMENUBUTTON_H_ #pragma once #include "GlobalDefine.h" #include "IMenuComponent.h" #include "engine.h" class IMenuSystem; class IMenuPane; class IMenuButton : public IMenuComponent { public: friend class IMenuSystem; friend class IMenuPane; IMenuButton(IMenuSystem* s); ~IMenuButton(); void Update(); IResult Initialize(TEntity entity); IResult Terminate(); inline void SetSignalPane(IMenuPane* p) { _signalPane.reset(p); } inline void SetActiveSignal(bool* b) { _activeSignal = b; } private: TEntity _button; float y; ISmartPointer<IMenuSystem> _parentSystem; ISmartPointer<IMenuPane> _signalPane; bool* _activeSignal; }; #endifIMenuButton.cpp
#include "IMenuButton.h" #include "IConsole.h" #include "ISoundSystem.h" #include "IEngineSystem.h" #include "IMenuSystem.h" IMenuButton::IMenuButton(IMenuSystem* s) : _parentSystem(s) { _comp = BUTTON; // Set the commponent as a button _state = B_UNSELECTED; // Set the button to not selected by default y = 0.01f; } IMenuButton::~IMenuButton() { } IResult IMenuButton::Initialize(TEntity mesh) { this->_mesh = CreateCube(); SetEntityKey(_mesh,"MENU","BUTTON"); SetEntityUserData(_mesh,(BYTE*)this); EntityType(_mesh,1); //Type 7 for raycast ScaleEntity(_mesh,Vec3((GetEntityAABB(mesh).X1 - GetEntityAABB(mesh).X0),(GetEntityAABB(mesh).Y1 - GetEntityAABB(mesh).Y0) + 0.02f,(GetEntityAABB(mesh).Z1 - GetEntityAABB(mesh).Z0))); PaintEntity(_mesh,LoadMaterial("abstract::invisible.mat")); this->_button = mesh; PositionEntity(_button,Vec3(EntityPosition(mesh).X,EntityPosition(_mesh).Y - (GetEntityAABB(_mesh).Y1 - GetEntityAABB(_mesh).Y0)/2.0f,EntityPosition(_mesh).Z)); RotateEntity(_button,EntityRotation(mesh)); EntityParent(_button,_mesh); return IRESULT_OK; } IResult IMenuButton::Terminate() { return IRESULT_OK; } void IMenuButton::Update() { PositionEntity(_button,Vec3(y,EntityPosition(_button).Y,EntityPosition(_button).Z)); y = max(y,0.01f); y = min(y,0.14f); switch(_state) { case B_SELECTED: y += 0.007 * AppSpeed(); PointEntity(IEngineSystem::Inst()->GetCamera(),_button,3,0.005f,0.0f); EntityColor(_button,Vec4(5.8f,0.55f,-0.6f,0.6f)); break; case B_PRESELECTED: ISoundSystem::Inst()->Play_Menu_Button(); _state = B_SELECTED; break; case B_UNSELECTED: EntityColor(_button,Vec4(1.0f,1.0f,1.0f,1.0f)); y -= 0.007f * AppSpeed(); break; case B_PRECLICKED: ISoundSystem::Inst()->Play_Menu_Confirm(); _state = B_CLICKED; break; case B_CLICKED: EntityColor(_button,Vec4(5.8f,0.0f,-0.6f,0.6f)); _parentPane->ButtonSignal(this); _state = B_SELECTED; if(_activeSignal) *_activeSignal = true; break; }; }evtl. auch IMenuComponent.h
#ifndef IMENUCOMPONENT_H_ #define IMENUCOMPONENT_H_ #pragma once #include "GlobalDefine.h" #include "engine.h" class IMenuPane; class IMenuComponent { public: IMenuComponent() { } ~IMenuComponent() { } virtual void Update() { } virtual IResult Initialize() { return IRESULT_OK; } virtual IResult Terminate() { return IRESULT_OK; } enum State{ B_SELECTED = 0, B_PRESELECTED, B_UNSELECTED, B_PRECLICKED, B_CLICKED, S_SELECTED_LEFT, S_SELECTED_RIGHT, S_PRECLICKED_LEFT, S_PRECLICKED_RIGHT, S_CLICKED_LEFT, S_CLICKED_RIGHT, S_UNSELECTED, S_INCREASE, S_DECREASE, P_NONE //Pane does nothing } _state; enum Component{ BUTTON = 0, SLIDER, LABEL } _comp; TEntity _mesh; IMenuPane* _parentPane; // Error fix 1.0, don't use ISmartPointer for that, because the scope makes issues }; #endifDas wäre echt sehr lieb.
Danke
-
Bob Wolfskin schrieb:
Jedoch stelle ich einfach mal den Code der 3 klassen hier rein mit der Hoffnung dass es biiitttteee jemand nachguckt.
[...950 Zeilen Code...]
Das wäre echt sehr lieb.
Dazu kann man nur eines sagen, selbst wenn es unqualifiziert klingt: lol
-
Schau dir mal an wofür das Call Stack Window beim Debuggen gut ist, könnte mir vorstellen dass dir das weiterhilft...

-
Dazu kann man nur eines sagen, selbst wenn es unqualifiziert klingt: lol
Ja man ich weiß
Kann ja sein, dass jemand die Herausforderung sucht 
Naja ein Versuch wars wert
Werd mir gleich mal die Call Stack Window Zeugs da angucken
-
Heiliger Jesus endlich hab ich es rausbekommen.
Das war so ein scheiß billiger bool pointer ,der quasie als referenz dienen soll um bei einem Klick auf den Button ein eingetrageses bool zu ändern.Dort stand einfach -> bool* _activeSignal; und bei switch-case vom Button if(_activeSignal) *_activeSignal = true; --> FAIL jetzt funktioniert alles super toll.
Ich war kurz davor wegen diesem scheiß fail pointer über 1000 Zeilen neu zu schreiben.....Naja okey danke Leute für die Hilfe

-
Hör auf _ vor deine Variablen zu setzen^^.
-
Hör auf _ vor deine Variablen zu setzen^^.
Aber..Aber............aber

Warum das denn ?Das sieht dann professioneller aus

-
Bob Wolfskin schrieb:
Das sieht dann professioneller aus

Du meinst etwa gleich "professionell" wie
IMenuComponent() { } ~IMenuComponent() { }
-
Bob Wolfskin schrieb:
Das sieht dann professioneller aus

Ne
-
Bob Wolfskin schrieb:
Hör auf _ vor deine Variablen zu setzen^^.
Aber..Aber............aber

Warum das denn ?Das sieht dann professioneller aus

Weil Variablen und defines die mit _ beginnen für den Compiler reserviert sind.
-
IMenuComponent() { }
~IMenuComponent() { }Was ist daran so schlimm?
Man könnte es genauso virtuell machen
-
Nein, darum geht es nicht.
Es geht darum, dass man diese Funktionen gar nicht selbst schreiben braucht. Das macht der Compiler für dich.
Wieso sollst du einen Destruktor schreiben, der nichts macht?
Und wieso sollst du ihn schreiben, wenn er eh so wie er grad ist, vom Compiler generiert wird?!Beim Konstruktor gibt es den Fall, dass du den Default Konstruktor erlauben willst neben anderen Kosntruktoren, dann ist es ok ihn zu schreiben. Aber auch nur dann, in allen anderen Fällen macht es der Compiler für dich bzw. verhindert es die Semantik einen haben zu dürfen.