I spent a while getting the formatting correct but when I paste it here it goes wrong and when I paste into Notepad it goes wrong.
Anyway, the code below doesn't work because al_is_event_queue_empty() always returns 0 so the drawing never happens.
This was working a few days ago. I added a bit of code and nw it's broken.
I'v got no clue as to why the queue is never empty.
Any ideas ?
Using Win7.
I added a bit of code and now it's broken.
While I read, I'll ask: what code?
I changed a line to
CurrentMenu->DrawMenu(close_menu, al_get_timer_count(OneRunObject.timer));
It was
CurrentMenu->DrawMenu();
Also I started using the monolith file but I switched back to seperate archives to see if the monolith was the cause but it turned out it wasn't.
You are sure it runs, except for the redraw? I.e. it closes immediately when you tell it too? If a lot of events stack up, it won't close immediately.
You changed the timing code? Maybe you forgot to register the timer event source.
BTW Is that a single-case switch-statement
"pf" pfff...
Also, if you need a text file and a bunch of bmp's, you could use a single argument to identify them both... F.i. "normal_theme" (it will look in the 'normal_theme' directory) or "./mythemes/user1" (it will look for all files in that directory). Much easier theming.
Don't call al_flip_display() if you aren't drawing. It takes a long time but your current code only handles one event per al_flip_display call which inevitably leads to the queue never being empty.
Also, about formatting, don't use any tabs (or alternatively, only tabs, but that's bound to go wrong in some places) then line up { and } with spaces and use a constant indentation. The way you have it right now makes it very hard to read.
"pf" pfff...
When you suffer from newb blues as badly as me, and you've typed printf() so many times, using function name macros like pf was one the things I've learned that been a relief.
Thanks both of you for the advice. I'm going to sort out that thing with the two strings. That'll make life a bit easier.
Also, thanks Elias. My program works lovely now.
Very grateful for the guidance.
/off to kettle for tea
I see only 1 al_flip_display, and it only gets called when want_redraw == true
it's the dreadful indentation that makes it look like that
Also, about formatting, don't use any tabs (or alternatively, only tabs, but that's bound to go wrong in some places) then line up { and } with spaces and use a constant indentation. The way you have it right now makes it very hard to read.
^ This.
Also, about formatting, don't use any tabs (or alternatively, only tabs, but that's bound to go wrong in some places) then line up { and } with spaces and use a constant indentation. The way you have it right now makes it very hard to read.
FFS, do NOT indent with spaces. That's what tabs are for, and they're infinitely more flexible.
If you need to line things up (like code that bleeds onto another line), tab it in to the same level, then use spaces.
Never, never, ever mix spaces with tabs.
Pick one, and stick with it.
If you need to line things up (like code that bleeds onto another line), tab it in to the same level, then use spaces.
That is fine in theory, but in practice it's very difficult to maintain. It's easy for you, or somebody else on the team, to mix up the tabs or spaces accidentally. Being whitespace, you won't notice. Using spaces is just much easier, especially with a mediocre or better editor that can expand them automatically for you. There's never guess work. It just works.
There's absolutely no practical difference for me. I hit the tab key (or >>) to indent, the shift-tab combo (or <<) to un-indent, and there's no visible difference. As for the actual indentation step size, you can pretty easily write a program (or editor extension or whatever) to automatically convert between them if you care, but 4-spaces should be a happy medium for everybody.
As for the actual indentation step size, you can pretty easily write a program (or editor extension or whatever) to automatically convert between them if you care, but 4-spaces should be a happy medium for everybody.
Or you can, you know, just use tabs and configure your editor to have how many ever spaces you want.
I don't understand why people think spaces are for indentation, and then come up with all these crazy workarounds to make it sound so usable.
Don't knock it until you've tried it. It's clear that you haven't. At least, not with a useful editor (hint: Visual Studio's editor is not useful).