|
Why is this throwing an error??? |
Dizzy Egg
Member #10,824
March 2009
|
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] 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!!
---------------------------------------------------- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
-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"} My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
DanielH
Member #934
January 2001
|
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. ---- The assignment: I gave them a few to chose from or they could find their own. He picked one of mine. Here is the original: 1#include <iostream>
2
3float convertToCelsius(float fTemp)
4{
5 return (fTemp - 32.0f) / 1.8f;
6}
7
8//feet to inches
9//miles to feet
10
11int main()
12{
13 float fTemp = 0.0f;
14 std::cout << "Enter a temperature in Farenheit (F)" << std::endl;
15 std::cin >> fTemp;
16
17 std::cout << std::endl
18 << fTemp
19 << " deg F = " << convertToCelsius(fTemp) << " deg C"
20 << std::endl << std::endl;
21
22 return 0;
23}
This is what he submitted: 1#include <iostream>
2
3float convertToFahrenheit(float fTemp)
4{
5 return (fTemp - 32.0f) / 1.8f;
6}
7int main()
8{
9 float fTemp = 0.0f;
10 std::cout << "Enter a temperature in Celsius (C)" << std::endl;
11 std::cin >> fTemp;
12
13 std::cout << std::endl
14 << fTemp
15 << " deg C = " << convertToFahrenheit(fTemp) << " deg F"
16 << std::endl << std::endl;
17
18 return 0;
19}
Anyone see what he did? He did follow the directions. Technically. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
You didn't say they couldn't add a bug. Besides, it's a feature to exercise with unit tests.
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Dizzy Egg
Member #10,824
March 2009
|
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.
---------------------------------------------------- |
|