Merge branch 'main' into SP3-141-Camera-System

This commit is contained in:
maverickdgg 2023-03-10 23:34:06 +08:00
commit f9a3fe72ce
2 changed files with 39 additions and 6 deletions

View File

@ -798,17 +798,45 @@ namespace SHADE
//Get cursor position, even when it is outside window //Get cursor position, even when it is outside window
POINT p; POINT p;
GetCursorPos(&p); GetCursorPos(&p); //This point is WRT the screen, not the window
//ScreenToClient(GetActiveWindow(), &p);
mouseScreenX = p.x; mouseScreenX = p.x;
mouseScreenY = p.y; mouseScreenY = p.y;
//SHLOGV_INFO("MouseScreenY = {}", mouseScreenY);
//Velocity if (!mouseCentering)
mouseVelocityX = static_cast<double>(mouseScreenX - mouseScreenXLast) / dt; {
mouseVelocityY = static_cast<double>(mouseScreenY - mouseScreenYLast) / dt; //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 //Mouse Centering
if (mouseCentering) /*if (mouseCentering)
{ {
uint32_t width = SHADE::SHGraphicsSystemInterface::GetWindowWidth(); uint32_t width = SHADE::SHGraphicsSystemInterface::GetWindowWidth();
uint32_t height = SHADE::SHGraphicsSystemInterface::GetWindowHeight(); uint32_t height = SHADE::SHGraphicsSystemInterface::GetWindowHeight();
@ -819,7 +847,7 @@ namespace SHADE
GetCursorPos(&p); GetCursorPos(&p);
mouseVelocityX -= static_cast<double>(p.x - mouseScreenX) / dt; mouseVelocityX -= static_cast<double>(p.x - mouseScreenX) / dt;
mouseVelocityY -= static_cast<double>(p.y - mouseScreenY) / dt; mouseVelocityY -= static_cast<double>(p.y - mouseScreenY) / dt;
} }*/
if (mouseVelocityX != 0.0 || mouseVelocityY != 0.0) if (mouseVelocityX != 0.0 || mouseVelocityY != 0.0)
controllerInUse = false; controllerInUse = false;

View File

@ -882,6 +882,11 @@ namespace SHADE
System::Collections::Generic::IEnumerable<System::Type^>^ selectorFunc(System::Reflection::Assembly^ assembly) 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(); return assembly->GetExportedTypes();
} }
Pair^ resultSelectorFunc(System::Reflection::Assembly^ assembly, System::Type^ type) Pair^ resultSelectorFunc(System::Reflection::Assembly^ assembly, System::Type^ type)