hpp文件
// 庫文件引入
#ifdef __QNX__
screen_window_t* kzsWindowNativeGetScreenWindow(struct KzsWindowNative* windowNative);
struct KzsDesktopNative* kzsDesktopGetNative(const struct KzsDesktop* desktop);
screen_context_t* kzsDesktopNativeGetScreenContext(struct KzsDesktopNative* desktopNative);
#include <screen/screen.h>
#include <stdio.h>
#include <stdlib.h>
#define EGL_EGLEXT_PROTOTYPES = 1
#define GL_GLEXT_PROTOTYPES = 1
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <EGL/eglext.h>
#include <unistd.h>
#include <signal.h>
#include <kanzi/core.ui/platform/windowing/common/kzs_desktop.h>
#include <kanzi/core.ui/platform/windowing/kzs_window_native.hpp>
#include <kanzi/core.ui/platform/windowing/qnx_screen/kzs_desktop_native.h>
#include <kanzi/core.ui/platform/windowing/qnx_screen/kzs_display_native.h>
#include <kanzi/core.ui/platform/windowing/qnx_screen/kzs_window_native.h>
#include <screen/screen.h>
#endif
main.cpp中onProjectLoaded()加入
// 配置可執行程序name=TestDemo
#ifdef __QNX__
shared_ptr<GlGraphicsOutput> output = dynamic_pointer_cast<GlGraphicsOutput>(getGraphicsOutput());
KzsDesktopNative* desktopNative = kzsDesktopGetNative(output->getDesktop());
screen_window_t mainWindow = *kzsWindowNativeGetScreenWindow(kzsWindowGetNative(output->getWindow()));
char new_name[64] = "TestDemo";
screen_set_window_property_cv(mainWindow, SCREEN_PROPERTY_ID_STRING, sizeof(new_name), new_name);
screen_buffer_t screen_buf[2];
screen_get_window_property_pv(mainWindow, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)screen_buf);
//KzLogDebug(("set Window Name {}", new_name));
int rc = screen_post_window(mainWindow, screen_buf[0], 0, NULL, 0);
if (rc) {
//KzLogDebug(("Kanzi screen_post_window failed."));
}
#endif
(方式一)main.cpp中 onConfigure(ApplicationProperties& configuration)加入
virtual void onConfigure(ApplicationProperties& configuration) KZ_OVERRIDE
{
configuration.binaryName = "demotest.kzb.cfg";
// 配置可執行程序的groupname
configuration.defaultWindowProperties.groupName = string("TEST_DEMO");
configuration.defaultWindowProperties.width = 1280;
configuration.defaultWindowProperties.height = 720;
// 配置kanzi工程的rgba參數爲8位使在kzb中設置透明背景生效
configuration.defaultSurfaceProperties.bitsColorR = 8;
configuration.defaultSurfaceProperties.bitsColorG = 8;
configuration.defaultSurfaceProperties.bitsColorB = 8;
configuration.defaultSurfaceProperties.bitsAlpha = 8;
}
(方式二)application.cfg中配置
SurfaceBitsRed = 8
SurfaceBitsGreen = 8
SurfaceBitsBlue = 8
SurfaceBitsAlpha = 8
DefaultDisplayIndex = 1
備註:kanzi工程中設置背景色rgba爲0,0,0,0(Screen+RootPage)
application.cfg example |
|
example |
|