Skip to content

Commit

Permalink
Update for API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravbug committed Sep 1, 2024
1 parent 07a80dd commit fac1c75
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion RavEngine
3 changes: 2 additions & 1 deletion Samples/Playground/WorldTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "RavEngine/Light.hpp"
#include <RavEngine/AudioSpace.hpp>
#include <RavEngine/RenderEngine.hpp>
#include <RavEngine/Window.hpp>
#include <RavEngine/MeshCollection.hpp>

using namespace RavEngine;
Expand Down Expand Up @@ -94,7 +95,7 @@ TestWorld::TestWorld(){
//is->BindAction("Click", click, ActionState::Released);
GetApp()->inputManager = is;

InputManager::SetRelativeMouseMode(true);
GetApp()->GetMainWindow()->SetRelativeMouseMode(true);

//spawn player (it will make its camera active)
ResetCam();
Expand Down
5 changes: 3 additions & 2 deletions Samples/Rats/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <RavEngine/AudioSpace.hpp>
#include <RavEngine/StartApp.hpp>
#include <RavEngine/MeshCollection.hpp>
#include <RavEngine/Window.hpp>
#include <numbers>

using namespace RavEngine;
Expand Down Expand Up @@ -321,7 +322,7 @@ struct RatsWorld : public RavEngine::World {

void ToggleMouse() {
relativeMouseMode = !relativeMouseMode;
GetApp()->inputManager->SetRelativeMouseMode(relativeMouseMode);
GetApp()->GetMainWindow()->SetRelativeMouseMode(relativeMouseMode);
}

void SetupInputs() {
Expand Down Expand Up @@ -352,7 +353,7 @@ struct RatsWorld : public RavEngine::World {

im->BindAction(InputNames::ToggleMouse, GetInput(this), &RatsWorld::ToggleMouse, ActionState::Pressed, CID::ANY);
im->BindAction(InputNames::ResetCamera, GetInput(this), &RatsWorld::CameraResetCallback, ActionState::Pressed, CID::ANY);
im->SetRelativeMouseMode(relativeMouseMode);
GetApp()->GetMainWindow()->SetRelativeMouseMode(relativeMouseMode);

GetApp()->inputManager = im;
}
Expand Down
5 changes: 3 additions & 2 deletions Samples/Rendering/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "AppInfo.hpp"
#include <numbers>
#include <RavEngine/StartApp.hpp>
#include <RavEngine/Window.hpp>
#include <RavEngine/MeshCollection.hpp>

using namespace RavEngine;
Expand Down Expand Up @@ -405,7 +406,7 @@ struct Level : public RavEngine::World {

void ToggleMouse() {
relativeMouseMode = !relativeMouseMode;
GetApp()->inputManager->SetRelativeMouseMode(relativeMouseMode);
GetApp()->GetMainWindow()->SetRelativeMouseMode(relativeMouseMode);
}

void SetupInputs() {
Expand Down Expand Up @@ -434,7 +435,7 @@ struct Level : public RavEngine::World {

im->BindAction(InputNames::ToggleMouse, GetInput(this), &Level::ToggleMouse, ActionState::Pressed, CID::ANY);
im->BindAction(InputNames::ResetCamera, GetInput(this), &Level::CameraResetCallback, ActionState::Pressed, CID::ANY);
im->SetRelativeMouseMode(relativeMouseMode);
GetApp()->GetMainWindow()->SetRelativeMouseMode(relativeMouseMode);

im->BindAction(InputNames::PlayParticle, GetInput(this), &Level::PlayParticle, ActionState::Pressed, CID::ANY);

Expand Down
4 changes: 2 additions & 2 deletions Samples/SceneViewer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct SceneViewerLevel : public RavEngine::World {

void ToggleMouse() {
relativeMouseMode = !relativeMouseMode;
GetApp()->inputManager->SetRelativeMouseMode(relativeMouseMode);
GetApp()->GetMainWindow()->SetRelativeMouseMode(relativeMouseMode);
}

void SetupInputs() {
Expand All @@ -126,7 +126,7 @@ struct SceneViewerLevel : public RavEngine::World {
im->BindAxis(InputNames::LookUp, GetInput(this), &SceneViewerLevel::CamLookUD, CID::ANY);

im->BindAction(InputNames::ToggleMouse, GetInput(this), &SceneViewerLevel::ToggleMouse, ActionState::Pressed, CID::ANY);
im->SetRelativeMouseMode(relativeMouseMode);
GetApp()->GetMainWindow()->SetRelativeMouseMode(relativeMouseMode);

GetApp()->inputManager = im;
}
Expand Down
5 changes: 3 additions & 2 deletions Samples/SoundDynamics/Level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <RavEngine/AudioGraphAsset.hpp>
#include <RavEngine/VirtualFileSystem.hpp>
#include <RavEngine/Texture.hpp>
#include <RavEngine/Window.hpp>
#include "AudioMIDI.hpp"
#include "AudioExporter.hpp"

Expand All @@ -29,7 +30,7 @@ struct InputNames {
};

void Level::ToggleMouse(){
GetApp()->inputManager->SetRelativeMouseMode(!GetApp()->inputManager->GetRelativeMouseMode());
GetApp()->GetMainWindow()->SetRelativeMouseMode(not GetApp()->GetMainWindow()->GetRelativeMouseMode());
}

Level::Level(){
Expand Down Expand Up @@ -177,7 +178,7 @@ Level::Level(){
im->BindAction(InputNames::ToggleMouse, GetInput(this), &Level::ToggleMouse, Pressed, CID::ANY);

// default to camera control
im->SetRelativeMouseMode(true);
GetApp()->GetMainWindow()->SetRelativeMouseMode(true);

// for gui
ComponentHandle<GUIComponent> gh(uiEntity);
Expand Down
7 changes: 4 additions & 3 deletions Samples/SoundDynamics/Player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <RavEngine/Transform.hpp>
#include <RavEngine/InputManager.hpp>
#include <RavEngine/Transform.hpp>
#include <RavEngine/Window.hpp>

struct PlayerController : public RavEngine::ScriptComponent {
float scaleFactor = 0;
Expand All @@ -12,7 +13,7 @@ struct PlayerController : public RavEngine::ScriptComponent {
RavEngine::ComponentHandle<RavEngine::Transform> childTransform;

inline decimalType scale(float amt) {
return amt * scaleFactor * movementSpeed * RavEngine::GetApp()->inputManager->GetRelativeMouseMode();
return amt * scaleFactor * movementSpeed * RavEngine::GetApp()->GetMainWindow()->GetRelativeMouseMode();
}

inline void MoveForward(float amt) {
Expand All @@ -31,12 +32,12 @@ struct PlayerController : public RavEngine::ScriptComponent {
}

inline void LookUp(float amt) {
childTransform->LocalRotateDelta(vector3(deg_to_rad(amt * rotationSpeed * RavEngine::GetApp()->inputManager->GetRelativeMouseMode()), 0, 0));
childTransform->LocalRotateDelta(vector3(deg_to_rad(amt * rotationSpeed * RavEngine::GetApp()->GetMainWindow()->GetRelativeMouseMode()), 0, 0));
}

inline void LookRight(float amt) {
auto& tr = GetTransform();
tr.LocalRotateDelta(vector3(0, deg_to_rad(amt * rotationSpeed * RavEngine::GetApp()->inputManager->GetRelativeMouseMode()), 0));
tr.LocalRotateDelta(vector3(0, deg_to_rad(amt * rotationSpeed * RavEngine::GetApp()->GetMainWindow()->GetRelativeMouseMode()), 0));
}

void Tick(float scale) final {
Expand Down
5 changes: 3 additions & 2 deletions Samples/Transforms/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "AppInfo.hpp"
#include <numbers>
#include <RavEngine/StartApp.hpp>
#include <RavEngine/Window.hpp>
#include <RavEngine/MeshCollection.hpp>

using namespace RavEngine;
Expand Down Expand Up @@ -146,7 +147,7 @@ struct Level : public RavEngine::World {

void ToggleMouse() {
relativeMouseMode = !relativeMouseMode;
GetApp()->inputManager->SetRelativeMouseMode(relativeMouseMode);
GetApp()->GetMainWindow()->SetRelativeMouseMode(relativeMouseMode);
}

void SetupInputs() {
Expand All @@ -171,7 +172,7 @@ struct Level : public RavEngine::World {

im->BindAction(InputNames::ToggleMouse, GetInput(this), &Level::ToggleMouse, ActionState::Pressed, CID::ANY);
im->BindAction(InputNames::ResetCamera, GetInput(this), &Level::CameraResetCallback, ActionState::Pressed, CID::ANY);
im->SetRelativeMouseMode(relativeMouseMode);
GetApp()->GetMainWindow()->SetRelativeMouseMode(relativeMouseMode);

GetApp()->inputManager = im;
}
Expand Down

0 comments on commit fac1c75

Please sign in to comment.