ayuda allegro
Publicado por leonardo paredes (8 intervenciones) el 10/08/2014 08:24:49
hola a todos necesito ayuda con esto. tengo un BUFFER de 1408x1408 y SCREEN de 704x704..
necesito hacer un blit en SCREEN pero con las cordenadas del buffer.
seria algo asi :
quisas con un puntero "*" o un apersand "&"
aca les dejo mi codigo
necesito hacer un blit en SCREEN pero con las cordenadas del buffer.
seria algo asi :
1
blit(cursor,screen,0,0,"cordenada X del buffer","cordenada Y del buffer",78,78);
aca les dejo mi codigo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#include <allegro.h>
using namespace std;
void init();
void deinit();
void camara(int coordx, int coordy,int &camarax , int &camaray){
camarax= coordx -352;
camaray= coordy -352;
if(camarax<0)camarax=0;
if(camaray<0)camaray=0;
if(camarax>704)camarax=704;
if(camaray>704)camaray=704;
}
int main() {
init();
bool done=false;
int camarax, camaray;
camarax= camaray= 0;
int z = 0;
int coordx = 4;
int coordy = 4;
bool bb= false;
BITMAP *buffer=create_bitmap(1408,1408);
clear_to_color(buffer,0xFFFFFF);
BITMAP *personaje=create_bitmap(72,72);
clear_to_color(personaje,0xFFCCFF);
BITMAP *cursor=create_bitmap(78,78);
clear_to_color(personaje,0xCCFFFF);
while(!done){
if(key[KEY_ESC])done=true;
if(key[KEY_D]&& coordx<1254){
bb=true;
coordx += 78;
rest(200);
}
else if(key[KEY_A] && coordx>4){
bb=true;
coordx -= 78;
rest(200);
}
else if(key[KEY_W]&& coordy>4){
bb=true;
coordy -= 78;
rest(200);
}
else if(key[KEY_S]&& coordy<1254){
bb=true;
coordy += 78;
rest(200);
}
else if(key[KEY_ENTER]){blit(personaje,buffer,0,0,coordx,coordy,72,72);}
blit(cursor,screen,0,0,coordx-3,coordy-3,78,78);
rest(100);
camara(coordx,coordy,camarax,camaray);
blit(buffer,screen,camarax,camaray,0,0,704,704);
}
destroy_bitmap(buffer),(personaje),(cursor);
}
END_OF_MAIN()
void init() {
int depth, res;
allegro_init();
depth = desktop_color_depth();
if (depth == 0) depth = 32;
set_color_depth(depth);
res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 704,704, 0, 0);
if (res != 0) {
allegro_message(allegro_error);
exit(-1);
}
install_timer();
install_keyboard();
install_mouse();
/* add other initializations here */
}
void deinit() {
clear_keybuf();
/* add other deinitializations here */
}
Valora esta pregunta


0