mam taki kod ale za **** nie mogę zrobić tego xview i yview zeby ekran sie przewijal.
Dam kod i prosiłbym, żeby ktoś mi pomógł bo sam nie wyrabiam ;>
#include <allegro.h>
#include "uni01.h"
#include "uni02.h"
#include "uni03.h"
#include "uni04.h"
int main()
{
allegro_init();
install_keyboard();
set_color_depth(16);
set_gfx_mode(GFX_AUTODETECT_WINDOWED,800,600,0,0);
clear_to_color(screen,-1);
BITMAP *bufor = NULL;
bufor = create_bitmap(800,600);
if(!bufor)
{
set_gfx_mode(GFX_TEXT,0,0,0,0);
allegro_message("Blad bufora!");
allegro_exit();
}
DATAFILE *uni01 = NULL;
uni01 = load_datafile("uni01.dat");
if(!uni01)
{
set_gfx_mode(GFX_TEXT,0,0,0,0);
allegro_message("Nie mozna wczytac uni01!");
allegro_exit();
}
DATAFILE *uni02 = NULL;
uni02 = load_datafile("uni02.dat");
if(!uni02)
{
set_gfx_mode(GFX_TEXT,0,0,0,0);
allegro_message("Nie mozna wczytac uni02!");
allegro_exit();
}
DATAFILE *uni03 = NULL;
uni03 = load_datafile("uni03.dat");
if(!uni03)
{
set_gfx_mode(GFX_TEXT,0,0,0,0);
allegro_message("Nie mozna wczytac uni03!");
allegro_exit();
}
DATAFILE *uni04 = NULL;
uni04 = load_datafile("uni04.dat");
if(!uni04)
{
set_gfx_mode(GFX_TEXT,0,0,0,0);
allegro_message("Nie mozna wczytac uni04!");
allegro_exit();
}
int lx=200,ly=450; //Zmienne bohatera
int plx=300,ply=350;
while (!key[KEY_ESC])
{
if(key[KEY_LEFT])plx+=10,masked_blit((BITMAP*)uni02[heros].dat,bufor,0,0,lx,ly,40,60);
if(key[KEY_RIGHT])plx-=10,masked_blit((BITMAP*)uni01[hero].dat,bufor,0,0,lx,ly,40,60);
if(key[KEY_UP])ly==400;
if(ly<=400)ly==450;
rest(80);
clear_to_color(bufor,-1);
blit((BITMAP*)uni03[podloga].dat,bufor,0,0,0,500,600,150);
blit((BITMAP*)uni03[podloga].dat,bufor,0,0,200,500,600,150);
masked_blit((BITMAP*)uni04[platforma].dat,bufor,0,0,plx,ply,80,155);
masked_blit((BITMAP*)uni01[hero].dat,bufor,0,0,lx,ly,40,60);
blit(bufor,screen,0,0,0,0,800,600);
}
allegro_exit();
return 0;
}
END_OF_MAIN()