Mail Archives: djgpp/1997/01/06/20:24:08
From: | Martin AT jediknight DOT demon DOT co DOT uk (Martin)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Newbie needs Help! Allegro + W95 :-(
|
Date: | Mon, 06 Jan 1997 22:57:31 GMT
|
Lines: | 64
|
Message-ID: | <32d1828e.750845@news.demon.co.uk>
|
NNTP-Posting-Host: | jediknight.demon.co.uk
|
MIME-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Anyone help me out, Im just a newbie and have written a scroller as
you can see from the below code and its ultr smooth in DOS however in
Win95 its kinda smooth well its smooth then it jumps every now and
then :-(. Is there any way to tell windows to leave my program alone
and give it priority? . Or is it my no doubt very lame scrolling
method?
#include <stdio.h>
#include <allegro.h>
#define SCROLL 2
char *file_pic1="PIC1.PCX";
BITMAP *map;
PALLETE pal;
void main ()
{
/*Map Scrolling Variables*/
int mapx=0;
int mapy=0;
allegro_init(); /* Initialise all Allegro stuff */
install_keyboard(); /* Install keyboard interrupt handler */
clear_keybuf();
/*Create Map Area*/
map = create_bitmap (640,480);
clear (map);
/*Set Graphics Mode,Load Pic and set pallete*/
set_gfx_mode(GFX_AUTODETECT, 320, 240, 0, 0);
map=load_pcx(file_pic1,pal);
set_pallete (pal);
/*Main Loop*/
do {
vsync();
blit (map, screen,mapx,mapy,0,0,320,240);
if (key[KEY_RIGHT]) if ((mapx>=0) && (mapx<320))
mapx=mapx+SCROLL;
if (key[KEY_LEFT]) if (mapx>0) mapx=mapx-SCROLL;
if (key[KEY_DOWN]) if ((mapy>=0) && (mapy<240))
mapy=mapy+SCROLL;
if (key[KEY_UP]) if (mapy>0) mapy=mapy-SCROLL;
} while ( key[KEY_ESC] == FALSE );
fade_out(5);
/*Clean up and exit*/
destroy_bitmap(map);
allegro_exit();
exit(0);
}
- Raw text -