AlxHnr / gui_engine

GUI library for SDL 1.2 (October 2012)
MIT License
4 stars 2 forks source link

Button only works at fixed position in example.c #4

Open bkauler opened 1 year ago

bkauler commented 1 year ago

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?

bkauler commented 1 year ago

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.

AlxHnr commented 1 year ago

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:

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

scsijon commented 1 year ago

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.

scsijon commented 1 year ago

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.