www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/26/16:51:35

From: "Lasse Hassing" <lazer_hassing AT yahoo DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Error blitting to bitmap
Date: Tue, 26 Oct 1999 21:32:30 +0200
Organization: Customer of Tele Danmark Internet
Lines: 95
Message-ID: <7v4vor$fev$1@news.inet.tele.dk>
NNTP-Posting-Host: ip106.hjnxr1.ras.tele.dk
X-Trace: news.inet.tele.dk 940966491 15839 195.249.117.106 (26 Oct 1999 19:34:51 GMT)
X-Complaints-To: Department of Abuse <abuse AT news DOT inet DOT tele DOT dk>
NNTP-Posting-Date: 26 Oct 1999 19:34:51 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm having problem blitting to a mem. bitmap
Please help

Source:
// --------------------------------------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <allegro.h>

BITMAP *FlukkiB;
PALETTE MyPal;
RLE_SPRITE *Flukki;
int Fx;
int Fy;

  file://BackBuffer
  BITMAP *back_buffer;


void DoBlit(void);
void BlitTimer(void);

int main() {
  FlukkiB = load_pcx("flukki.pcx", MyPal);

  generate_optimized_palette(FlukkiB, MyPal, NULL);

  MyPal[0].r = 0;
  MyPal[0].g = 0;
  MyPal[0].b = 0;


  // init Allegro!!
  allegro_init();

  // Setup keyboard
  install_keyboard ();
  // Install Timer
  install_timer ();
  // Set GFX driver
  set_gfx_mode(GFX_AUTODETECT, 320, 240, 320, 240);
  // Set color depth
  set_color_depth(32);
  // Set Sound (NOT USED YET!)
  // install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT,0);

  // Set active palete
  set_pallete(MyPal);

  // Create 'Flukki'
  Flukki = get_rle_sprite(FlukkiB);

  back_buffer = create_bitmap(320, 240);
  clear(back_buffer);

  Fx = 10;
  Fy = 190;

  install_int(BlitTimer, 1000);
  for(;;)
  {
    if (key[KEY_ESC])
    break;   }

  destroy_bitmap(back_buffer);

  return 0;
}

void DoBlit(void)
{
  draw_rle_sprite(back_buffer, Flukki, Fx, Fy);
}

void BlitTimer(void)
{
  DoBlit();
}
END_OF_FUNCTION(BlitTimer);
// --------------------------------------------------------


If I replace :
  draw_rle_sprite(back_buffer, Flukki, Fx, Fy);
With:
  draw_rle_sprite(screen, Flukki, Fx, Fy);
It work fine.

Why?


---Lasse Hassing



- Raw text -


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