![]() |
|
Allegro 4.9.8 |
Trent Gamblin
Member #261
April 2000
![]() |
You forgot to emit an event.
|
Trezker
Member #1,739
December 2001
![]() |
X takes care of that for me. Here's my test code. If I remove that if, it gets really jerky.
|
Thomas Fjellstrom
Member #476
June 2000
![]() |
A diff would be appreciated in the future, even when just posting here. It makes it a lot easier to tell whats been changed. if you have a regular svn checkout, svn can give you a valid diff. svn diff should be enough to give a diff of any changes. -- |
Trezker
Member #1,739
December 2001
![]() |
Alright, I've tinkered a bit more. I noticed some flaws. Anyway, this time I attach a diff. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
I think its jerking because you're injecting an event AND X is injecting an event. I really don't think thats the way to go about doing things. Are you sure you need to inject an event into allegro's queue? If all else fails, maybe theres a way to tell X to move the cursor without injecting its own event? That way you can and all should be well. -- |
Trezker
Member #1,739
December 2001
![]() |
Well, I think it jerked more when I didn't inject the event. It could also have something to do with my computer. It's jerking the mouse all the time, even when I'm not running allegro. Maybe I should reboot. |
Elias
Member #358
May 2000
|
Do you have an example which shows the jerking? A short example program demonstrating al_set_mouse_xy would be quite useful (and maybe would help find the cause of the problem)... [Edit:] Btw., I'm really amazed how well the "we accept patches" seems to work these days -- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Quote:
Btw., I'm really amazed how well the "we accept patches" seems to work these days It only works for certain kinds of people in a certain mood, with certain small problems Quote: It's jerking the mouse all the time, even when I'm not running allegro. Maybe I should reboot. I get that if flash, firefox, or konqueror are somehow flooding X with commands. Even if it looks like theres very little CPU use, sometimes it causes jerky mouse input and especially jerky window resizing and whatnot. Try closing some apps. -- |
Don Freeman
Member #5,110
October 2004
![]() |
Why do programs using the new API not get the focus unless their title bars are clicked (or of course brought into focus with alt-tab)?:o Is this an issue only under Windows? I have not tried under Linux yet. Another issue with the mouse...when changing the cursor, it does not take effect unless the cursor leaves the window and then returns.:o WTF? Is this a Windows only issue? Any workaround for that???? I've also noticed that pressing the caps lock key in the keyboard example crashes under the 4.9.9 version...don't know what has changed. Seems something with the keyboard code has changed, because other programs compiled with it crash when different keys are pressed.:-/ Some annoyances: the al_draw_arc and al_draw_ellipse (and others I imagine) piss me off to no end! They ask for position variables, but they do not start there, at least not drawing...I want to be able to use: al_draw_arc(10,10,0,3.14,c) and get an arc starting AT 10,10 (the drawing...not the center point). I am trying to use it for drawing rounded rectangles, but it is hard...because I have to account for the center point, the radius, etc. and sometimes they seem off by one pixel because of rounding errors.:-/ Any since we are on that subject, why not a rounded rect function? I am willing to add one if you would like.::) I am debating on how to handle the 'roundness' of the corners though. Any suggestions on that? I would ultimately like to have the function parameter such as: al_draw_rounded_rect(float sx, float sy, float w, float h, ALLEGRO_COLOR c, float roundness, int thickness = 0 );
-- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Quote: Any since we are on that subject, why not a rounded rect function? Check the primitives addon, if its not there, ask SiegeLord about it, its his baby. I actually have an arc function that draws unfilled arcs using Allegro or OpenGL that takes a starting and ending position, and fills in the gaps. At least I did, I may not have it anymore -- |
Evert
Member #794
November 2000
![]() |
Quote: Why do programs using the new API not get the focus unless their title bars are clicked (or of course brought into focus with alt-tab)?
We didn't think people would want their windows focussed, and if they did, they'd give them focus themselves. Quote: Is this an issue only under Windows? I have not tried under Linux yet. Probably, but this is the first I've heard of it. There was a problem with the OS X port that required a click in the window after it was resized before it would take keyboard input again, that's the only thing I've seen that comes close to what you describe (but that was due to a buggy implementation of window resizing and has been fixed). Quote: Another issue with the mouse...when changing the cursor, it does not take effect unless the cursor leaves the window and then returns.:o WTF? Is this a Windows only issue? Again, possibly. There's a quirk in Windows where the cursor doesn't update unless you move the mouse (which usually results in warping the mouse to its present location), but this doesn't sound like the same problem. Quote: Any workaround for that???? A fix would be better, I think. Quote: Any since we are on that subject, why not a rounded rect function? I am willing to add one if you would like.
Congratulations. You just volunteered to do it. Quote: I am debating on how to handle the 'roundness' of the corner Probably the length of the circle arc in radians: pi/2 for a quarter circle, 0 for a single pixel (a corner that isn't rounded). You'll need to calculate the centre and radius of the circle and the intersection point between the circle and the rectangle. |
SiegeLord
Member #7,827
October 2006
![]() |
Quote: Some annoyances: the al_draw_arc and al_draw_ellipse (and others I imagine) <censored> me off to no end! They ask for position variables, but they do not start there, at least not drawing...I want to be able to use: al_draw_arc(10,10,0,3.14,c) and get an arc starting AT 10,10 (the drawing...not the center point). I am trying to use it for drawing rounded rectangles, but it is hard...because I have to account for the center point, the radius, etc. So I change it, and then people start complaining that the position variables do not refer to the center of the arc. Either way you do it, it's going to annoy half of the people using that function. Quote: Any since we are on that subject, why not a rounded rect function? No harm in adding one, I guess. Although it takes like 6 lines to do it in the current API. EDIT: Well, a little bit more... heh. This motivates me to alter how the al_calculate_* functions work. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Don Freeman
Member #5,110
October 2004
![]() |
It's not in the 4.9.8/4.9.9 versions. I don't care to make it.:D Any suggestions on the roundness aspect? I think it should be somewhere between a normal rect and could degrade down to an ellipse.::) How do I make the allegro.def file needed to compile the 4.9.9 version as a dll? I can use dumpbin to get all of the mangled function names, but...have you ever tried to manually edit the output of that?!:o I started, but gave up after the first 1500 lines.:-/ I am just going to use 4.9.8 until that little issue gets straighten out.::) Edit: -- |
SiegeLord
Member #7,827
October 2006
![]() |
Roundness will be the radius of the circle bevel. This is how it's always done. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Don Freeman
Member #5,110
October 2004
![]() |
So basically, just attach four arcs to four lines...and voila, a rounded rect is born.8-) Of course, one would have to take the line thickness into account. -- |
SiegeLord
Member #7,827
October 2006
![]() |
Yeah, more or less. A little bit more work for the filled rounded rectangle, but the idea is the same. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Don Freeman
Member #5,110
October 2004
![]() |
I'll see what I can come up with then. I'll post it here later and someone could possibly add it to the primitives later if they so desire.8-) -- |
Trezker
Member #1,739
December 2001
![]() |
I made a minimal test program for al_set_mouse_xy and tested with and without sending my own event. With my event, I get the jump to the target coordinates, immediately followed by an event with dx = 0, dy = 0. This is probably because I do the_mouse.state.x = x; the_mouse.state.y = y; So the event from X doesn't change the position. Without my event, there's only the 0, 0 event. If I remove the_mouse.state.x = x; the_mouse.state.y = y; I get the correct event from X. But my "complex" program gets totally chaotic, the cursor jumps away from the center of the screen instead of to he center as it should.
Here's my small test program.
|
Don Freeman
Member #5,110
October 2004
![]() |
Ok, as promised. Here is the function I came up with (the al_draw_arc does NOT seem to take neg values correctly for the second angle like it says in the docs::)): You can simple skip the thickness value, as it will default to 0 (hairline). /////////////////////////////////////////////////////////////////////////////// // Prototype: void al_draw_rounded_rect( float x, float y, float w, float h, float roundness, ALLEGRO_COLOR c, int thickness = 0 ); ///////////////////////////////////////////////////////////////////////////////
-- |
SiegeLord
Member #7,827
October 2006
![]() |
Quote: (the al_draw_arc does NOT seem to take neg values correctly for the second angle like it says in the docs::))
Docs are for the SVN version where that bug was fixed "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Don Freeman
Member #5,110
October 2004
![]() |
Still have to work out a filled rounded rect...maybe using circles instead of arcs. That should work.8-) -- |
Peter Wang
Member #23
April 2000
|
Quote: On a closer inspection it appears to be making a feedback loop and it doesn't help to ignore events where the mouse position equals the set position. I didn't check your patch, but check how A4 does it. After warping we have to ignore some events. BTW, how are you accounting for multiple windows? Again, I didn't check the patch. I assume it's relative to the current display.
|
ImLeftFooted
Member #3,935
October 2003
![]() |
Whats the 3D api going to look like? It would be nice to have some cool 3D fluff in the 2D api. Like maybe a simple z setting during blit, or being able to tilt/wobble the screen. |
Peter Wang
Member #23
April 2000
|
OpenGL.
|
ImLeftFooted
Member #3,935
October 2003
![]() |
Some nice candy would be beneficial in primarily two ways: The games made would actually use them and it would be great for the PR of Allegro itself. |
|
|