Misc. fixes

This commit is contained in:
Grayson Riffe (Laptop) 2021-08-23 14:25:38 -05:00
parent 5c6dcaf634
commit f75f98d9db
5 changed files with 9 additions and 7 deletions

View File

@ -159,7 +159,7 @@ namespace nf {
m_fpsClock1 = std::chrono::steady_clock::now(); m_fpsClock1 = std::chrono::steady_clock::now();
} }
std::this_thread::sleep_until(next_time); std::this_thread::sleep_until(next_time);
m_deltaTime = (std::chrono::steady_clock::now() - start_time).count(); m_deltaTime = (double)(std::chrono::steady_clock::now() - start_time).count();
next_time += wait_time; next_time += wait_time;
} }
m_currentState->onExit(); m_currentState->onExit();

View File

@ -1,7 +1,7 @@
#include "VertexBuffer.h" #include "VertexBuffer.h"
namespace nf { namespace nf {
VertexBuffer::VertexBuffer(const void* data, size_t size) { VertexBuffer::VertexBuffer(const void* data, const size_t size) {
glGenBuffers(1, &m_id); glGenBuffers(1, &m_id);
glBindBuffer(GL_ARRAY_BUFFER, m_id); glBindBuffer(GL_ARRAY_BUFFER, m_id);
glBufferData(GL_ARRAY_BUFFER, size, data, GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, size, data, GL_STATIC_DRAW);

View File

@ -12,7 +12,8 @@ namespace nf {
void Debug::LogImp(const std::string& in) { void Debug::LogImp(const std::string& in) {
std::chrono::duration<float> time = getCurrentTime(); std::chrono::duration<float> time = getCurrentTime();
std::printf("[%.4f] Debug: %s\n", time.count(), in.c_str()); std::printf("[%.4f] Debug: ", time.count());
std::cout << in << "\n";
} }
void Debug::LogImp(int in) { void Debug::LogImp(int in) {
@ -46,10 +47,10 @@ namespace nf {
MultiByteToWideChar(CP_ACP, NULL, in, -1, out, length); MultiByteToWideChar(CP_ACP, NULL, in, -1, out, length);
return out; return out;
} }
//TODO: File encryption
bool writeFile(const char* filename, const std::string& in) { bool writeFile(const char* filename, const std::string& in) {
std::string file(filename); std::string file(filename);
if (file.find('/') || file.find('\\')) { if (file.find('/') != std::string::npos || file.find('\\') != std::string::npos) {
int pos = file.find_last_of("/\\"); int pos = file.find_last_of("/\\");
std::string temp = file.substr(0, pos); std::string temp = file.substr(0, pos);
std::wstring folders(temp.begin(), temp.end()); std::wstring folders(temp.begin(), temp.end());
@ -71,7 +72,7 @@ namespace nf {
out.close(); out.close();
return true; return true;
} }
//TODO: XOR encryption
std::string readFile(const char* filename) { std::string readFile(const char* filename) {
std::ifstream in; std::ifstream in;
in.open(filename); in.open(filename);

View File

@ -9,6 +9,7 @@
#include "IntroGamestate.h" #include "IntroGamestate.h"
#include "Renderer.h" #include "Renderer.h"
//TODO: Check #include consistency //TODO: Check #include consistency
//TODO: Separate #includes between headers and implementations
//TODO: Document ALL frontend functions //TODO: Document ALL frontend functions
namespace nf { namespace nf {

View File

@ -6,7 +6,7 @@
namespace nf { namespace nf {
class VertexBuffer { class VertexBuffer {
public: public:
VertexBuffer(const void* data, size_t size); VertexBuffer(const void* data, const size_t size);
void bind() const; void bind() const;