Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Help - Error - Assertion failed: rx >= 0...

This thread is locked; no one can reply to it. rss feed Print
Help - Error - Assertion failed: rx >= 0...
ryan lee
Member #15,143
May 2013

Can anyone help me with what this might mean.. the program works fine until I add a some code c++ using Allegro 5 I a debug error:

Debug error R6010 - Abort() has been called

Assertion failed: rx >= 0, file allegro-git\addons\primitives\high_primitives.c, line 944

this is the code that I'm inserting that seems to cause the problem. To save me inserting my full main file I have just snipped this code, obviously when i'm using it I'm putting the code in all the right places.

Complete newbie here and any help would be massively appreciated! Thanks

[code]
void InitFASTCAR(FASTCAR &fastcarr);
void DrawFASTCAR(FASTCAR &fastcarr);
void StartFASTCAR(FASTCAR &fastcarr);
void UpdateFASTCAR(FASTCAR &fastcarr);

FASTCAR fastcarr;

InitFASTCAR(fastcarr);

StartFASTCAR(fastcarr);
UpdateFASTCAR(fastcarr);

DrawFASTCAR(fastcarr);

void InitFASTCAR(FASTCAR &fastcarr)
{
fastcarr.ID = FC;
fastcarr.live = false;
fastcarr.speed = 8;
fastcarr.boundx = 35;
fastcarr.boundy = 25;
}
void DrawFASTCAR(FASTCAR &fastcarr)
{
al_draw_filled_rounded_rectangle(fastcarr.x, fastcarr.y, fastcarr.x +70, fastcarr.y +50, fastcarr.x - 4,fastcarr.y - 4,al_map_rgb(255,0,0));

al_draw_filled_rounded_rectangle(fastcarr.x, fastcarr.y, fastcarr.x +70, fastcarr.y +50, fastcarr.x - 4,fastcarr.y - 4,al_map_rgb(50,50,50));
}
void StartFASTCAR(FASTCAR &fastcarr)
{
if(!fastcarr.live)
{
if(rand() % 500 == 0)
{
fastcarr.live = true;
fastcarr.x = width;
fastcarr.y = 30 + rand() % (height - 60);
}
}
}

void UpdateFASTCAR(FASTCAR &fastcarr)
{

if(fastcarr.live)
{
fastcarr.x -= fastcarr.speed;

if(fastcarr.x < 0)
fastcarr.live = false;


}

}
[/code]

Jeff Bernard
Member #6,698
December 2005
avatar

al_draw_filled_rounded_rectangle parameter rx and ry must be greater than zero.

// Are you sure you want variable radii here?
al_draw_filled_rounded_rectangle(fastcarr.x, fastcarr.y, fastcarr.x +70, fastcarr.y +50, fastcarr.x - 4,fastcarr.y - 4,al_map_rgb(255,0,0));

--
I thought I was wrong once, but I was mistaken.

ryan lee
Member #15,143
May 2013

Aha! Your a legend thank you so much! I've just changed it to a normal rectangle as I can't really figure out the rounded thing for now!

Thanks again! ;D

Jeff Bernard
Member #6,698
December 2005
avatar

Imagine a rounded rectangle was a normal rectangle, but with 4 ovals instead of the corners. The parameters rx and ry are the horizontal and vertical radii of the ovals. So increasing those parameters would put larger ovals on the corners, so the corners would be more round.

--
I thought I was wrong once, but I was mistaken.

ryan lee
Member #15,143
May 2013

Ah I see, so I wouldn't need to use my 'object's' x and y position variables, just a single number?

Edgar Reynaldo
Member #8,592
May 2007
avatar

Go to: