delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/24/22:00:28

From: "23yrold3yrold" <cbarry AT pangea DOT ca>
Newsgroups: comp.os.msdos.djgpp
References: <39553338_2 AT spamkiller DOT newsfeeds DOT com> <MPG DOT 13bf615f916589c498bc4e AT news DOT freeserve DOT net>
Subject: Re: "load_bitmap" newbie...
Date: Sat, 24 Jun 2000 20:50:04 -0500
Lines: 61
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
NNTP-Posting-Host: 64.4.88.167
Message-ID: <395566df_1@spamkiller.newsfeeds.com>
X-Trace: 24 Jun 2000 20:56:47 -0500, 64.4.88.167
X-Comments: This message was posted through Newsfeeds.com
X-Comments2: IMPORTANT: Newsfeeds.com does not condone, nor support, spam or any illegal or copyrighted postings.
X-Comments3: IMPORTANT: Under NO circumstances will postings containing illegal or copyrighted material through this service be tolerated!!
X-Report: Please report illegal or inappropriate use to <abuse AT newsfeeds DOT com> You may also use our online abuse reporting from: http://www.newsfeeds.com/abuseform.htm
X-Abuse-Info: Please be sure to forward a copy of ALL headers, INCLUDING the body (DO NOT SEND ATTACHMENTS)
Organization: Newsfeeds.com http://www.newsfeeds.com 73,000+ UNCENSORED Newsgroups.
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Andrew R. Gillett" <arganoid AT fatal-design DOT com> wrote in message

> In comp.os.msdos.djgpp, 23yrold3yrold wrote:
> >  load_bitmap(pic,pal);
>
> This should be:
>
> pic = load_bitmap ("test.bmp", pal);

Appreciated, Andrew, that worked. Now it's found something new to go wrong;
as the tutorial explains it, this should display a sprite and allow the user
to move it around the screen. New to this that I am, I still can't see how
this doesn't work (the blitting at the very least); the program simply
displays nothing but clear the screen and end with the pressing of the Esc.
key. Small program it is, I've included it below. It compiles fine, it just
refuses to display anything. Thanx in advance for help.

#include <stdlib.h>
#include <stdio.h>

#include "allegro.h"

BITMAP *pic;
PALETTE pal;

int x,y;

main(void)
 {
 //////The initpart
 allegro_init();
 install_keyboard();
 set_color_depth(16);
 set_gfx_mode(GFX_AUTODETECT,640,480,0,0);
 pic = load_bitmap ("test.bmp", pal);

 do

  {
  clear(screen);
  blit(pic, screen,0,0,0,0,32,32); //

  int key = readkey();
  //////// Now handle the control
  if(key[KEY_LEFT])
   x--;
  if(key[KEY_RIGHT])
   x++;
  if(key[KEY_UP])
   y--;
  if(key[KEY_DOWN])
   y++;
  } while(!key[KEY_ESC]);

set_gfx_mode(GFX_TEXT,0,0,0,0);
 destroy_bitmap(pic);
 }




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019