www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/23/15:31:03

From: "Alexei A. Frounze" <alex DOT fru AT mtu-net DOT ru>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: palette newbie quest
Date: Tue, 23 May 2000 23:27:19 +0400
Organization: MTU-Intel ISP
Lines: 87
Message-ID: <392ADB97.CFF38F82@mtu-net.ru>
References: <xGzW4.5430$wYl DOT 222545408 AT newsb DOT telia DOT net>
NNTP-Posting-Host: ppp101-63.dialup.mtu-net.ru
Mime-Version: 1.0
X-Trace: gavrilo.mtu.ru 959110187 67849 212.188.101.63 (23 May 2000 19:29:47 GMT)
X-Complaints-To: usenet-abuse AT mtu DOT ru
NNTP-Posting-Date: 23 May 2000 19:29:47 GMT
X-Mailer: Mozilla 4.72 [en] (Win95; I)
X-Accept-Language: ru,en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

how about this one:

The example is taken almost entirely from Allegro Example #15.
IMO you must look through the examples and FAQ as well as post such
questions here.

----------8<------------
#include <stdlib.h>
#include <stdio.h>
#include "allegro.h"

BEGIN_GFX_DRIVER_LIST
  GFX_DRIVER_VGA
  GFX_DRIVER_VESA1
END_GFX_DRIVER_LIST

BEGIN_COLOR_DEPTH_LIST
  COLOR_DEPTH_8
END_COLOR_DEPTH_LIST

BEGIN_DIGI_DRIVER_LIST
END_DIGI_DRIVER_LIST

BEGIN_MIDI_DRIVER_LIST
END_MIDI_DRIVER_LIST

BEGIN_JOYSTICK_DRIVER_LIST
END_JOYSTICK_DRIVER_LIST

int main()
{
PALLETE pal;
BITMAP *bmp;

allegro_init();
install_keyboard();
set_gfx_mode(GFX_VGA, 320, 200, 0, 0);
bmp=load_bitmap("drop.bmp",pal);
if (bmp==NULL) {
  allegro_exit();
  printf("unable to load image.\n");
  return 0;
};
set_palette(pal);
blit (bmp,screen,0,0,(320-bmp->w)/2,(200-bmp->h)/2,bmp->w,bmp->h);
destroy_bitmap (bmp);
readkey();
allegro_exit();
return 0;
}
----------8<------------

Good Luck
Alexei A. Frounze
-----------------------------------------
Homepage: http://alexfru.chat.ru
Mirror:   http://members.xoom.com/alexfru

Fredrik Persson wrote:
> 
> Hi
> im just wondering how to go about loading and displaying a bitmap on the
> screen?
> 
> i`ve tried the foolowing but i have no idea how it should be and cant find
> it anywhere..
> 
> void start()
> {
> allegro_init();
> install_keyboard();
> set_gfx_mode(GFX_VGA, 320, 200, 0, 0);
> PALETTE p;
> //RGB *p;
> set_palette(p);
> screen=load_bitmap("drop.bmp",p);
> 
> readkey();
> allegro_exit();
> }
> 
> i would be very grateful for a quick respons!!!
> 
> Thanx
> /Fredrik


- Raw text -


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