コード例 #1
0
void GuideManager::addListener()
{
    auto func = [this](EventCustom* event)
    {
        this->handleEvent(event);
    };
    
    ADD_LISTENER(GUIDE_EVENT_TOUCH_IN_RECT, func);
    ADD_LISTENER(GUIDE_EVENT_OUT_OF_RECT, func);
    ADD_LISTENER(GUIDE_EVENT_BEGIN_GUIDE, func);
    ADD_LISTENER(GUIDE_EVENT_CONTENUE, func);
    ADD_LISTENER(GUIDE_EVENT_WAIT, func);
}
コード例 #2
0
void
GHOST_WindowWayland::DisplaySyncHandler::init()
{
	m_callback = WL_CHK(wl_display_sync(m_window->m_system->getDisplay()));
	ADD_LISTENER(callback);
}
コード例 #3
0
void
GHOST_WindowWayland::WindowDrawHandler::init()
{
	m_callback = WL_CHK(wl_surface_frame(m_window->m_surface));
	ADD_LISTENER(callback);
}
コード例 #4
0
GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
                                 const STR_String& title,
                                 GHOST_TInt32 left,
                                 GHOST_TInt32 top,
                                 GHOST_TUns32 width,
                                 GHOST_TUns32 height,
                                 GHOST_TWindowState state,
                                 const GHOST_TEmbedderWindowID parentWindow,
                                 GHOST_TDrawingContextType type,
                                 const bool stereoVisual,
                                 const bool exclusive,
                                 const GHOST_TUns16 numOfAASamples
                                 )
	: GHOST_Window(width, height, state, type, stereoVisual, exclusive, numOfAASamples)
	, m_system(system)
	, m_surface(NULL)
	, m_shell_surface(NULL)
	, m_window(NULL)
	, m_egl_surface(EGL_NO_SURFACE)
	, m_egl_context(EGL_NO_CONTEXT)
	, m_x(left)
	, m_y(top)
	, m_width(width)
	, m_height(height)
	, m_state(GHOST_kWindowStateNormal)
	, m_redraw(this)
	, m_sync(this)
{
	wl_display *display = m_system->getDisplay();
	wl_compositor *compositor = m_system->getCompositor();
	wl_shell *shell = m_system->getShell();
	EGLDisplay egl_display = m_system->getEglDisplay();

	assert(display);
	assert(compositor);
	assert(shell);

	m_surface = WL_CHK(wl_compositor_create_surface(compositor));

	m_shell_surface =
		WL_CHK(wl_shell_get_shell_surface(shell, m_surface));

	ADD_LISTENER(shell_surface);

	m_window = WL_CHK(wl_egl_window_create(m_surface, width, height));

	m_egl_surface =
		EGL_CHK(eglCreateWindowSurface(egl_display, m_system->getEglConf(),
			m_window, NULL));


	assert(m_egl_surface != EGL_NO_SURFACE);

	setTitle(title);

	/* now set up the rendering context. */
	if (installDrawingContext(type) == GHOST_kSuccess) {
		// m_valid_setup = true;
		GHOST_PRINT("Created window\n");
	}

	EGL_CHK(wl_shell_surface_set_toplevel(m_shell_surface));
	resize();
	m_sync.initialize();
}
コード例 #5
0
ファイル: Renderer.cpp プロジェクト: JamesLinus/dawnengine
NAMESPACE_BEGIN

Renderer::Renderer(const String& basePath, const String& prefPath,
                   Input* inputMgr, const String& windowTitle)
    : mInputMgr(inputMgr),
      mWindow(nullptr),
	  mLogManager(nullptr),
	  mLog(nullptr),
	  mRoot(nullptr),
      mSceneManager(nullptr),
	  mRootNode(nullptr),
      mRenderWindow(nullptr),
      mViewport(nullptr),
      mDefaultCamera(nullptr),
      mRaySceneQuery(nullptr),
	  mRenderSystemPlugin(nullptr),
	  mParticleUniversePlugin(nullptr),
      mRTRoot(nullptr),
      mRTRootPosition(Position::origin)
{
    // Read config file
    Vec2i displayMode = Config::Get<Vec2i>("displaymode", Vec2i(1280, 800));
    bool fullscreen = Config::Get<bool>("fullscreen", false);
    bool vsync = Config::Get<bool>("vsync", true);

    // Set up Ogre's log manager
    mLogManager = new Ogre::LogManager();
    mLog = mLogManager->createLog(prefPath + "ogre.log", true, false, false);

    // Create the Ogre root
    mRoot = new Ogre::Root("", "");
    LOG << "Created Ogre Root";
    LOG << "\tVersion: " << OGRE_VERSION_MAJOR << "." << OGRE_VERSION_MINOR << "."
                << OGRE_VERSION_PATCH << " " << OGRE_VERSION_NAME;

    // PLUGIN STAGE
    LoadPlugins();

    // Set the render system to the first available renderer
    if (mRoot->getAvailableRenderers().empty())
    {
        // TODO: THIS SHOULD NEVER HAPPEN
        assert(0);
    }
    mRoot->setRenderSystem(mRoot->getAvailableRenderers().front());

    // WINDOW CREATION STAGE

    // Window options
    Ogre::NameValuePairList options;
    options["vsync"] = vsync ? "true" : "false";
    options["gamma"] = "true";
    options["title"] = windowTitle;
    CreateSDLWindow(windowTitle, displayMode, fullscreen, options);

    // Initialise Ogre and use the SDL window
    mRoot->initialise(false, "", "");
    mRenderWindow = mRoot->createRenderWindow(windowTitle, displayMode.x, displayMode.y, fullscreen, &options);
    mRenderWindow->setVisible(true);

    // OGRE IS NOW READY, SET UP THE SCENE
	InitResources(basePath);
    InitScene();

    // Set up the raycast query object
    mRaySceneQuery = mSceneManager->createRayQuery(Ogre::Ray(), Ogre::SceneManager::WORLD_GEOMETRY_TYPE_MASK);
    mRaySceneQuery->setSortByDistance(true);
    mRaySceneQuery->setQueryMask(UNIVERSE_OBJECT);

    // Set up the deferred shading system
    mDeferredShadingMgr = new DeferredShadingManager(mViewport, mSceneManager);

    // Set up post processing
    mHDRComp = Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "HDR");
    mBlurComp = Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "GaussianBlur");
    mHDRComp->setEnabled(true);
    //mBlurComp->setEnabled(true);

    // Set up the sprite manager
    mSpriteManager = new SpriteManager(mViewport, mSceneManager);

    // Set up the root scene nodes
    mRootNode = mSceneManager->getRootSceneNode();
    mRTRoot = mRootNode->createChildSceneNode();

    // Add event delegates
    ADD_LISTENER(Renderer, EvtData_KeyDown);
}
コード例 #6
0
NAMESPACE_BEGIN

StateManager::StateManager()
{
    ADD_LISTENER(StateManager, EvtData_KeyDown);
}