AlxHnr / gui_engine

GUI library for SDL 1.2 (October 2012)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Button only works at fixed position in example.c

bkauler opened this issue · comments

I know this is a dead project, but I have a question that you might immediately know the answer to.

It is great so far, I have successfully converted all text to TTF.

But just now have discovered something really odd. This line in example.c:

g_widget *button = g_attach_button(window, 0, 60, "set title");

If I change the x,y coordinates to anything other than 0,60 mouse clicks no longer register on the button. For example, 0,200.

I have looked through gui_engine.c but cannot see where these coords are hard-coded, but obviously they are. Does this ring any bells with you, the button hard-coded to only work at those coords?

That's interesting. I found that the button works if placed anywhere within a region in top-left corner of the window. This is about the limit:

g_widget *button = g_attach_button(window, 150, 80, "set title");

Any further down, or to the right, and the button no longer responds to mouse clicks.

I never had such an issue before. Maybe the offsets break when using a different font size, but I can't tell you where to look. Another reason could be that an invisible gui widget is hiding the button and stealing all the inputs because its above the button. I won't help you with debugging this, but can give you some hints:

  • Does this happen without your ttf modifications?
  • Does this happen on desktop? (This way you can figure out if it the framebuffer/mouse interaction is broken)

Here are two demo applications which make use of my gui engine:

That's interesting. I found that the button works if placed anywhere within a region in top-left corner of the window. This is about the limit:

g_widget *button = g_attach_button(window, 150, 80, "set title");

Any further down, or to the right, and the button no longer responds to mouse clicks.

maybe youve hit a row,column setting, what is the default terminal set as?, you may need to set it as something else.

After a bit more tracking, some indicate to use stty to both read the existing one with 'stty -a', as well as to set it to what you want by involking 'stty columns XX rows xx'; while others say to use setupcon, which lets you choose a graphical font size to be displayed on the frame buffer console. The font size, combined with the resolution of the monitor, determines how many rows and columns you can see. There are also xterm escape codes as well as the resize command.