41 lines
1.2 KiB
C++
Executable File
41 lines
1.2 KiB
C++
Executable File
#include "LvglLinux_x86.h"
|
|
#include "Log.h"
|
|
#include <iostream>
|
|
#include <thread>
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
extern int mainTest(const unsigned int width, const unsigned int height, void (*appInit)());
|
|
extern int lvglRuning;
|
|
extern const int LVGL_RUNING;
|
|
extern const int LVGL_EXIT;
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
bool CreateGuiEngineImpl()
|
|
{
|
|
std::shared_ptr<GuiEngine> impl = std::move(std::make_shared<LvglLinuxX86>());
|
|
GuiEngine::GetInstance(&impl);
|
|
return true;
|
|
}
|
|
bool LvglLinuxX86::Init(const unsigned int &width, const unsigned int &height, void (*appInit)())
|
|
{
|
|
auto mainFunc = [](const unsigned int width_, const unsigned int height_, void (*appInit_)())
|
|
{
|
|
mainTest(width_, height_, appInit_);
|
|
};
|
|
std::thread(mainFunc, width, height, appInit).detach();
|
|
return true;
|
|
}
|
|
void LvglLinuxX86::UnInit()
|
|
{
|
|
/**
|
|
* @brief
|
|
* There is no need to uninit the lvgl, maybe lvgl will do it automatically.
|
|
*/
|
|
lvglRuning = LVGL_EXIT;
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(1000 * 2));
|
|
// monitor_uninit();
|
|
std::cout << "LvglLinuxX86 UnInit." << std::endl;
|
|
} |