|
mac: allegro program does nothing |
cutopia
Member #16,635
February 2017
|
I copied and pasted the following tutorial code and was able to compile it without any warnings/errors. I would expect this to make the screen red... but it's black. Please help. I feel very sad being stumped so badly before I've even begun. #include <stdio.h> int main(int argc, char **argv){ if (!al_init()) { display = al_create_display(640, 480); al_clear_to_color(al_map_rgb(255,0,0)); al_rest(10.0); al_destroy_display(display); return 0; |
DragonDePlatino
Member #16,608
December 2016
|
Hmm...Your example is working for me. Maybe allegro isn't recognizing the window as the target bitmap? Try adding al_set_target_backbuffer(display) before al_clear_to_color(al_map_rgb(255,0,0)). If that doesn't work, try tweaking some display options/flags before creating your display. You can bitwise-and together these flags before creating a display or set some of these options where each one is its own line of code. If none of these solutions work you'll have to wait for one of the devs to respond. |
cutopia
Member #16,635
February 2017
|
Hmm I tried your suggestions and still no luck. Maybe I'm doing something fundamentally wrong at an even earlier stage. I'm building with gcc... and running the a.out from the command line. Is there anything inherently wrong with that? Here is the compile command I'm using: gcc allegromain.c -I /usr/local/include -lallegro -lallegro_main -L /usr/local/lib -lallegro_image -lallegro_primitives some of those libs probably aren't needed... they were from other tutorials I was attempting before I realized that they were all silently failing to work as intended. |
DragonDePlatino
Member #16,608
December 2016
|
I wouldn't recommend you compile via commands. It's already immensely difficult to link everything with a nice IDE so I can't imagine how hard it is with console. Maybe you could try the old Mac version of Code::Blocks? There's a nice tutorial on how to set up everything in that. |
Felix-The-Ghost
Member #9,729
April 2008
|
SiegeLord
Member #7,827
October 2006
|
I'm curious that you say it does a mode switch, since the code you pasted should create a window. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
cutopia
Member #16,635
February 2017
|
So here's the code again with the modifications based on the first suggestions. #include <stdio.h> int main(int argc, char **argv){ if (!al_init()) { al_rest(10.0); al_destroy_display(display); return 0; |
Elias
Member #358
May 2000
|
How did you install Allegro? I just did this at work (on an OSX 10.12.2 with nothing installed on it): brew install --HEAD allegro cat > a.c (paste code from your post above) gcc a.c -L/usr/local/lib -lallegro -lallegro_main ./a.out It shows a tiny red window, both on the retina screen and an old external monitor. Btw., thanks to whoever made it so extremely easy (less than 5 seconds!) to install Allegro in OSX nowadays - I remember times when it was much harder -- |
cutopia
Member #16,635
February 2017
|
That list of steps allowed me to solve the issue... I can't believe it was that lame of a problem. |
|