The events in my program are starting to become slow. for example when you click over some text in a list a white box is draw around the selected text. and theres fifteen lines of text that can be selected so it has to check for all of that. but sometimes I have to click on the same spot multiple times for in to work and I'd like it to be instant. Do you think its just way that I'm doing it is slow?
]]>You need to make sure you aren't letting events pile up in the queue. The event loop template I used in the wiki's Allegro 5 tutorial keeps that from happening.
]]>ALLEGRO_EVENT ev; ALLEGRO_TIMEOUT timeout; al_init_timeout(&timeout, 0.06); bool get_event = al_wait_for_event_until(event_queue, &ev, &timeout);
You mean this?
]]>Thats part of it, your main loop needs to not always redraw every loop, or you need to drain the events (and properly handle them) before you get that far.
]]>One way a company I worked for handled things like this was to have commands and events. With events, everything gets notified. With commands, if the top object doesn't handle it, it passes it along to the next one. If the command gets all the way up the chain and no one "answers" it, the command is simply discarded by the object manager.
Say you have 3 windows on top of each other. If the top-most one is a modal dialogue box, you DON'T want the ones below it to receive the click event. So instead of an event, you pass up commands. The button will respond that it handled the command, and the command is flushed so nothing else sees it.
That may be one way you can handle this kind of construct with all of that text on top of each other...
]]>