Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Allegro 4.9.8

This thread is locked; no one can reply to it. rss feed Print
Allegro 4.9.8
Trezker
Member #1,739
December 2001
avatar

Your patch works actually. I'm not getting any jerking.

Elias
Member #358
May 2000

Ah, very nice. Committed it to SVN, thanks a lot.

--
"Either help out or stop whining" - Evert

Don Freeman
Member #5,110
October 2004
avatar

I get random crashes when using:

ALLEGRO_MOUSE_STATE msestate;
al_get_mouse_state(&msestate);

The program dies, and then I debug and it breaks on al_get_mouse_state, saying that msestate is invalid. I've looked at the examples and I am just doing the same thing as they are. I don't get it.??? It doesn't happen every time, and that is what is frustrating. I think that something in the mouse code is screwy...but I'm not sure. I am using Windows Server 2008 (Vista) if that helps anyone. I can run it a few times before I get the crash...sometimes it just crashes right away. Actually, the ex_mouse example does the same thing. Maybe there is something wrong with the mouse driver code on windows?!:o

I've attached the full project (code, data, and a Windows executable). This is just a learning exercise for the new API before I use it to work on my WarLand project.8-)

Edit: (This is under the 4.9.8 API)

Edit 2: I think I've fixed the issue. Here is the other post. Maybe someone could fix this in the source somewhere?!:D
Spoke to soon.:'(

--
"Everyone tells me I should forget about you, you don’t deserve me. They’re right, you don’t deserve me, but I deserve you."
"It’s so simple to be wise. Just think of something stupid to say and then don’t say it."

Trent Gamblin
Member #261
April 2000
avatar

I'm experiencing problems with the mouse (seemingly) in ex_expose. It is failing assertions that mouse_directx_installed != 0, even though the mouse has been installed. Kind of seems like a memory bug.

Don Freeman
Member #5,110
October 2004
avatar

With the changes made by Milan Mimica here, my mouse problems (that I've noticed anyway) are gone...that AND it fixes the issue where windows didn't get the focus unless their title bars where clicked.:D

--
"Everyone tells me I should forget about you, you don’t deserve me. They’re right, you don’t deserve me, but I deserve you."
"It’s so simple to be wise. Just think of something stupid to say and then don’t say it."

Milan Mimica
Member #3,877
September 2003
avatar

Quote:

AND it fixes the issue where windows didn't get the focus unless their title bars where clicked.

Nah, Trent fixed that.

Trezker
Member #1,739
December 2001
avatar

set_mouse_xy is borked.
I just did a new fresh checkout from svn and the big jumpy behaviour was back.

I attach a diff of ex_warp_mouse.
When I hold the right mouse button and move around at moderate speeds the pointer jumps away hundreds of pixels.

EDIT:
I added a check that compares the next event from x with the event that should come.
X does send a motion event right after the warp. But it doesn't match.

EDIT2:
However, when I warp on click I do get an event right away with correct values.
Also, the warp on move is correct sometimes. But when it's wrong I can't figure out where those values could come from.

Elias
Member #358
May 2000

Well, it makes sense - we were using XWarpPointer in relative mode. Assume the mouse is at x=200 and you want to move it to x=100 on each movement event. Now the user twice moves it to the right for one pixel. The event queue will contain the two events:

mouse event(x=201,dx=1), mouse event(x=202,dx=1)

In response to those two events, ex_warp_mouse sends these commands to the X11 server:

XWarpPointer(-101), XWarpPointer(-102)

So because the user moved the mouse two pixel to the right, we asked X11 to move the pointer 203 pixel to the left. Of course instead of getting to x=100 as intended, we were overshooting that and moved out of the window :P

The attached patch fixes it here.

--
"Either help out or stop whining" - Evert

Trezker
Member #1,739
December 2001
avatar

Yeah, it's working.

Elias
Member #358
May 2000

Quote:

Yeah, it's working.

Actually, depending on what you want to use this for, it's still not perfect. If you look at the mouse positions relative to (width/2, height/2), they won't always correspond to the user movement of the mouse. If you do something like make a game with infinite mouse movement but call al_set_mouse_xy(width/2, height/2), it will again have jerky movement. I proposed a solution for it on the mailing list.

--
"Either help out or stop whining" - Evert

Trezker
Member #1,739
December 2001
avatar

Heh, so now we're discussing this in two places :-X

I think the public could voice their opinion in the matter.

The current solution in the mailing list is a special event when the mouse is set with a warp. So you get ALLEGRO_EVENT_MOUSE_AXES and ALLEGRO_EVENT_MOUSE_WARPED.

I don't think I like this. I'd rather see the ALLEGRO_EVENT_MOUSE_AXES event have a flag event.mouse.warped you can check.

Evert
Member #794
November 2000
avatar

Quote:

Heh, so now we're discussing this in two places

Yes, so don't cross-post.

Anyway, I'll just quote the reply I sent in the mailing list:

Quote:

> I think that when you use the function you should get a mouse axes
> event just like you had moved the mouse there.

Why?
What's the advantage of that?

> In my program I just ignore that event by checking if the event I got
> is pointing to the coordinates I set.

You can do that too by just ignoring the ALLEGRO_EVENT_MOUSE_WARPED event. No special code or checks needed in your code.
Think of it this way: you're adding extra code to work around a problem in the library. The better solution is to fix the library (especially now that we can).

> People may want to use that mouse axes event, I think it's unnecesary
> to do anything special.

You don't have to do anything special. Just respond to ALLEGRO_EVENT_MOUSE_WARPED in the same way as you would respond to an AXES event, as in the example snippet I posted.

> Possibly you may add a flag in the event.

As I said, hacky.
;)

There is no functional difference to checking a flag, except that the code is cleaner because we don't need to hack in a flag to indicate special behavior. Another way to think of this is that an event that needs a flag to indicate that it's different from other events of the same name should be a different event.

Trezker
Member #1,739
December 2001
avatar

I wasn't the one moving this discussion over to the mailing list. You guys are the ones cross posting. ;)

So, different event it is.

Michael Faerber
Member #4,800
July 2004
avatar

Does the demo in SVN work for anybody currently? At least here it seems that it is failing due to sound problems:

The almighty terminal said:

michi@michi-desktop:~/4.9/build/demo$ ./demo
Using ALSA driver
Keyboard driver installed.
Assert failed at line 320 of /home/michi/4.9/addons/kcm_audio/kcm_voice.c
Aborted

I boiled the problem down to line 144 in Misc.cpp: It seems that calling

voice = al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, ALLEGRO_CHANNEL_CONF_2);

fails, because voice is NULL afterwards.
Is this a known problem, or just a configuration mistake of mine?

--
"The basic of informatics is Microsoft Office." - An informatics teacher in our school
"Do you know Linux?" "Linux? Isn't that something for visually impaired people?"

Matthew Leverton
Supreme Loser
January 1999
avatar

What is al_install_audio(ALLEGRO_AUDIO_DRIVER_AUTODETECT) returning?

SiegeLord
Member #7,827
October 2006
avatar

You need to force a different sound driver via allegro.cfg (see this file in the 4.9 root folder for the options and format). The 'autodetection' of audio driver is at fault here, I think. It crashes similarly to me, but as soon as I force it to something other than the default (I don't remember the details) it works fine.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Don Freeman
Member #5,110
October 2004
avatar

Quote:

void al_calculate_arc(ALLEGRO_VBUFFER* vbuff, float cx, float cy,
float rx, float ry, float start_theta, float delta_theta, float thickness,
int start, int num_points)

How do you calculate how many points you will need for al_calculate_arc?

Edit:
I was started to find there is not flood fill?!:o That has GOT to be one of the most basic pieces of a solid primitives addon. I use a lot of the low level drawing stuff to make my own GUI and other graphics. I'm sure I could get away with using al_draw_prim, but a flood fill would be SO much easier...at least for the lazy ones like me.::)

--
"Everyone tells me I should forget about you, you don’t deserve me. They’re right, you don’t deserve me, but I deserve you."
"It’s so simple to be wise. Just think of something stupid to say and then don’t say it."

SiegeLord
Member #7,827
October 2006
avatar

Look at high_primitives.c, it shows how to estimate the number of points in an arc/circle etc.

Flood fill is a tough one... there is no way that it can be made fast... the hardware 'accelerated' version of it would be unbearably slow. Honestly, I'd say it'd better be placed in an 'image editing' addon which can have that and blur and whatnot in it. Any people have other opinions?

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Michael Faerber
Member #4,800
July 2004
avatar

Hi!

Matthew, al_install_sound() returns 0 - both for ALSA and OSS.
SiegeLord, thanks for your advice - changing the sound driver to OSS worked. However, seeing that the ALSA driver fails is a bit disturbing.

By the way, great demo! Who made it?

--
"The basic of informatics is Microsoft Office." - An informatics teacher in our school
"Do you know Linux?" "Linux? Isn't that something for visually impaired people?"

Trent Gamblin
Member #261
April 2000
avatar

Quote:

By the way, great demo! Who made it?

That would be me. The space ship (I think) was drawn by Micah Crow (who is awol) and the music I got from some royalty free music site.

Elias
Member #358
May 2000

It would be nice if he could draw asteroids in the same style as well. They look kinda flat, and the ship has this nice 3d effect.

--
"Either help out or stop whining" - Evert

Trent Gamblin
Member #261
April 2000
avatar

Maybe someone else could do it.

Dustin Dettmer
Member #3,935
October 2003
avatar

Trent: You make Allegro sound like a military camp...

Trent Gamblin
Member #261
April 2000
avatar

That was... random.

Elias
Member #358
May 2000

Quote:

Trent: You make Allegro sound like a military camp...

It's what it is...

--
"Either help out or stop whining" - Evert



Go to: