DaftBrit / NoitaArchipelago

Other
7 stars 3 forks source link

Chat client in-game #79

Open heinermann opened 1 year ago

heinermann commented 1 year ago

It would be nice to have a chat client directly in-game for sending messages and AP commands.

heinermann commented 1 year ago

Research notes:

The built in UI with GuiTextInput is a disaster. There's no way to capture the ENTER key in the normal mod API, text input happens when the mouse hovers over it (no concept of active control), holding backspace doesn't repeatedly delete characters.

Safe to say this will be on hold for now.

local ChatBox = {}

local ID_TXT = 44480

function ChatBox:create()
    self.gui = GuiCreate()
  self.text = ""
end

function ChatBox:update()
    if self.gui == nil then return end

    GuiStartFrame(self.gui)

    local _, screen_height = GuiGetScreenDimensions(self.gui)

  local x = 16
    local y = screen_height - 32
  self.text = GuiTextInput(self.gui, ID_TXT, x, y, self.text, 120, 120)
end

return ChatBox
ScipioWright commented 1 year ago

Noita Together has a chat box. It has the same limitations as you're stating above, but it's at least usable.

heinermann commented 1 year ago

I wonder if specifying newline as a valid char would allow newline in the control? After which we would detect and clear it. Might be something to test. Can also look at Noita Together.