Results 1 to 5 of 5

Thread: Console-like chat GUI component?

  1. #1

    Default Console-like chat GUI component?


    I would like to add a console-like chat to my game (i.e. you press a key, say, 'Enter', then you can enter a line, press Enter again to send it).

    I've been experimenting with input boxes but it's difficult to achieve what I want.

    Has anyone tried to do something similar? Any tips on how to create something like that? It's probably not that difficult to implement this functionality, but if someone already came up with a solution for this I don't want to reinvent the wheel

  2. #2
    ClanLib Developer
    Join Date
    May 2007


    The Dicewar example contains one (bottom left corner input box in ).

    I don't know the Dicewar source code, so I don't know how it works.

  3. #3


    I actually played with that example before. I've created something that kinda works, but I had to overcome a few issues:
    • I use arrow keys to control the player's movement - these get captured by the component; hence I have to handle activation and deactivation of the chat window when necessary. Because of this the user cannot scroll when the chat is deactivated.
    • The example is using a list view which is kinda more than I need (I don't need column headers, item selection etc., scrolling is handy though)
    • I've also recently encountered a problem with some graphic cards that don't display the GUI

    So I was hoping that someone came up with a 'cleaner' solution which feels less of a 'hack'. Many thanks for that example though!

  4. #4
    ClanLib Developer
    Join Date
    May 2007


    I would avoid using clanGUI in your situation, and create it yourself.

    1) Draw a black filled rectangle with a white rectangle outline
    2) Use CL_Font to draw the current input buffer to it
    3) Fill the input buffer when responding to keyboard input events
    4) When enter/return is pressed, send it to the network, and copy it to a similar "message display" window.

    Many ways to do this

    Also, I think clanGUI can do this, although I am not familiar enough with it. I believe you somehow can flag the component to receive input events, even when not in focus. I'm not sure

  5. #5


    Thanks, that's exactly what I'm planning to do I'll share my code if I come up with something neat.

Similar Threads

  1. Replies: 1
    Last Post: 01-21-2011, 10:40 AM
  2. GUI Component Constant Repaint
    By rombust in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 10-14-2010, 07:29 AM
  3. Chat Box Auto Scroll
    By lordhogfred in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 03-31-2010, 09:25 AM
  4. New example in ClanLib 2.0: Custom GUI Component
    By sphair in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 05-19-2009, 02:08 PM
  5. Clearing the console
    By Caesar in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 07-18-2007, 02:05 PM



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts