Skip to content

Commit

Permalink
Merge pull request #95 from thobbsinteractive/merge-of-stable-changes…
Browse files Browse the repository at this point in the history
…-to-master

Merge of stable changes to master
  • Loading branch information
thobbsinteractive committed Jun 30, 2022
2 parents 443721c + 519253e commit 64c8b5a
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 180 deletions.
35 changes: 0 additions & 35 deletions config_linux.ini

This file was deleted.

3 changes: 1 addition & 2 deletions remc2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ install(
)
install(
FILES
${CMAKE_SOURCE_DIR}/config_linux.ini
RENAME config.ini
${CMAKE_SOURCE_DIR}/config.ini
DESTINATION bin
)
install(
Expand Down
14 changes: 7 additions & 7 deletions remc2/engine/Basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ char x_BYTE_E3766 = 0; // weak

long oldmillis = 0;

clock_t frameStart = 0;
clock_t frameStop = 0;
clock_t timeDelta = 0;
std::chrono::time_point<std::chrono::steady_clock> frameStart;
std::chrono::duration<double> timeDelta(0);
int frameCount = 0;
int fps = 0;

Expand Down Expand Up @@ -1687,20 +1686,21 @@ void DrawText_2BC10(const char* textbuffer, int16_t posx, int16_t posy, uint8_t

void VGA_CalculateAndPrintFPS(int x, int y)
{
timeDelta += clock() - frameStart;
//#include <chrono>
//auto begin = std::chrono::high_resolution_clock::now();
timeDelta += std::chrono::steady_clock::now() - frameStart;
frameCount++;

if (clockToMilliseconds(timeDelta) > 1000.0)
if (timeDelta > std::chrono::duration<double>(1.0))
{
fps = frameCount;
frameCount = 0;
timeDelta = 0;
timeDelta = std::chrono::duration<double>(0);
}

VGA_GotoXY(x, y);
std::string fpsStr = "FPS: ";
fpsStr.append(std::to_string(fps));
const char* cstr = fpsStr.c_str();

VGA_Draw_string((char*)fpsStr.c_str());
}
Expand Down
6 changes: 3 additions & 3 deletions remc2/engine/Basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <ctype.h>
#include <cstdint>
#include <functional>
#include <chrono>

#include "stdint.h"

Expand Down Expand Up @@ -150,9 +151,8 @@ extern char bigGraphicsPath[];

extern long oldmillis;

extern clock_t frameStart;
extern clock_t frameStop;
extern clock_t timeDelta;
extern std::chrono::time_point<std::chrono::steady_clock> frameStart;
extern std::chrono::duration<double> timeDelta;
extern int frameCount;
extern int fps;

Expand Down
Loading

0 comments on commit 64c8b5a

Please sign in to comment.