Fixed XBOX ONE Support

This commit is contained in:
Reece Mackie 2019-04-27 18:15:28 +01:00
commit 2d24a9c7a1
2 changed files with 41 additions and 4 deletions

View file

@ -25,11 +25,12 @@ App::App()
static int posX = 100;
static int posY = 100;
static int time = 0;
static int gTime = 0;
// This method is called every frame
void App::Update()
{
//return;
// Draw
BeginDrawing();
@ -71,7 +72,7 @@ void App::Update()
pos -= GetMouseWheelMove();
DrawRectangle(280, pos + 50, 20, 20, BLACK);
DrawRectangle(250, 280 + (time++ % 60), 10, 10, PURPLE);
DrawRectangle(250, 280 + (gTime++ % 60), 10, 10, PURPLE);
EndDrawing();
}

View file

@ -37,6 +37,7 @@
#include PCH
#endif
#include <chrono>
#include <memory>
#include <wrl.h>
@ -142,10 +143,26 @@ public:
msg->Vector0 = screenSize;
UWPSendMessage(msg);
//Send the time to the core
using clock = std::chrono::high_resolution_clock;
auto timeStart = clock::now();
//Set fps if 0
if (GetFPS() <= 0)
SetTargetFPS(60);
while (!mWindowClosed)
{
if (mWindowVisible)
{
//Send time
auto delta = clock::now() - timeStart;
UWPMessage* timeMsg = CreateUWPMessage();
timeMsg->Type = SetGameTime;
timeMsg->Double0 = std::chrono::duration_cast<std::chrono::seconds>(delta).count();
UWPSendMessage(timeMsg);
//Call update function
Update();