Active rendering (full screen), and keyboard input.
Well, when doing the active rendering aproach where the game goes into a gameloop. It sort of like "hangs" the rest of the game.
I also use a net (networkhandler) that reads off the network and sends the data to the renderer.
I can't get any keyboard input etc.
How do i do that?
Heres some pseudo code on how i try to design it:
game:
start fs mode
start net thread reading from network
while game running
...render() (draws stuff on the screen)
net thread
run()
...line = readLine()
...render.receive(line)
Well somewhere i need to put in so the user
can use the keyboard... but how to i do it?
Also, i would like somekind of "command" line feature.
Where the user can put text through simple keyboard input.
Can i do this in some easy way? Or do i need to "draw" all
this on my own in the render thing?
[927 byte] By [
Hephos] at [2007-9-27 19:21:07]

There isn't a way of polling for keyboard input at the moment, you have to add a KeyListener, and take action when the KeyEvents are received (the keyPressed method is called by the EventHandler Thread)
as for cmd line input, I assume you mean a Quake style 'console'?
well.... this being java, you've got a lovly dos box, that you could use... but if your full screen, that might be a little 'inconvenient'.
you could just add a small Textbox/field component to your full screen window, into which you could enter whatever runtime commands you wanted.
Abuse at 2007-7-6 22:02:42 >

> you could just add a small Textbox/field component to
> your full screen window, into which you could enter
> whatever runtime commands you wanted.
..and you could implement your own UI for whichever one you choose so that it appears invisible except for the text typed... :-)
I don't think you can mix your active rendering code, with swing/awt rendering.
Try making your own textfeild component. Its one of the easier things to create, just be glad you don't need a tree!
Plus you can make components really cool looking, and its more professional.
Harley.
> I don't think you can mix your active rendering code,
> with swing/awt rendering.
> Try making your own textfeild component. Its one of
> the easier things to create, just be glad you don't
> need a tree!
> Plus you can make components really cool looking, and
> its more professional.
>
> Harley.
True, the standard swing components will look a bit gay when used in a fullscreen game, but you can use them. Check out the example code used in the Fullscreen Tutorial:
http://java.sun.com/docs/books/tutorial/extra/fullscreen/index.html
> Try making your own textfeild component. Its one of the easier things to
> create, just be glad you don't need a tree!
Hah! You've probably never tried creating a GUI toolkit before! It all *seems* easy until you have to support scrolling, insert, delete, highlighting, undo, redo and every other "little" thing textfields do. Before you know it, your code has ballooned out to 10 times the size of Mozilla and noone but you can trace all the complex interactions! For games it isn't so bad tho. :-)