UI引擎開發系列 二 事件分發處理

2021-06-22 08:02:16 字數 1778 閱讀 2144

ui場景中事件分發處理例項

#pragma once

#include "tcl.h"

#include "component/ctsingleton.h"

using namespace tcl;

//場景類 需要繼承csinglescene,場景類有自己的事件處理等

class clogiceventscene : public csinglescene,public ctsingleton

//創景logic層建立

void createlogicnode();

//node for logic

public:

//當前場景滑鼠選中物體例項

iscenenode* m_mousecollisionnode;

//主頁面和全部應用頁面的父節點,用於動畫

iscenenode* m_homeparent;

private:

//單例實現

ct_declare_singleton(clogiceventscene)

};

#include "clogiceventscene.h"

#include "clogicnodemanager.h"

#include "clogictree.h"

#include "component/cstatemachinelogic.h"

#include "chomelogic.h"

clogiceventscene::clogiceventscene()

//直接解析乙個blender檔案,將blender所包含的物體、動畫、等資料都載入到引擎

//需要走一次完整的blender解析流程

void clogiceventscene::loadblenderscene()

//需要先將blender解析成xml檔案包,以後每次用下面的介面把解析結果載入到引擎

//這種方法不需要每次都解析blender檔案,只是載入解析好的資源,所以加快了載入速度。

void clogiceventscene::loadblenderscenexml()

xmlread->drop();}

//純虛函式 必須實現

void clogiceventscene::onupdatesinglescene()

//每幀都會被呼叫。呼叫在物體繪製以後,所以這裡面處理fps等可以避免被3d物體遮擋。

void clogiceventscene::onupdate2dscene()

//場景事件處理方法

bool clogiceventscene::onevent(const sevent& in_event)

//如果不是滑鼠時間,則擊中物體為空。

else if(in_event.eventtype != tcl::eet_mouse_input_event)

//如果是滑鼠或者鍵盤事件,則需要處理,將事件下發給邏輯層處理。

if ( eet_key_input_event == in_event.eventtype || eet_mouse_input_event== in_event.eventtype)

return true;

}//建立邏輯層的**。

void clogiceventscene::createlogicnode()

//這個巨集是單例實現

ct_implement_singleton(clogiceventscene)

iOS開發系列 UI基礎 KVC

這些知識是ui初級學習的,目前我還在學習中,適合初學者看 kvc key value coding 也就是鍵值編碼 是一種獲取值和設定值的方式 當我們建立乙個類檔案,為這個類設定成員屬性的時候 建立乙個 人 類 有名字 name 年齡 age 兩個公有的成員屬性 因為使用 property關鍵字,會...

Excel開發系列二

解決.net生成excel檔案速度問題的若干方案 許多csdn上的朋友在尋求如何提高生成excel時寫 的速度,我在這有點見解,以供大家分享。當然,在生成之前,你最好能將其可見這個屬性設定為false,生成後才顯示,那樣也能稍微提高點效率。另外,我還有個秘密 就是c 與excel的互動時,每次都需要...

Django開發系列(二)

author sinpei date 2018 4 24 csdn github email sinpeilee 163.com 期待大神拍磚,輕拍 怕疼 django提供了基於web的管理工具。整合了管理後台。在管理後台中可以對我們自定義model進行crud操作,以及分頁,條件篩選等操作。url...