Files
conquest/src/client/main.nim

51 lines
1.4 KiB
Nim
Raw Normal View History

2025-09-05 19:39:24 +02:00
import tables
import ./utils/appImGui
2025-09-06 14:12:51 +02:00
import ./views/[dockspace, agents, listeners, eventlog]
2025-09-02 12:48:46 +02:00
proc main() =
var app = createApp(1024, 800, imnodes = true, title = "Conquest", docking = true)
defer: app.destroyApp()
2025-09-02 12:48:46 +02:00
2025-09-05 19:39:24 +02:00
var
views: Table[string, ptr bool]
showConquest = true
showAgentsTable = true
showAgentsGraph = false
2025-09-06 14:12:51 +02:00
showListeners = false
showEventlog = true
2025-09-05 19:39:24 +02:00
views["Agents [Table View]"] = addr showAgentsTable
views["Agents [Graph View]"] = addr showAgentsGraph
2025-09-06 14:12:51 +02:00
views["Listeners"] = addr showListeners
views["Eventlog"] = addr showEventlog
2025-09-02 12:48:46 +02:00
let io = igGetIO()
2025-09-02 12:48:46 +02:00
# main loop
while not app.handle.windowShouldClose:
pollEvents()
2025-09-05 19:39:24 +02:00
# Reduce rendering activity when window is minimized
if app.isIconifySleep():
continue
newFrame()
2025-09-06 14:12:51 +02:00
# UI components/views
2025-09-05 19:39:24 +02:00
Dockspace().draw(addr showConquest, views)
2025-09-06 14:12:51 +02:00
if showAgentsTable: AgentsTable("Agents [Table View]").draw(addr showAgentsTable)
if showAgentsGraph: AgentsTable("Agents [Graph View]").draw(addr showAgentsGraph)
if showListeners: ListenersTable("Listeners").draw(addr showListeners)
if showEventlog:Eventlog("Eventlog").draw(addr showEventlog)
2025-09-02 12:48:46 +02:00
igShowDemoWindow(nil)
# render
app.render()
2025-09-02 12:48:46 +02:00
if not showConquest:
app.handle.setWindowShouldClose(true)
2025-09-02 12:48:46 +02:00
when isMainModule:
main()