mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 03:02:30 +00:00
feat(ui): implement CSimpleTop::OnKeyDownRepeat
This commit is contained in:
parent
d8780335f7
commit
982aedbc02
7 changed files with 43 additions and 8 deletions
|
|
@ -119,7 +119,17 @@ int32_t CGWorldFrame::OnLayerKeyDown(const CKeyEvent& evt) {
|
||||||
|
|
||||||
this->m_camera->SetFacing(yaw, pitch, roll);
|
this->m_camera->SetFacing(yaw, pitch, roll);
|
||||||
|
|
||||||
return 0;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t CGWorldFrame::OnLayerKeyDownRepeat(const CKeyEvent& evt) {
|
||||||
|
if (CSimpleFrame::OnLayerKeyDownRepeat(evt)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->OnLayerKeyDown(evt);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimpleFrame* CGWorldFrame::Create(CSimpleFrame* parent) {
|
CSimpleFrame* CGWorldFrame::Create(CSimpleFrame* parent) {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ class CGWorldFrame : public CSimpleFrame {
|
||||||
|
|
||||||
virtual void OnFrameRender(CRenderBatch* batch, uint32_t layer);
|
virtual void OnFrameRender(CRenderBatch* batch, uint32_t layer);
|
||||||
virtual int32_t OnLayerKeyDown(const CKeyEvent& evt);
|
virtual int32_t OnLayerKeyDown(const CKeyEvent& evt);
|
||||||
|
virtual int32_t OnLayerKeyDownRepeat(const CKeyEvent& evt);
|
||||||
|
|
||||||
static CSimpleFrame* Create(CSimpleFrame* parent);
|
static CSimpleFrame* Create(CSimpleFrame* parent);
|
||||||
static void RenderWorld(void* param);
|
static void RenderWorld(void* param);
|
||||||
|
|
|
||||||
|
|
@ -1091,6 +1091,10 @@ int32_t CSimpleFrame::OnLayerKeyUp(const CKeyEvent& evt) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t CSimpleFrame::OnLayerKeyDownRepeat(const CKeyEvent& evt) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame::OnLayerMouseDown(const CMouseEvent& evt, const char* btn) {
|
int32_t CSimpleFrame::OnLayerMouseDown(const CMouseEvent& evt, const char* btn) {
|
||||||
if (!btn) {
|
if (!btn) {
|
||||||
if (this->m_lookForDrag & evt.button) {
|
if (this->m_lookForDrag & evt.button) {
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ class CSimpleFrame : public CScriptRegion {
|
||||||
virtual int32_t OnLayerChar(const CCharEvent& evt);
|
virtual int32_t OnLayerChar(const CCharEvent& evt);
|
||||||
virtual int32_t OnLayerKeyDown(const CKeyEvent& evt);
|
virtual int32_t OnLayerKeyDown(const CKeyEvent& evt);
|
||||||
virtual int32_t OnLayerKeyUp(const CKeyEvent& evt);
|
virtual int32_t OnLayerKeyUp(const CKeyEvent& evt);
|
||||||
|
virtual int32_t OnLayerKeyDownRepeat(const CKeyEvent& evt);
|
||||||
virtual int32_t OnLayerMouseDown(const CMouseEvent& evt, const char* btn);
|
virtual int32_t OnLayerMouseDown(const CMouseEvent& evt, const char* btn);
|
||||||
virtual int32_t OnLayerMouseUp(const CMouseEvent& evt, const char* btn);
|
virtual int32_t OnLayerMouseUp(const CMouseEvent& evt, const char* btn);
|
||||||
virtual void PostLoadXML(XMLNode* node, CStatus* status);
|
virtual void PostLoadXML(XMLNode* node, CStatus* status);
|
||||||
|
|
|
||||||
|
|
@ -124,9 +124,25 @@ int32_t CSimpleTop::OnKeyDown(const EVENT_DATA_KEY* pKeyData, void* param) {
|
||||||
return eaten == 0;
|
return eaten == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleTop::OnKeyDownRepeat(const void* a1, void* a2) {
|
int32_t CSimpleTop::OnKeyDownRepeat(const EVENT_DATA_KEY* pKeyData, void* param) {
|
||||||
// TODO
|
CSimpleTop* top = static_cast<CSimpleTop*>(param);
|
||||||
return 0;
|
CSimpleTop::m_eventTime = pKeyData->time;
|
||||||
|
|
||||||
|
int32_t eaten = 0;
|
||||||
|
|
||||||
|
CSimpleFrame* frame = top->m_keydownCapture[pKeyData->key];
|
||||||
|
|
||||||
|
if (frame) {
|
||||||
|
CKeyEvent keyEvent;
|
||||||
|
keyEvent = *pKeyData;
|
||||||
|
keyEvent.id = 0x40060065;
|
||||||
|
|
||||||
|
frame->OnLayerKeyDownRepeat(keyEvent);
|
||||||
|
|
||||||
|
eaten = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return eaten == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleTop::OnKeyUp(const EVENT_DATA_KEY* pKeyData, void* param) {
|
int32_t CSimpleTop::OnKeyUp(const EVENT_DATA_KEY* pKeyData, void* param) {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class CSimpleTop : public CLayoutFrame {
|
||||||
static int32_t OnFocusChanged(const void* a1, void* a2);
|
static int32_t OnFocusChanged(const void* a1, void* a2);
|
||||||
static int32_t OnIme(const void* a1, void* a2);
|
static int32_t OnIme(const void* a1, void* a2);
|
||||||
static int32_t OnKeyDown(const EVENT_DATA_KEY* pKeyData, void* param);
|
static int32_t OnKeyDown(const EVENT_DATA_KEY* pKeyData, void* param);
|
||||||
static int32_t OnKeyDownRepeat(const void* a1, void* a2);
|
static int32_t OnKeyDownRepeat(const EVENT_DATA_KEY* pKeyData, void* param);
|
||||||
static int32_t OnKeyUp(const EVENT_DATA_KEY* pKeyData, void* param);
|
static int32_t OnKeyUp(const EVENT_DATA_KEY* pKeyData, void* param);
|
||||||
static int32_t OnMouseDown(const EVENT_DATA_MOUSE* pMouseData, void* param);
|
static int32_t OnMouseDown(const EVENT_DATA_MOUSE* pMouseData, void* param);
|
||||||
static int32_t OnMouseMove(const EVENT_DATA_MOUSE* pMouseData, void* param);
|
static int32_t OnMouseMove(const EVENT_DATA_MOUSE* pMouseData, void* param);
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,16 @@ void CWorldScene::Initialize() {
|
||||||
// TODO
|
// TODO
|
||||||
CWorldScene::s_m2Scene = M2CreateScene();
|
CWorldScene::s_m2Scene = M2CreateScene();
|
||||||
g_models[0] = CWorldScene::s_m2Scene->CreateModel(R"(World\LORDAERON\Arathi\PassiveDoodads\Trees\ArathiStump01.m2)", 0);
|
g_models[0] = CWorldScene::s_m2Scene->CreateModel(R"(World\LORDAERON\Arathi\PassiveDoodads\Trees\ArathiStump01.m2)", 0);
|
||||||
g_models[0]->SetWorldTransform(C3Vector(1.0f, 0.0f, 0.0f), 0.0f, 0.1f);
|
g_models[0]->SetWorldTransform(C3Vector(0.0f, 1.0f, 0.0f), 180.0f, 0.1f);
|
||||||
|
|
||||||
g_models[1] = CWorldScene::s_m2Scene->CreateModel(R"(World\NoDXT\Detail\ApkBus01.m2)", 0);
|
g_models[1] = CWorldScene::s_m2Scene->CreateModel(R"(World\NoDXT\Detail\ApkBus01.m2)", 0);
|
||||||
g_models[1]->SetWorldTransform(C3Vector(1.5f), 0.0f, 1.0f);
|
g_models[1]->SetWorldTransform(C3Vector(0.0f, 1.5f, 0.0f), 180.0f, 1.0f);
|
||||||
|
|
||||||
g_models[2] = CWorldScene::s_m2Scene->CreateModel(R"(Creature\BloodElfGuard\BloodElfMale_Guard.m2)", 0);
|
g_models[2] = CWorldScene::s_m2Scene->CreateModel(R"(Creature\BloodElfGuard\BloodElfMale_Guard.m2)", 0);
|
||||||
g_models[2]->SetWorldTransform(C3Vector(0.0f), 0.0f, 1.0f);
|
g_models[2]->SetWorldTransform(C3Vector(0.0f), 180.0f, 1.0f);
|
||||||
|
|
||||||
|
g_models[3] = CWorldScene::s_m2Scene->CreateModel(R"(World\AZEROTH\ELWYNN\PASSIVEDOODADS\Trees\ElwynnTree01\ElwynnPine01.m2)", 0);
|
||||||
|
g_models[3]->SetWorldTransform(C3Vector(0.0f, -1.0f, 0.0f), 180.0f, 1.0f);
|
||||||
|
|
||||||
for (size_t i = 0; i < 10; ++i) {
|
for (size_t i = 0; i < 10; ++i) {
|
||||||
if (!g_models[i])
|
if (!g_models[i])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue