Ok, totally stumped here. Why is this code fine:
ALLEGRO_DISPLAY *display = al_create_display(1280, 720); al_clear_to_color(al_map_rgb(255, 255, 0)); al_flip_display();
But this is throwing an assertion error:
ALLEGRO_DISPLAY *display = al_create_display(1280, 720); al_set_target_bitmap(al_get_backbuffer(display)); //causing issues.... al_clear_to_color(al_map_rgb(255, 255, 0)); al_flip_display();
Given I've written games using this logic I can't work out why it's crashing, but it has been a loooong day...
[EDIT]
Loool, sometimes you need to step away from the code and ask a question!
I was declaring:
ALLEGRO_DISPLAY *display;
at the top of my code, but in my setup function was using:
ALLEGRO_DISPLAY *display = al_create_display(1280, 720);
Stand down!!
-Wshadow
{"name":"613203","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/8\/788c5d84a1aeb6bd3607407bebb760a2.png","w":301,"h":366,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/8\/788c5d84a1aeb6bd3607407bebb760a2"}
Reminds me of a class I was teaching.
This kid couldn't figure out why his program wasn't working. It was a zoom class so a little difficult. I had him pull up his project (in Visual Studios). We modified it a bit, but it didn't auto-compile when he ran it. That was the first thing I noticed was wrong. After about 5 minutes of messing around I realized the error. The cpp file we were messing with wasn't even apart of the solution he had open.
Sometimes you want to shake some people.
After that, we got it to run.
----
also about this kid
The assignment:
Choose a sample program. Modify the code or add a function or subroutine to it. Debug and demonstrate the modified program.
I gave them a few to chose from or they could find their own. He picked one of mine. Here is the original:
This is what he submitted:
Anyone see what he did? He did follow the directions. Technically.
You didn't say they couldn't add a bug. Besides, it's a feature to exercise with unit tests.
It's nuts; I write code all day for work, writing Java code which I test using Junit, I write C# code that I test with Moq, I write C code that gets tested on a proprietary debugger, and then when then I've done all that I try to test an OpenGL shader using Mingw and CodeBlocks and spend an hour straight not realising my stupid mistake.
I guess there's an argument there to improve my Allegro workflow, but therein lies a conundrum; I "LIKE" the old school way of Allegro, for me it's like taking a holiday after all the "proper" work....
That said, I might move from Mingw and CodeBlocks into the Visual Studio and Nuget world of A5.
It was a looong day, plus I've had a few jars (no pun intended) so I'll see what happens tomorrow.