Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6741039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:40:40+00:00 2026-05-26T11:40:40+00:00

So I’m learning about sprite programming and we’re using allegro. When I run one

  • 0

So I’m learning about sprite programming and we’re using allegro. When I run one of the sample programs I get the message: rotatesprite.exe has triggered a breakpoint. This was in visual studio. I can’t get allegro to work outside of visual studio

sample program:

 #include <allegro.h>

 #define WHITE makecol(255,255,255)

int main(void)
{
int x, y;
float angle = 0;
BITMAP *tank;

//initialize program
allegro_init();
install_keyboard();
set_color_depth(32);
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
textout_ex(screen,font,"Rotate: LEFT / RIGHT arrow keys",
    0,0,WHITE,0);

//load tank sprite
tank = load_bitmap("C:\Users\Jason\Desktop\module7\tank.bmp", NULL);

//calculate center of screen
//x = SCREEN_W/2 - tank->w/2;
//y = SCREEN_H/2 - tank->h/2;
x=SCREEN_W/2;
y=SCREEN_H/2;

//draw tank at starting location
rotate_sprite(screen, tank, x, y, 0);

//main loop
while(!key[KEY_ESC])
{
    //wait for keypress
    if (keypressed())
    {
        //left arrow rotates left
        if (key[KEY_LEFT])
        {
            angle -= 0.1;
            if (angle < 0) angle = 256;
            rotate_sprite(screen, tank, x, y, itofix(angle));
        }

        //right arrow rotates right
        if (key[KEY_RIGHT])
        {
            angle += 0.1;
            if (angle > 256) angle = 0;
            rotate_sprite(screen, tank, x, y, itofix(angle));
        }

        //display angle
        textprintf_ex(screen, font, 0, 10, WHITE, 0,
            "Angle = %f", angle);
    }
}
allegro_exit();
return 0;
}
END_OF_MAIN()

the program triggering the breakpoint is: crt0msg.c off of the disk.
snippet of code:

         #ifdef _DEBUG
        /*
         * Report error.
         *
         * If _CRT_ERROR has _CRTDBG_REPORT_WNDW on, and user chooses
         * "Retry", call the debugger.
         *
         * Otherwise, continue execution.
         *
         */

         if (rterrnum!=_RT_CRNL&&rterrnum!=_RT_BANNER&&rterrnum!=_RT_CRT_NOTINIT)
        {
            if (1 == _CrtDbgReport(_CRT_ERROR, NULL, 0, NULL,rterrs[tblindx].rterrtxt))
                _CrtDbgBreak();
        }
        #endif  /* _DEBUG */
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:40:41+00:00Added an answer on May 26, 2026 at 11:40 am

    tank = load_bitmap(“C:\Users\Jason\Desktop\module7\tank.bmp”, NULL);

    Your compiler should be warning you about that string since it contains invalid escaped characters. You should use double back slashes or single forward slashes:

    tank = load_bitmap("C:\\Users\\Jason\\Desktop\\module7\\tank.bmp", NULL);
    // or
    tank = load_bitmap("C:/Users/Jason/Desktop/module7/tank.bmp", NULL);
    

    The latter format is recommended because it is cross platform. (Minus the whole bit about hard coding an absolute path.)

    Finally, you really need to check return codes:

    if (!tank) {
      // gracefully report error and exit      
    }
    

    Otherwise the program will crash somewhere else and it will be harder to debug.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.