|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2021 nono project ! 4: // Licensed under nono-license.txt ! 5: // ! 6: ! 7: #include "cuimessage.h" ! 8: ! 9: std::array<CUIMessage::Func, UIMessage::ID_MAX> CUIMessage::func_table; ! 10: ! 11: // UIMessage を func に接続する ! 12: /*static*/ void ! 13: CUIMessage::Connect(UIMessage::ID id, CUIMessage::Func func) ! 14: { ! 15: func_table[id] = func; ! 16: } ! 17: ! 18: // UIMessage を処理する ! 19: /*static*/ void ! 20: CUIMessage::Process(UIMessage::Queue& queue) ! 21: { ! 22: UIMessage m; ! 23: ! 24: while (queue.Dequeue(&m)) { ! 25: UIMessage::ID id = m.GetID(); ! 26: if (id < 0 || id >= UIMessage::ID_MAX) { ! 27: PANIC("Invalid UIMessage %d", id); ! 28: } ! 29: auto func = func_table[id]; ! 30: if (func) { ! 31: func(m); ! 32: } ! 33: } ! 34: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.