second commit
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
#include <asset/raylib_asset.hpp>
|
||||
#include <scene.hpp>
|
||||
#include <components.hpp>
|
||||
|
||||
#include <box2d/box2d.h>
|
||||
#include <box2d/types.h>
|
||||
#include <raylib.h>
|
||||
#include <rlImGui.h>
|
||||
#include <imgui.h>
|
||||
#include <entt/entt.hpp>
|
||||
#include <asset_packer/asset.hpp>
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
|
||||
// #include <windows.h>
|
||||
// #include <psapi.h>
|
||||
|
||||
EngineState g_Engine;
|
||||
RaylibAssetLoader asset_loader;
|
||||
|
||||
// size_t get_current_ram_usage() {
|
||||
// PROCESS_MEMORY_COUNTERS pmc;
|
||||
// if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
|
||||
// return pmc.WorkingSetSize;
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
void asset_thread(){
|
||||
// for (int i = 0; i < 1000000; i++){
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
asset_loader.load_asset("assets/bird.png");
|
||||
// asset_loader.unload_asset("assets/bird.png");
|
||||
// if (WindowShouldClose()) break;
|
||||
// }
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
int* num = reinterpret_cast<int*>(new char[4]);
|
||||
SetTraceLogLevel(LOG_NONE);
|
||||
InitWindow(800,800,"test");
|
||||
// std::cout << "Starting Test..." << std::endl;
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
||||
|
||||
// std::thread t(asset_thread);
|
||||
// asset_loader.load_asset("assets/bird.png");
|
||||
|
||||
while(!WindowShouldClose()){
|
||||
// size_t ram_bytes = get_current_ram_usage();
|
||||
asset_loader.load_asset("assets/bird.png");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
asset_loader.unload_asset("assets/bird.png");
|
||||
|
||||
BeginDrawing();
|
||||
ClearBackground(RAYWHITE);
|
||||
// auto tex = asset_loader.get_texture("assets/bird.png");
|
||||
// if (tex != nullptr){
|
||||
// DrawTexture(*tex, 0,0,WHITE);
|
||||
// }
|
||||
rlImGuiBegin();
|
||||
ImGui::TextUnformatted(std::format("hello {}","world").c_str());
|
||||
// ImGui::TextUnformatted(std::format("Memory usage: %.2f",ram_bytes/(1024*1024)).c_str());
|
||||
rlImGuiEnd();
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
// t.join();
|
||||
CloseWindow();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user