Jump to content
  • Advertisement

PlayswithSquirrels

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

102 Neutral

About PlayswithSquirrels

  • Rank
    Newbie
  1. PlayswithSquirrels

    Allegro problems with tiles

    Thanks!!! You were a big help!
  2. PlayswithSquirrels

    Allegro problems with tiles

    I'm relatively new at programming and am I'm making a 16-puzzle on allegro, and got a little stuck as to the tiles. I got as far as creating the structure, but as for the fitting the matrix in the loop I'm stumped. My goal is to break the image into 16 separate squares, with 1bit of distance between each, so I can see each of them defined. This is what I have so far. #include <allegro.h> void init(); void deinit(); typedef struct{ BITMAP *piece; //this would be a piece of the picture (1 of the 16 squares) int position; }Block; int main() { init(); BITMAP *buffer; BITMAP *my_pic; PALETTE palette; clear_to_color(screen, makecol(255, 255, 255)); buffer = create_bitmap(404,404); my_pic = load_bitmap("chihuahua2.bmp", palette); if(my_pic==NULL) { set_gfx_mode(GFX_TEXT, 0,0,0,0); allegro_message("Can't load chihuahua.bmp"); return 1; } while (!key[KEY_ESC]) { blit(my_pic, screen, 0,0,106,48,404,404); show_mouse(my_pic); int i, t; for (i = 0; i <= 640; i++) for(t = 0; t <= 480; t++) //stuck on this area, don't know where to go from here blit(my_pic, buffer, 0, 0, i, t, SCREEN_W, SCREEN_H); } destroy_bitmap(my_pic); deinit(); return 0; } END_OF_MAIN() void init() { int depth, res; allegro_init(); depth = desktop_color_depth(); if (depth == 0) depth = 32; set_color_depth(depth); res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); if (res != 0) { allegro_message(allegro_error); exit(-1); } install_timer(); install_keyboard(); install_mouse(); } void deinit() { clear_keybuf(); } Any and all feedback is welcome.
  3. PlayswithSquirrels

    Allegro bitmap problems

    Thanks for the tip, the image now shows up. But now it keeps flickering. When I take out clear(screen) the image still shows up and doesn't flicker. Do you think the clear(screen) would make too much of a difference if I just don't use it?
  4. PlayswithSquirrels

    Allegro bitmap problems

    Please don't tell me to google and to read the manual. I have, and am still doing so. Nonetheless, I'm stuck.
  5. PlayswithSquirrels

    Allegro bitmap problems

    New at programming. Trying to create a 16-puzzle on allegro. I'm still at the stage of trying to make an image show up on the screen, but when I compile, the screen goes black and no image is shown. No error messages or warnings pop up.   #include <allegro.h> void init(); void deinit(); int main() { init(); BITMAP *my_pic; PALETTE palette; my_pic = load_bitmap("chihuahua.bmp", palette); if(my_pic==NULL) { set_gfx_mode(GFX_TEXT, 0,0,0,0); allegro_message("Can't load chihuahua.bmp"); return 1; } while (!key[KEY_ESC]) { blit(my_pic, screen, 0,0,0,0,50,50); blit(my_pic, screen, 50,50,100,100,150,150); clear(my_pic); } destroy_bitmap(my_pic); deinit(); return 0; } END_OF_MAIN() void init() { int depth, res; allegro_init(); depth = desktop_color_depth(); if (depth == 0) depth = 32; set_color_depth(depth); res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); if (res != 0) { allegro_message(allegro_error); exit(-1); } install_timer(); install_keyboard(); install_mouse(); } void deinit() { clear_keybuf(); }   I'm really frustrated, I've been at this for 3 days, to no avail. I'm on a time crunch, I still have alot to do with the code, and can't do any of it if the bitmap refuses to open. Any and all help is welcome.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!