PDA

View Full Version : cl_textedit, menu, main loop (some problems i have) [2.3.4]



dnano91
12-21-2012, 07:51 PM
hi,
i'm new to clanlib and not that experienced in c++. although i worked with jframe from java.
so i'm trying to create a game (as a project for university) and i have a couple of problems regarding the clanlib.

1. how do i use cl_textedit? there are 2 players and i want to display their name in 2 textfields.
i adjust the value every second. i cant even initialize it, because i dont know, where to get (CL_GUIComponent *parent) from.
so a little help on how to use it would be nice.

btw: can i also use a w w for text input? i need a textfield so the user can enter the server ip and his username

2. is there a way to design a proper menu? right now i'm using enum/chars and
CL_Font_System font;
...
fond.draw_text()
for every single text on the screen.

3. i got different draw methods for game and menu. and in the mainloop i choose the right one using a char (g = game, m = menu)
at the beginning of run() i set selected='m' but the game starts immediately.
if in the main() i put a sleep(1sec) after all the setup stuff (setupCore, setupDisplay/GL/Network) and before creating the object containing run() with the main loop,
the menu is shown properly. do i have to wait for the setups to finish? if yes, how do i check if they're done?

4. is the method to swich screen contents as described in 3. bad coded and how can i do better?

rombust
12-22-2012, 07:40 PM
I haven't got time to answer in depth, but have a look at how "Examples/Game/Dicewar" is structured. It was created a couple of years ago by a ClanLib developer that has had lots of experience.

I am not familiar with its source code, but it might assist you.

dnano91
12-25-2012, 09:10 PM
i got some help in the irc so now question 1 and 3 are still open...