FAQ

From Guichan

Jump to: navigation, search

Contents

Q: Sometimes you write Guichan as Gui-chan. Are you dyslectic?

A: Guichan is the name of the library. We used to have a mascot called Gui-chan, but we don't anymore.

Q: Does Guichan have a dirty rectangles system?

A: No Guichan does not.

Q: Where can I find fonts for your ImageFont class?

A: Check out this font collection and the Open Font Library.

Q: How do I add a font of my own to the ImageFont collection?

A: Just mail one (preferable both) of the developers the font or post it in the forum.

Q: My custom widget doesn't receive key input?

A: Go through this check list:

  • Make sure your widget is focusable, setFocusable(true).
  • If you made your widget from scratch, make sure it inherits from KeyListener and that it adds itself to the KeyListener, addKeyListener(this).
  • Make sure you have spelled the overloaded KeyListener functions right and that they take the right arguments.

Q: My custom widget doesn't seem to receive mouse input?

A: Go through this check list:

  • If you made your widget from scratch, make sure it inherits from MouseListener and that it adds itself to the MouseListener, addMouseListener(this).
  • Make sure you have spelled the overloaded MouseListener functions right and that they take the right arguments.

Q: I don't receive any actions from my widget?

A: Go through this check list:

  • Make sure you have added the widget to the ActionListener.
  • Make sure you have spelled the eventID right, a very common and very annoying error.

Q: I can't get keyboard input to work with SDL?

A: You must call SDL_EnableUNICODE(1); in your initialization code.

Q: When I use Guichan I get a compile error in key.hpp?

A: This problem only occurs on windows when you have the windows.h header included somewhere in your project (OpenGLGraphics for instance includes windows.h) and is due to a define, DELETE, in the header. A simple work around, if you are not going to use the windows API, is to undefine DELETE after the inclusion of windows.hpp.

Q: Why do my simple GUI application take 100% of CPU power?

A: This is probably because your application loop runs at a maximum speed (including polling of events, running the GUI logic and drawing the GUI). To lower your CPU usage, you may want to run Gui::logic and Gui::draw only when an event occurs (such as when a mouse or key input is received or when the screen needs to be redrawn or whenever the GUI needs to be refreshed).

When it e.i. comes to SDL, SDL users often use "while(SDL_PollEvent(&ev))" which works, but takes a lot of the CPU power. If your application doesn't need to produce animations or other real time stuff, consider using SDL_WaitEvent (you may want to try fastevents[1]) or posting "time out" events from other threads.

Personal tools
community