Change Camera Collider tags for new camera collision in scenes #425

Merged
maverickdgg merged 3 commits from SP3-141-Camera-System into main 2023-03-10 23:36:19 +08:00
2 changed files with 39 additions and 6 deletions
Showing only changes of commit f9a3fe72ce - Show all commits

View File

@ -798,17 +798,45 @@ namespace SHADE
//Get cursor position, even when it is outside window
POINT p;
GetCursorPos(&p);
GetCursorPos(&p); //This point is WRT the screen, not the window
//ScreenToClient(GetActiveWindow(), &p);
mouseScreenX = p.x;
mouseScreenY = p.y;
//SHLOGV_INFO("MouseScreenY = {}", mouseScreenY);
//Velocity
mouseVelocityX = static_cast<double>(mouseScreenX - mouseScreenXLast) / dt;
mouseVelocityY = static_cast<double>(mouseScreenY - mouseScreenYLast) / dt;
if (!mouseCentering)
{
//Velocity
mouseVelocityX = static_cast<double>(mouseScreenX - mouseScreenXLast) / dt;
mouseVelocityY = static_cast<double>(mouseScreenY - mouseScreenYLast) / dt;
}
else
{
//Mouse centering
//uint32_t width = SHADE::SHGraphicsSystemInterface::GetWindowWidth();
//uint32_t height = SHADE::SHGraphicsSystemInterface::GetWindowHeight();
int mouseCenterX = 0;
int mouseCenterY = 0;
RECT wndRect = { NULL }; //4th quadrant
if (GetWindowRect(GetActiveWindow(), &wndRect))
{
mouseCenterX = wndRect.left + (wndRect.right - wndRect.left) / 2;
mouseCenterY = wndRect.top + (wndRect.bottom - wndRect.top) / 2;
//SHLOGV_INFO("W: {0}, H: {1}", (wndRect.right - wndRect.left), (wndRect.bottom - wndRect.top));
}
//Velocity
mouseVelocityX = static_cast<double>(mouseScreenX - mouseCenterX) / dt;
mouseVelocityY = static_cast<double>(mouseScreenY - mouseCenterY) / dt;
//SHLOGV_INFO("mouseScreenY = {0:0}, mouseCenterY = {1:0}", mouseScreenY, mouseCenterY);
//SHLOGV_INFO("{0.0}", mouseVelocityY);
SetMouseScreenPosition(mouseCenterX, mouseCenterY);
}
//Mouse Centering
if (mouseCentering)
/*if (mouseCentering)
{
uint32_t width = SHADE::SHGraphicsSystemInterface::GetWindowWidth();
uint32_t height = SHADE::SHGraphicsSystemInterface::GetWindowHeight();
@ -819,7 +847,7 @@ namespace SHADE
GetCursorPos(&p);
mouseVelocityX -= static_cast<double>(p.x - mouseScreenX) / dt;
mouseVelocityY -= static_cast<double>(p.y - mouseScreenY) / dt;
}
}*/
if (mouseVelocityX != 0.0 || mouseVelocityY != 0.0)
controllerInUse = false;

View File

@ -882,6 +882,11 @@ namespace SHADE
System::Collections::Generic::IEnumerable<System::Type^>^ selectorFunc(System::Reflection::Assembly^ assembly)
{
if (assembly == nullptr)
{
Debug::LogError("[ScriptStore] Received null assembly while collecting Script types. This should not happen!");
return nullptr;
}
return assembly->GetExportedTypes();
}
Pair^ resultSelectorFunc(System::Reflection::Assembly^ assembly, System::Type^ type)