www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/31/08:26:44

From: "big choi" <supercms AT netian DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: helpppp allegroooo
Date: Sat, 31 Oct 1998 22:24:03 +0900
Organization: Korea Telecom
Lines: 63
Message-ID: <71f2u2$4dt$1@news.kornet.nm.kr>
NNTP-Posting-Host: 210.113.149.153
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

first, i allocate on memory which of the picture, size of 800 * 600.
next i want to see on the monitor of the size of 640 * 480.
to see the last parts of the picture, i'd like to use keyboard.
but i can't work...;;
my source are..

#include <allegro.h>

typedef unsigned char BYTE;
typedef unsigned int UINT;

BITMAP *back;
BITMAP *vback;
PALLETE pal;

void init()
{
    allegro_init();
    install_keyboard();
    set_color_depth(24);
    set_gfx_mode(GFX_AUTODETECT,640,480,0,0);
    vback = create_bitmap(800,600);
    clear(vback);

    back=load_pcx("db.pcx",pal);
    set_pallete(pal);
}

void close()
{
    destroy_bitmap(vback);
    destroy_bitmap(back);
}


main()
{
    UINT x=0, y=0;

init();

    while(1)
    {
        if(key[KEY_LEFT])  { x-=5; if(x < 0) x = 0;}
        // x is move to minus. i dont want.
        if(key[KEY_RIGHT]) { x+=10; if(x > 160) x = 160;}
        // this is OK
        if(key[KEY_UP])    { y-=5; if(y < 0) y = 0;}
        // y is move to minus. i dont want.
        if(key[KEY_DOWN])  { y+=10; if(y > 120) y = 120;}
        // OK, too
        if(key[KEY_ESC]) {remove_keyboard(); break;}
        blit(back, vback, x, y, 0, 0, 800, 600);
        blit(vback, screen, 0, 0, 0, 0, 640, 480);
      clear(vback);
    }
    close();
}

thanks.



- Raw text -


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