[WIP] added Join() at WorkObject

This commit is contained in:
hyzboy 2025-01-25 15:23:36 +08:00
parent 6141dbf4d5
commit 82a3ec4922

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include<hgl/graph/RenderFramework.h> #include<hgl/graph/RenderFramework.h>
#include<hgl/graph/module/SwapchainModule.h>
#include<hgl/Time.h> #include<hgl/Time.h>
namespace hgl namespace hgl
@ -27,7 +28,7 @@ namespace hgl
virtual ~WorkObject()=default; virtual ~WorkObject()=default;
virtual void Start(RenderFramework *rf) virtual void Join(RenderFramework *rf)
{ {
render_framework=rf; render_framework=rf;
} }
@ -38,7 +39,7 @@ namespace hgl
class WorkManager class WorkManager
{ {
graph::RenderTarget *render_target; graph::RenderFramework *render_framework;
uint fps=60; uint fps=60;
double frame_time=1.0f/double(fps); double frame_time=1.0f/double(fps);
@ -50,16 +51,9 @@ namespace hgl
public: public:
WorkManager()=default; WorkManager(graph::RenderFramework *rf)
bool Init(const OSString &app_name,uint w,uint h)
{ {
render_framework=new graph::RenderFramework(app_name); render_framework=rf;
if(!render_framework->Init(w,h))
return(false);
return(true);
} }
void SetFPS(uint f) void SetFPS(uint f)
@ -115,6 +109,8 @@ namespace hgl
cur_work_object=wo; cur_work_object=wo;
wo->Join(render_framework);
Run(); Run();
} }
};//class WorkManager };//class WorkManager