__FixDeltatime
This commit is contained in:
parent
dd17a70551
commit
af88277680
@ -49,7 +49,8 @@ extern "C" {
|
|||||||
|
|
||||||
#define RENDERD7VSTRING "0.8.5"
|
#define RENDERD7VSTRING "0.8.5"
|
||||||
#define CHANGELOG \
|
#define CHANGELOG \
|
||||||
"0.8.4: A lot of Fixes and new Features for BitmapPrinter! 0.8.3: Addet " \
|
"0.8.5: Fix Deltatime 0.8.4: A lot of Fixes and new Features for " \
|
||||||
|
"BitmapPrinter! 0.8.3: Addet " \
|
||||||
"Overlaycount to Info and Addet ResultDecoder for " \
|
"Overlaycount to Info and Addet ResultDecoder for " \
|
||||||
"errors.0.8.2: Fix a lot of Stuff and add c++17 based filesystem " \
|
"errors.0.8.2: Fix a lot of Stuff and add c++17 based filesystem " \
|
||||||
"class.\n0.8.1: " \
|
"class.\n0.8.1: " \
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <renderd7/log.hpp>
|
#include <renderd7/log.hpp>
|
||||||
#include <renderd7/renderd7.hpp>
|
#include <renderd7/renderd7.hpp>
|
||||||
|
|
||||||
|
#define TICKS_PER_MSEC 268111.856
|
||||||
|
|
||||||
#define D7_NOTHING C2D_Color32(0, 0, 0, 0)
|
#define D7_NOTHING C2D_Color32(0, 0, 0, 0)
|
||||||
#define CFGVER "3"
|
#define CFGVER "3"
|
||||||
@ -84,6 +85,8 @@ C3D_RenderTarget *Bottom;
|
|||||||
#define DSEVENWHITE C2D_Color32(255, 255, 255, 255)
|
#define DSEVENWHITE C2D_Color32(255, 255, 255, 255)
|
||||||
|
|
||||||
u64 delta_time;
|
u64 delta_time;
|
||||||
|
u64 last_tm;
|
||||||
|
float dtm;
|
||||||
|
|
||||||
// Screen Fade
|
// Screen Fade
|
||||||
bool fadeout = false, fadein = false, fadeout2 = false, fadein2 = false;
|
bool fadeout = false, fadein = false, fadeout2 = false, fadein2 = false;
|
||||||
@ -122,7 +125,7 @@ void screenon() {
|
|||||||
gspLcdExit();
|
gspLcdExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
float RenderD7::GetDeltaTime() { return delta_time; }
|
float RenderD7::GetDeltaTime() { return (float)dtm; }
|
||||||
|
|
||||||
bool RenderD7::DrawImageFromSheet(RenderD7::Sheet *sheet, size_t index, float x,
|
bool RenderD7::DrawImageFromSheet(RenderD7::Sheet *sheet, size_t index, float x,
|
||||||
float y, float scaleX, float scaleY) {
|
float y, float scaleX, float scaleY) {
|
||||||
@ -291,6 +294,12 @@ std::string RenderD7::GetFramerate() {
|
|||||||
bool RenderD7::MainLoop() {
|
bool RenderD7::MainLoop() {
|
||||||
if (!aptMainLoop())
|
if (!aptMainLoop())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
//Deltatime
|
||||||
|
uint64_t currentTime = svcGetSystemTick();
|
||||||
|
dtm = ((float)(currentTime / (float)TICKS_PER_MSEC) - (float)(last_tm / (float)TICKS_PER_MSEC)) / 1000.f;
|
||||||
|
last_tm = currentTime;
|
||||||
|
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
d7_hDown = hidKeysDown();
|
d7_hDown = hidKeysDown();
|
||||||
d7_hUp = hidKeysUp();
|
d7_hUp = hidKeysUp();
|
||||||
@ -481,6 +490,7 @@ Result RenderD7::Init::Main(std::string app_name) {
|
|||||||
TextBuf = C2D_TextBufNew(4096);
|
TextBuf = C2D_TextBufNew(4096);
|
||||||
Font = C2D_FontLoadSystem(CFG_REGION_USA);
|
Font = C2D_FontLoadSystem(CFG_REGION_USA);
|
||||||
printf("Graphical Interface\n");
|
printf("Graphical Interface\n");
|
||||||
|
last_tm = svcGetSystemTick();
|
||||||
// RenderD7::Msg::Display("RenderD7", "RenderD7 init success!\nWaiting for
|
// RenderD7::Msg::Display("RenderD7", "RenderD7 init success!\nWaiting for
|
||||||
// MainLoop!", Top);
|
// MainLoop!", Top);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user