delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/20/13:15:12

From: Danny Devito <i_am_bill_gates AT zdnetmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Help ! Winallegro : Screen to screen blits
Date: Tue, 20 Jul 1999 12:46:10 -0400
Organization: ICAN.Net Customer
Lines: 57
Message-ID: <3794A7D2.92285C8F@zdnetmail.com>
NNTP-Posting-Host: dial133.portalnet.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi!
I'm trying to learn how to use Winallegro in order to port a DOS
(non-allegro) game I made long ago.

I've encountered some trouble when I try to blit something from
offscreen video RAM to on screen video RAM.  Using the same code,
bliting from onscreen video RAM to onscreen video RAM works fine.

Here's an example of code I tried (using MS VC++ 6.0/Winallegro 3.0):
#include<stdio.h>
#include<stdlib.h>
#include<allegro.h>

BITMAP *image;
PALETTE pal;

int main(void)
{
	//ini allegro
	allegro_init();
	install_keyboard();

	//Set gfx mode
	set_color_depth(16);
	set_gfx_mode(GFX_DIRECTX, 640, 480, 1024, 1024);
	set_clip(screen, 0, 0, 1024, 1024);

	//Load PCX into RAM
	get_palette(pal);
	image = load_bitmap("allegro.pcx", pal);

	//Blit it into offscreen Video RAM
	acquire_bitmap(screen);
	blit(image, screen, 0, 0, 0, 480, 320, 200);
	release_bitmap(screen);

	//Perform screen to screen blit
	blit(screen, screen, 0, 480, 0, 0, 320, 200);
	
	//Wait for user response
	while(!keypressed);
	readkey();

	//Restore
	acquire_bitmap(screen);
	destroy_bitmap(screen);
	release_bitmap(screen);

	destroy_bitmap(image);

	return 0;
}

This code works fine using DGJPP/Allegro (with appropriate
modifications), so my mistake must be Winallegro specific.  I read the
html file included and couldn't find what I left out.  Thanks in advance
for any help you may provide.

- Raw text -


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