Respond to this messageReturn to Index
Original Message
  • line endings
    • Anonymous (no login)
      Posted Jul 21, 2011 5:58 PM

      forgot about the line endings, here it is single spaced

      #include <allegro.h>

      int main(void)
      {
      if (allegro_init() != 0) return 1;

      install_keyboard();
      set_gfx_mode(GFX_SAFE, 320, 240, 0, 0);

      acquire_screen();
      set_color_depth(8);
      clear_to_color(screen, 0);
      BITMAP *m = create_bitmap(10,10);
      clear_to_color(m, 0);

      int dat[100]={
      10,14,14,14,14,14,14,14,10,10,
      14,10,10,10,10,10,10,10,14,10,
      10,10,00,00,10,10,10,00,00,14,
      10,10,10,00,10,10,10,00,10,10,
      10,10,10,10,10,10,10,10,10,10,
      10,10,10,10,10,10,10,10,10,10,
      10,10,10,10,10,10,10,10,10,10,
      10,00,00,00,00,00,00,00,00,10,
      10,10,10,10,10,10,10,10,10,10,
      10,10,10,10,10,10,10,10,10,10
      };
      int x,y,z=00;
      for(y=0;y<=9;y++){
      for(x=0;x<=9;x++){
      m->line[y][x]=dat[z];
      z++;
      }
      }

      /* similar to PUT in QB */
      blit(m, screen, 0,0,160,120,10,10);

      release_screen();

      readkey();

      return 0;
      }
      END_OF_MAIN()


      anyway, I always thought that the whole DATA thing for graphics was used to store the graphics with the program. I imagine people would prefer to use BLOAD/BSAVE to store the graphics and load them quickly. Similarly, you would use the built in BMP loader in allegro. I am sure you could load the BMP from file, directly to video memory without the extra array taking up space.
      like this perhaps:

      blit(load_bitmap("file.bmp",NULL),screen,0,0,0,0,150,150);

      but why would you want to do that?
    Your Name
    Your Email
    (Optional)
    Message Title
    Message Text
    Image Services Photobucket.com
    Options Enable formatted text (Huh?)
    Also send responses to my email address