本文整理汇总了C++中destroy_bitmap函数的典型用法代码示例。如果您正苦于以下问题:C++ destroy_bitmap函数的具体用法?C++ destroy_bitmap怎么用?C++ destroy_bitmap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了destroy_bitmap函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: destroy_bitmap
Options::~Options() {
if (options)
destroy_bitmap(options);
}
开发者ID:nyvath,项目名称:Dao,代码行数:4,代码来源:Options.cpp
示例2: edit_ram
/*****************************************************************************
Function: edit_ram
Description: view or edit the RAM
Parameters: none
Return: nothing
*****************************************************************************/
void
edit_ram ()
{
#ifdef ALLEGRO
BITMAP *bg;
unsigned char line, col;
char *tmp_buf = (char *) alloca (100);
unsigned short dum;
bg = create_bitmap (vheight, vwidth);
blit (screen, bg, 0, 0, 0, 0, vheight, vwidth);
selected_byte = 0;
out = 0;
frame_up = 0;
frame_down = frame_up + NB_LINE * NB_BYTE_LINE;
while (!out)
{
clear (screen);
for (line = 0; line < NB_LINE; line++)
{
sprintf (tmp_buf, "%04X", frame_up + line * NB_BYTE_LINE);
textoutshadow (screen, font, tmp_buf, blit_x, blit_y + 10 * line,
-15, 2, 1, 1);
for (col = 0; col < NB_BYTE_LINE / 2; col++)
{
if ((dum = frame_up + line * NB_BYTE_LINE + col) ==
selected_byte)
rectfill (screen, blit_x + (6 + col * 3) * 8,
blit_y + 10 * line - 1, blit_x + (8 + col * 3) * 8,
blit_y + 10 * (line + 1) - 2, -15);
sprintf (tmp_buf, "%02X", RAM[dum]);
textoutshadow (screen, font, tmp_buf,
blit_x + (6 + col * 3) * 8, blit_y + 10 * line,
-1, 2, 1, 1);
}
for (; col < NB_BYTE_LINE; col++)
{
if ((dum = frame_up + line * NB_BYTE_LINE + col) ==
selected_byte)
rectfill (screen, blit_x + (8 + col * 3) * 8,
blit_y + 10 * line - 1, blit_x + (10 + col * 3) * 8,
blit_y + 10 * (line + 1) - 2, -15);
sprintf (tmp_buf, "%02X",
RAM[frame_up + line * NB_BYTE_LINE + col]);
textoutshadow (screen, font, tmp_buf,
blit_x + (8 + col * 3) * 8, blit_y + 10 * line,
-1, 2, 1, 1);
}
}
ram_key ();
vsync ();
}
blit (bg, screen, 0, 0, 0, 0, vheight, vwidth);
destroy_bitmap (bg);
return;
#endif
}
开发者ID:ProfessorKaos64,项目名称:hu-go,代码行数:75,代码来源:edit_ram.c
示例3: mexFunction
//.........这里部分代码省略.........
}
destroy_region_masks(amaskm);
// output ann: x | y | patch_distance
if(nout >= 1) {
mxArray *ans = NULL;
if (knn_chosen > 1) {
if (sim_mode) { mexErrMsgTxt("rotating+scaling patches return value not implemented with knn"); }
mwSize dims[4] = { ah, aw, 3, knn_chosen };
ans = mxCreateNumericArray(4, dims, mxINT32_CLASS, mxREAL);
int *data = (int *) mxGetData(ans);
for (int kval = 0; kval < knn_chosen; kval++) {
int *xchan = &data[aw*ah*3*kval+0];
int *ychan = &data[aw*ah*3*kval+aw*ah];
int *dchan = &data[aw*ah*3*kval+2*aw*ah];
for (int y = 0; y < ah; y++) {
// int *ann_row = (int *) ann->line[y];
// int *annd_row = (int *) annd_final->line[y];
for (int x = 0; x < aw; x++) {
// int pp = ann_row[x];
int pp = vann->get(x, y)[kval];
int pos = y + x * ah;
xchan[pos] = INT_TO_X(pp);
ychan[pos] = INT_TO_Y(pp);
dchan[pos] = vannd->get(x, y)[kval];
}
}
}
} else if (ann_sim_final) {
mwSize dims[3] = { ah, aw, 5 };
ans = mxCreateNumericArray(3, dims, mxSINGLE_CLASS, mxREAL);
float *data = (float *) mxGetData(ans);
float *xchan = &data[0];
float *ychan = &data[aw*ah];
float *dchan = &data[2*aw*ah];
float *tchan = &data[3*aw*ah];
float *schan = &data[4*aw*ah];
double angle_scale = 2.0*M_PI/NUM_ANGLES;
for (int y = 0; y < ah; y++) {
int *ann_row = (int *) ann->line[y];
int *annd_row = (int *) annd_final->line[y];
int *ann_sim_row = ann_sim_final ? (int *) ann_sim_final->line[y]: NULL;
for (int x = 0; x < aw; x++) {
int pp = ann_row[x];
int pos = y + x * ah;
xchan[pos] = INT_TO_X(pp);
ychan[pos] = INT_TO_Y(pp);
dchan[pos] = annd_row[x];
if (ann_sim_final) {
int v = ann_sim_row[x];
int tval = INT_TO_Y(v)&(NUM_ANGLES-1);
int sval = INT_TO_X(v);
tchan[pos] = tval*angle_scale;
schan[pos] = xform_scale_table[sval]*(1.0/65536.0);
}
}
}
} else {
mwSize dims[3] = { ah, aw, 3 };
ans = mxCreateNumericArray(3, dims, mxINT32_CLASS, mxREAL);
int *data = (int *) mxGetData(ans);
int *xchan = &data[0];
int *ychan = &data[aw*ah];
int *dchan = &data[2*aw*ah];
for (int y = 0; y < ah; y++) {
int *ann_row = (int *) ann->line[y];
int *annd_row = (int *) annd_final->line[y];
for (int x = 0; x < aw; x++) {
int pp = ann_row[x];
int pos = y + x * ah;
xchan[pos] = INT_TO_X(pp);
ychan[pos] = INT_TO_Y(pp);
dchan[pos] = annd_row[x];
}
}
}
pout[0] = ans;
}
// clean up
delete vann;
delete vann_sim;
delete vannd;
delete p;
delete rp;
destroy_bitmap(a);
destroy_bitmap(borig);
delete ab;
delete bb;
delete af;
delete bf;
destroy_bitmap(ann);
destroy_bitmap(annd_final);
destroy_bitmap(ann_sim_final);
if (ann_prev) destroy_bitmap(ann_prev);
if (ann_window) destroy_bitmap(ann_window);
if (awinsize) destroy_bitmap(awinsize);
}
开发者ID:fmacias64,项目名称:Face-Hallucination,代码行数:101,代码来源:nnmex.cpp
示例4: destroy_bitmap
Snapshot::~Snapshot() {
destroy_bitmap(canvas);
}
开发者ID:drcouzelis,项目名称:kwestkingdom,代码行数:4,代码来源:Snapshot.cpp
示例5: main
//.........这里部分代码省略.........
amount[x][y][0][0]=((float)ix+1-(float)px)*((float)(iy+1)-(float)py);
amount[x][y][1][0]=((float)px-(float)ix)*((float)(iy+1)-(float)py);
amount[x][y][0][1]=((float)ix+1-(float)px)*((float)py-(float)iy);
amount[x][y][1][1]=((float)px-(float)ix)*((float)py-(float)iy);
pix[x][y]=ix;
piy[x][y]=iy;
// printf("%f",amount[x][y][0][0]+amount[x][y][1][0]+amount[x][y][0][1]+amount[x][y][1][1]);
if (mysquare(amount[x][y][0][0]+amount[x][y][1][0]+amount[x][y][0][1]+amount[x][y][1][1]-1)>0.00001) {
printf("%d %d %f %f ",ix,iy,px,py);
printf("%f+%f(%f*%f)+%f+%f=%f? \n",amount[x][y][0][0],amount[x][y][1][0],(float)px-(float)ix,(float)(iy+1)-(float)py,amount[x][y][0][1],amount[x][y][1][1],amount[x][y][0][0]+amount[x][y][1][0]+amount[x][y][0][1]+amount[x][y][1][1]);
}
}
}
// srand(456789);
srand((int)time(NULL));
//printf("%d\n",(int)time(NULL));
allegro_init ();
install_keyboard ();
install_timer ();
set_gfx_mode (GFX_AUTODETECT, scrwid, scrhei, 0, 0);
set_pallete (desktop_palette);
buffer = create_bitmap (scrwid, scrhei);
clear (buffer);
// textout_centre (buffer, font, "Press SPACE!", 60, 220, 4);
// Set up grayscale colours
for (c=0;c<=255;c++) {
i=0;
rgb.r=c*63/255;
rgb.g=0;
rgb.b=0;
set_color(c,&rgb);
// colors[c]=GrAllocColor(c,i,i);
}
for (x=0; x<scrwid; x++) {
for (y=0; y<scrhei; y++) {
putpixel(buffer,x,y,128);
}
}
blit (buffer, screen, 0, 0, 0, 0, scrwid, scrhei);
_farsetsel(screen->seg);
while(!key[KEY_ESC]) {
for (y=0; y<scrhei; y++) {
movedata(screen->seg, bmp_read_line(screen,y), _my_ds(), tmp[y], scrwid);
}
for (x=0; x<scrwid; x++) {
for (y=0; y<scrhei; y++) {
c=0;
kx=x-scrwid/2;
ky=y-scrhei/2;
jx=kx*cos(ang)+ky*sin(ang);
jy=-kx*sin(ang)+ky*cos(ang);
ix=scrwid/2+0.9*jx;
iy=scrhei/2+0.9*jy;
k=0;
i=0;j=0;
// for (i=-1;i<=1;i++) {
// for (j=-1;j<=1;j++) {
// c=c+getpixel(screen, ix+i, iy+j);
// address = bmp_read_line(screen, iy)+ix;
c=c+tmp[iy][ix];
k++;
// }
// }
c=c/k;
c--;
// address = bmp_write_line(buffer, y)+x;
// _farnspokeb(address, c);
tmp2[y][x]=c;
// putpixel(buffer, x, y, c);
}
}
for (y=0; y<scrhei; y++) {
movedata(_my_ds(), tmp2[y], screen->seg, bmp_write_line(screen,y), scrwid);
}
for (i=1;i<=10;i++)
circlefill(screen,myrnd()*scrwid,myrnd()*scrhei,8,myrnd()*255);
// putpixel(buffer,scrwid/2,scrhei/2,255);
// blit (buffer, screen, 0, 0, 0, 0, scrwid, scrhei);
}
destroy_bitmap(buffer);
exit(0);
getch();
// GrSetMode(GR_default_text);
printf("max col %d\n",maxc);
printf("min col %d\n",minc);
}
开发者ID:10crimes,项目名称:code,代码行数:101,代码来源:zoom8.c
示例6: unload_kid_sword_walkb
void
unload_kid_sword_walkb (void)
{
destroy_bitmap (kid_sword_walkb_00);
destroy_bitmap (kid_sword_walkb_01);
}
开发者ID:oitofelix,项目名称:mininim,代码行数:6,代码来源:kid-sword-walkb.c
示例7: destroy_bitmap
TileType::~TileType()
{
destroy_bitmap(bitmap);
free(name);
}
开发者ID:moonlight,项目名称:cave-adventure,代码行数:5,代码来源:tiled_map.cpp
示例8: main
void main(int argc, char **argv) {
int i, done = 0;
pl_MaterialType mat[NUM_ITERS]; // Materials
pl_ObjectType *obj; // Head object
pl_LightType *light;
pl_CameraType *cam;
int vWidth = 320, vHeight = 200; // For allegro
pl_FloatType ar; // Aspect ratio
char cpal[768];
PALETTE pal; // Allegro palette
if (argc > 1) sscanf(argv[1],"%dx%d",&vWidth,&vHeight);
printf("Flurry v1.0\n"
"Copyright (c) 1996, Justin Frankel\n");
printf("Using:\n"
" %s\n",plVersionString);
allegro_init();
if (set_gfx_mode(GFX_AUTODETECT,vWidth,vHeight,0,0)) {
allegro_exit();
printf("Mode not supported\n");
exit(1);
}
DIB = create_bitmap(vWidth,vHeight);
ar = (vWidth/(pl_FloatType) vHeight) * (3.0/4.0); // Calc aspect ratio
cam = plNewCamera(vWidth,vHeight,ar,90.0,0,DIB->dat,0);
cam->Sort = 1;
cam->Zp = -350;
// Initialize materials
memset(&mat,0,sizeof(pl_MaterialType)*NUM_ITERS);
for (i = 0; i < NUM_ITERS; i ++) {
mat[i].NumGradients = 200;
mat[i].Transparent = 2;
mat[i].AmbientLight = 20;
mat[i].Shininess = 3;
mat[i].ShadeType = PL_SHADE_GOURAUD;
mat[i].Priority = i;
}
mat[0].Red = 190; mat[0].Green = 190; mat[0].Blue = 0;
mat[0].RedSpec = 240; mat[0].GreenSpec = 240; mat[0].BlueSpec = 0;
mat[1].Red = 0; mat[1].Green = 0; mat[1].Blue = 100;
mat[1].RedSpec = 0; mat[1].GreenSpec = 0; mat[1].BlueSpec = 100;
mat[2].Red = 0; mat[2].Green = 130; mat[2].Blue = 0;
mat[2].RedSpec = 0; mat[2].GreenSpec = 130; mat[2].BlueSpec = 0;
mat[3].Red = 100; mat[3].Green = 0; mat[3].Blue = 0;
mat[3].RedSpec = 100; mat[3].GreenSpec = 0; mat[3].BlueSpec = 0;
memset(cpal,0,768);
plPMBegin(cpal,1,255);
for (i = 0; i < NUM_ITERS; i ++) plPMAddMaterial(mat + i);
plPMEnd();
cpal[0] = cpal[1] = cpal[2] = 0;
for (i = 0; i < 256; i ++) {
pal[i].r = cpal[i*3] >> 2;
pal[i].g = cpal[i*3+1] >> 2;
pal[i].b = cpal[i*3+2] >> 2;
}
set_palette(pal); // Set the new palette via allegro
// Make objects
obj = plMakeBox(100,100,100,mat);
makeBoxes(obj,100.0,mat+1,NUM_ITERS-1);
// Setup light
light = plNewLight();
plSetLight(light,PL_LIGHT_VECTOR,0,0,0,1.0);
while (!done) {
rotateBoxes(obj,1.0);
clear(DIB); // clear framebuffer & zbuffer
plRenderBegin(cam);
plRenderLight(light);
plRenderObject(obj);
plRenderEnd();
vsync(); // Allegro wait for vsync
blit(DIB,screen,0,0,0,0,cam->ScreenWidth,cam->ScreenHeight);
while (kbhit()) switch(getch()) {
case 27: done = 1; break;
case '-': cam->Fov += 1.0; if (cam->Fov > 170) cam->Fov = 170; break;
case '=': cam->Fov -= 1.0; if (cam->Fov < 10) cam->Fov = 10; break;
}
}
destroy_bitmap(DIB);
plFreeObject(obj);
plFreeLight(light);
plFreeCamera(cam);
set_gfx_mode(GFX_TEXT,0,0,0,0);
allegro_exit();
printf("Try \"flurry 640x480\"\n");
}
开发者ID:OrangeTide,项目名称:plush,代码行数:95,代码来源:flurry.c
示例9: main
//.........这里部分代码省略.........
windimg[bi][bj]=0;
}else{
windimg[bi][bj]=livello[i][j].sprite;
}
}
}
for(i=0,y=0;i<WIMGY;i++,y+=UNITY){
for(j=0,x=SCREEN_W-(WIMGX*UNITX);j<WIMGX;j++,x+=UNITX){
//temp=;
blit(sprites[windimg[i][j]],buffer,0,0,x,y,UNITX,UNITY);
}
}
// Se � premuto 'toggleprint' ( che � un Pokemon? )
if(toggleprint){
rectfill(buffer,300,110,320,130,CURS_COL);
}else{
rectfill(buffer,300,110,320,130,DESK_COL);
}
textprintf(buffer,font,250,60,255,"Sol : %d",solidcont);
textprintf(buffer,font,250,70,255,"Terr: %d",terrancont);
// Disegno elenco sprite
if(spritecont>10){
sprconmeno=spritecont-10;
}else{
sprconmeno=256-(10-spritecont);
}
if(spritecont<246){
sprconpiu=spritecont+10;
}else{
sprconpiu=10-(256-spritecont);
}
if(spritecont2>10){
sprconmeno2=spritecont2-10;
}else{
sprconmeno2=256-(10-spritecont2);
}
if(spritecont2<246){
sprconpiu2=spritecont2+10;
}else{
sprconpiu2=10-(256-spritecont2);
}
for(bi=sprconmeno,bj=sprconmeno2,x=0;bi!=sprconpiu;bi++,bj++,x+=BIGUNITX){
stretch_blit(sprites[bi],buffer,0,0,UNITX,UNITY,x,
200,BIGUNITX,BIGUNITY);
if(cursize>1){
stretch_blit(sprites[bj],buffer,0,0,
UNITX,UNITY,x,216,BIGUNITX,BIGUNITY);
}
}
rect(buffer,160,199,160+(cursize*BIGUNITX),
200+(cursize*BIGUNITY),CURS_COL);
moved=false;
}
if(pushed){
pushed=false;
for(i=0;i<128;i++){
if(key[i]){
pushed=true;
break;
}
}
}
show_mouse(buffer);
vsync();
blit(buffer,screen,0,0,0,0,SCREEN_W,SCREEN_H);
show_mouse(NULL);
}
/// Distruzione Bitmap
for(i=0;i<256;i++){
destroy_bitmap(sprites[i]);
//destroy_bitmap(texture[1][i]);
}
destroy_bitmap(textures);
//destroy_bitmap(lvldis);
destroy_bitmap(buffer);
readkey();
GameExit();
printf("Programmed with DJGPP RHIDE Allegro");
puts(errmess);
getch();
return 0;
}
开发者ID:Shaduck,项目名称:OldGame01,代码行数:101,代码来源:NwLvlMak.cpp
示例10: main
//.........这里部分代码省略.........
install_int(the_timer, 1);
old_time = chrono;
text_mode(0);
do {
int chrono2;
/* Tile mysha over the screen */
#ifndef COMPARE_WITH_ALLEGRO
blit(mysha, buffer, 0, 0, 0, 0, mysha->w, mysha->h);
blit(mysha, buffer, 0, 0, 320, 0, mysha->w, mysha->h);
blit(mysha, buffer, 0, 0, 0, 200, mysha->w, mysha->h);
blit(mysha, buffer, 0, 0, 320, 200, mysha->w, mysha->h);
blit(mysha, buffer, 0, 0, 0, 400, mysha->w, mysha->h);
blit(mysha, buffer, 0, 0, 320, 400, mysha->w, mysha->h);
#endif
if (use_alleg) {
for (i = 0; i < NUM_PARTICLES; i++) {
set_difference_blender(0, 0, 0, particle[i]->a);
draw_trans_sprite(buffer, particle[i]->bmp, particle[i]->x - particle[i]->bmp->w/2, particle[i]->y - particle[i]->bmp->h/2);
}
}
else {
for (i = 0; i < NUM_PARTICLES; i++)
fblend_sub(particle[i]->bmp, buffer, particle[i]->x - particle[i]->bmp->w/2, particle[i]->y - particle[i]->bmp->h/2, particle[i]->a);
}
if (key[KEY_SPACE]) {
use_alleg = !use_alleg;
key[KEY_SPACE] = 0;
chrono = 0;
count = 0;
old_time = 0;
old_time2 = 0;
}
count++;
#ifdef COMPARE_WITH_ALLEGRO
textprintf(screen, font, 0, 0, makecol(255, 255, 255), "%s %.2f fps (%.3f avg)", use_alleg ? "Using Allegro" : "Using new", (chrono - old_time2) == 0 ? 1000.0 : 1000 / ((double)chrono - old_time2), count * 1000.0 / chrono);
#else
textprintf(buffer, font, 0, 0, makecol(255, 255, 255), "%s %.2f fps (%.3f avg)", use_alleg ? "Using Allegro" : "Using new", (chrono - old_time2) == 0 ? 1000.0 : 1000 / ((double)chrono - old_time2), count * 1000.0 / chrono);
#endif
old_time2 = chrono;
#ifndef COMPARE_WITH_ALLEGRO
/* Draw the buffer */
blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
#endif
chrono2 = chrono / 40;
for (i = old_time/40; i < chrono2; i++) {
int j;
for (j = 0; j < NUM_PARTICLES; j++) {
particle[j]->x += particle[j]->vx;
particle[j]->y += particle[j]->vy;
if (particle[j]->x <= 0 || particle[j]->x >= SCREEN_W)
particle[j]->vx = -particle[j]->vx;
if (particle[j]->y <= 0 || particle[j]->y >= SCREEN_H)
particle[j]->vy = -particle[j]->vy;
if (particle[j]->a <= 0 || particle[j]->a >= 256)
particle[j]->a_dir = -particle[j]->a_dir;
particle[j]->a += particle[j]->a_dir;
}
}
old_time = chrono;
} while (!key[KEY_ESC]);
Error:
TRACE("Shutting down.\n");
if (mysha)
destroy_bitmap(mysha);
if (buffer)
destroy_bitmap(buffer);
for (i = 0; i < NUM_PARTICLES; i++) {
if (particle[i]) {
if (particle[i]->bmp)
destroy_bitmap(particle[i]->bmp);
free(particle[i]);
}
}
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
return 0;
} END_OF_MAIN();
开发者ID:stefanhendriks,项目名称:dune2themaker,代码行数:101,代码来源:exsub.c
示例11: main
//.........这里部分代码省略.........
land[i].w = (rand()%20) + 20;
}
land[13].y = y + 10;
land[13].x = x;
land[13].w = 45;
rest(50);
while (!key[KEY_ESC])
{
start_time = clock();
/*game goes here*/
//move left
if (key[KEY_LEFT])
x -= 10;
//move right
if (key[KEY_RIGHT])
x += 10;
//jump
if ((!jump)&&(key[KEY_SPACE]))
{
jump = true;
jumpforce = 60;
}
if ((jump)&&(key[KEY_SPACE]))
{
jumpforce += 1;
}
//speed up!
speed = 3 + (game_time/20000);
//fall
if (jump)
{
jumpforce -= 3;
}
if (!jump)
jumpforce = -12;
y -= jumpforce/4;
//drop platforms down
add_platform();
for (int i = 0; i < 14; i++)
{
land[i].y += speed;
}
//collision
on_land = 0;
for (int i = 0; i < 14; i++)
{
if ((y > land[i].y - 20)&&(y < land[i].y))
{
if ((x < land[i].x + land[i].w)&&(x > land[i].x - land[i].w))
{
if (jumpforce < 5)
{
jump = false;
}
jumpforce = -speed*3;
on_land += 1;
}
}
}
if (on_land == 0)
jump = true;
//warp
if (x < 0)
x = 0;
if (x > WIDTH)
x = WIDTH;
//die
if (y > HEIGHT)
return;
/*drawing goes here*/
rectfill(buffer, 0, 0, WIDTH, HEIGHT, BLACK);
circlefill(buffer, x, y, 10, WHITE);
textprintf(buffer, font, 320, 20, WHITE, "%i'%i", game_time/60000, (game_time/1000)%60);
for (int i = 0; i < 14; i++)
{
hline(buffer, land[i].x - land[i].w, land[i].y, land[i].x + land[i].w, WHITE);
}
blit(buffer, screen, 0, 0, 0, 0, WIDTH, HEIGHT);
game_time += 20;
while (clock() < start_time + 20)
{}
}
destroy_bitmap(buffer);
return;
}
开发者ID:Bencepapa,项目名称:CymonsGames,代码行数:101,代码来源:main.cpp
示例12: destroy_bitmap
c_al_bitmap::~c_al_bitmap() {
if (m_bitmap) {
destroy_bitmap(m_bitmap);
m_bitmap=nullptr;
}
}
开发者ID:da2ce7,项目名称:antinet,代码行数:6,代码来源:c_allegromisc.cpp
示例13: main
//.........这里部分代码省略.........
for (unsigned int x=0;x<heli.size();++x) {
if (!(heli[x].health>0))explosions.push_back(explosion(image_explosion, 17, (int)heli[x].pos_x, (int)heli[x].pos_y, rand()%(heli[x].size_x*2), rand()%(heli[x].size_y*2)));
heli[x].update_phys();
}
for (unsigned int x=0;x<spheres.size();++x) {
spheres[x].update_phys();
}
for (unsigned int x=0;x<explosions.size();++x)
if (explosions[x].alive)
explosions[x].update_frame();
else
explosions.erase(explosions.begin()+x);
for (unsigned int x=0;x<heli.size();++x)
for (unsigned int y=0;y<spheres.size();++y)
if (check_collision(spheres[y], heli[x])) {
heli[x].explode((heli[x].pos_x - spheres[y].pos_x)+heli[x].speed_x, (heli[x].pos_y - spheres[y].pos_y)+heli[x].speed_y, 1);
spheres[y].explode((spheres[y].pos_x - heli[x].pos_x)+spheres[y].speed_x, (spheres[y].pos_y - heli[x].pos_y)+spheres[y].speed_y);
if (heli[x].health>0) explosions.push_back(explosion(image_explosion, 17, (int)heli[x].pos_x, (int)heli[x].pos_y, heli[x].size_x, heli[x].size_y));
explosions.push_back(explosion(image_explosion, 17, (int)spheres[y].pos_x, (int)spheres[y].pos_y));
}
for (unsigned int x=0;x<spheres.size();++x)
for (unsigned int y=x+1;y<spheres.size();++y)
if (check_collision(spheres[x], spheres[y])) {
spheres[x].explode((spheres[x].pos_x - spheres[y].pos_x)+spheres[x].speed_x, (spheres[x].pos_y - spheres[y].pos_y)+spheres[x].speed_y);
spheres[y].explode((spheres[y].pos_x - spheres[x].pos_x)+spheres[y].speed_x, (spheres[y].pos_y - spheres[x].pos_y)+spheres[y].speed_y);
explosions.push_back(explosion(image_explosion, 17, (int)spheres[x].pos_x, (int)spheres[x].pos_y));
explosions.push_back(explosion(image_explosion, 17, (int)spheres[y].pos_x, (int)spheres[y].pos_y));
}
if (check_collision(heli[0], heli[1])) {
heli[0].explode((heli[0].pos_x - heli[1].pos_x)+heli[0].speed_x, (heli[0].pos_y - heli[1].pos_y)+heli[0].speed_y, 5);
heli[1].explode((heli[1].pos_x - heli[0].pos_x)+heli[1].speed_x, (heli[1].pos_y - heli[0].pos_y)+heli[1].speed_y, 5);
if (heli[0].health>0) explosions.push_back(explosion(image_explosion, 17, (int)heli[0].pos_x, (int)heli[0].pos_y, heli[0].size_x, heli[0].size_y));
if (heli[1].health>0) explosions.push_back(explosion(image_explosion, 17, (int)heli[1].pos_x, (int)heli[1].pos_y, heli[1].size_x, heli[1].size_y));
}
for (unsigned int x=0;x<heli.size();++x) {
for (unsigned int y=0;y<heli[x].shots.size();++y) {
for (unsigned int z=0;z<heli.size();++z)
if (z!=x)
if (check_collision(heli[x].shots[y], heli[z])) {
heli[z].explode((heli[z].pos_x - heli[x].shots[y].pos_x)+heli[z].speed_x, (heli[z].pos_y - heli[x].shots[y].pos_y)+heli[z].speed_y,10);
if (heli[z].health>0) explosions.push_back(explosion(image_explosion, 17, (int)heli[z].pos_x, (int)heli[z].pos_y));
}
for (unsigned int z=0;z<spheres.size();++z)
if (check_collision(heli[x].shots[y], spheres[z])) {
spheres[z].explode((spheres[z].pos_x - heli[x].shots[y].pos_x)+spheres[z].speed_x, (spheres[z].pos_y - heli[x].shots[y].pos_y)+spheres[z].speed_y);
explosions.push_back(explosion(image_explosion, 17, (int)spheres[z].pos_x, (int)spheres[z].pos_y));
if (z==0) {
spheres.erase(spheres.begin());
spheres.push_back(ball(image_sphere->w,image_sphere->h,(double)((int)rand()%(SCREEN_W-image_sphere->w)),(double)((int)rand()%(SCREEN_H-image_sphere->h)),(double)((int)rand()%60),(double)((int)rand()%60),0.0,gravity * 2,0.95,0.95));
heli[x].health += 50;
}
}
}
for (unsigned int y=x+1;y<heli.size();++y)
if (check_collision(heli[x], heli[y])) {
heli[x].explode((heli[x].pos_x - heli[y].pos_x)+heli[x].speed_x, (heli[x].pos_y - heli[y].pos_y)+heli[x].speed_y,10);
if (heli[x].health>0) explosions.push_back(explosion(image_explosion, 17, (int)heli[x].pos_x, (int)heli[x].pos_y));
heli[y].explode((heli[y].pos_x - heli[x].pos_x)+heli[y].speed_x, (heli[y].pos_y - heli[x].pos_y)+heli[y].speed_y,10);
if (heli[y].health>0) explosions.push_back(explosion(image_explosion, 17, (int)heli[y].pos_x, (int)heli[y].pos_y));
}
}
speed_counter--;
}
blit(background, buffer, 0, 0, 0, 0, width, height);
for (unsigned int x=0;x<spheres.size();++x) {
if (x==0)
spheres[x].draw(buffer, image_sphere2);
else
spheres[x].draw(buffer, image_sphere);
}
heli[0].draw(buffer, image, image_shot);
heli[1].draw(buffer, image2, image_shot);
//heli[2].draw(buffer, image3, image_shot);
draw_health(buffer, 10, 10, heli[0].health);
draw_health(buffer, SCREEN_W-110, 10, heli[1].health);
//draw_health(buffer, SCREEN_W/2, 10, heli[2].health);
for (unsigned int x=0;x<explosions.size();++x)
explosions[x].draw(buffer);
blit(buffer, screen, 0, 0, 0, 0, width, height);
clear_bitmap(buffer);
}
destroy_bitmap(buffer);
return 0;
}
开发者ID:strykejern,项目名称:jumpy,代码行数:101,代码来源:main.cpp
示例14: destroy_datafile_png
static void destroy_datafile_png(void *data)
{
if (data) {
destroy_bitmap((BITMAP *)data);
}
}
开发者ID:zeromus,项目名称:ZeldaClassic,代码行数:6,代码来源:regpng.c
示例15: showIntro
void showIntro(void)
{
allegro_gl_begin();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, 800, 0, 600, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClearColor(0, 0, 0, 0);
glShadeModel(GL_SMOOTH);
glDepthFunc(GL_LEQUAL);
glClearDepth(1.0);
glEnable(GL_DEPTH_TEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glEnable(GL_TEXTURE_2D);
allegro_gl_end();
GLuint machineballtex;
allegro_gl_set_texture_format(GL_RGBA);
BITMAP *bmp = create_bitmap_ex(32, 256, 64);
blit(&mb_machineball_bmp, bmp, 0, 0, 0, 0, 256, 64);
machineballtex = allegro_gl_make_masked_texture(bmp);
destroy_bitmap(bmp);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
dp = al_start_duh(menuduh, 2, 0, (float)options.musicvol/255.0, 2048, 22050);
menumusicisplaying=1;
timer.install();
double time;
time=0;
while(!(key[KEY_ESC] || time>23))
{
rest(1);
time=timer.seconds();
al_poll_duh(dp);
allegro_gl_begin();
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if(time<4)
{
glColor3f(time/4, time/4, time/4);
text.print(120, 280, "BENNY KRAMEK PRESENTS");
glBindTexture(GL_TEXTURE_2D, bennykramekwebtex);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2i(242, 180);
glTexCoord2f(1, 0);
glVertex2i(498, 180);
glTexCoord2f(1, 1);
glVertex2i(498, 212);
glTexCoord2f(0, 1);
glVertex2i(242, 212);
glEnd();
}
else if(time<8)
{
glColor3f(1-((time-4)/4), 1-((time-4)/4), 1-((time-4)/4));
text.print(120, 280, "BENNY KRAMEK PRESENTS");
glBindTexture(GL_TEXTURE_2D, bennykramekwebtex);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2i(242, 180);
glTexCoord2f(1, 0);
glVertex2i(498, 180);
glTexCoord2f(1, 1);
glVertex2i(498, 212);
glTexCoord2f(0, 1);
glVertex2i(242, 212);
glEnd();
}
glColor3f(0.5, 0.5, 0.5);
text.begin();
text.print(20, (int)(60*(time-8.7)), "THIS IS THE FUTURE.");
text.print(20, (int)(60*(time-8.7))-50, "A FUTURE WHERE PRIMITIVE SPORTS");
text.print(20, (int)(60*(time-8.7))-100, "NO LONGER EXIST. IN THIS WORLD,");
text.print(20, (int)(60*(time-8.7))-150, "THERE IS ONLY ONE SPORT.");
text.print(20, (int)(60*(time-8.7))-200, "THERE IS ONLY...");
text.end();
if(time>22 && time<=22.5)
{
glColor3f(1, 1, 1);
glBindTexture(GL_TEXTURE_2D, machineballtex);
glTranslatef(400, 300, 0);
glScalef((time-22)*200, (time-22)*200, (time-22)*200);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2i(-4, -1);
glTexCoord2f(1, 0);
glVertex2i(4, -1);
glTexCoord2f(1, 1);
glVertex2i(4, 1);
//.........这里部分代码省略.........
开发者ID:Eliasvan,项目名称:machineball,代码行数:101,代码来源:intro.cpp
示例16: main
//.........这里部分代码省略.........
allegro_message("The '-pregen' option requires '-frames num' to be specified,\nand cannot be used at the same time as '-step'\n");
return 1;
}
if (!set_video_mode()) {
ret = 1;
goto getout;
}
the_egg = load_egg(in_file, error);
if (!the_egg) {
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("%s", error);
return 1;
}
if (size_x <= 0)
size_x = 128;
if (size_y <= 0)
size_y = 128;
if (pal_file) {
BITMAP *tmp = load_bitmap(pal_file, pal);
if (!tmp) {
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("Error reading palette from '%s'\n", pal_file);
ret = 1;
goto getout;
}
destroy_bitmap(tmp);
}
else
generate_332_palette(pal);
clear(screen);
set_palette(pal);
text_mode(0);
do {
if (pregen) {
textprintf_centre(screen, font, SCREEN_W/2, SCREEN_H/2-24, makecol(128, 128, 128), "Rendering frame %d/%d", the_egg->frame+1, frames);
textprintf_centre(screen, font, SCREEN_W/2, SCREEN_H/2+24, makecol(128, 128, 128), "Please Wait");
}
if (update_egg(the_egg, error) != 0) {
allegro_exit();
printf("Error running EGG script:\n%s\n\n", error);
ret = 1;
goto getout;
}
bmp[frame] = create_bitmap(size_x, size_y);
lay_egg(the_egg, bmp[frame]);
if (!pregen) {
vsync();
blit(bmp[frame], screen, 0, 0, (SCREEN_W-size_x)/2, (SCREEN_H-size_y)/2, size_x, size_y);
textprintf(screen, font, 0, 0, makecol(128, 128, 128), "Frame %d, %d particles ", the_egg->frame, the_egg->part_count);
}
开发者ID:ReneNyffenegger,项目名称:EGG-Explosion-Graphics-Generator,代码行数:67,代码来源:eggshell.c
示例17: fin
void fin(){
clear_keybuf();
destroy_bitmap(im_tortuga);
destroy_bitmap(buffer);
destroy_bitmap(buffer2);
}
开发者ID:jacedo,项目名称:logo,代码行数:6,代码来源:Entorno.cpp
示例18: destroy_bitmap
ZRadar::~ZRadar()
{
destroy_bitmap(Painted);
}
开发者ID:Yurand,项目名称:tw-light,代码行数:4,代码来源:radar.cpp
示例19: deinit
void deinit()
{
clear_keybuf();
destroy_bitmap(buffer);
/* add other deinitializations here */
}
开发者ID:kyleaclark,项目名称:connect-four,代码行数:6,代码来源:setup.cpp
示例20: check_ui_keys
/* Check user interface keys */
void check_ui_keys(void)
{
if(check_key(KEY_TILDE))
{
static const char *msg[] = {"EMU2413", "YM2413"};
if(snd.fm_which == SND_EMU2413)
snd.fm_which = SND_YM2413;
else
snd.fm_which = SND_EMU2413;
add_msg("Using %s FM sound emulator.", msg[snd.fm_which]);
sound_init();
}
/* Frame skip keys */
if(check_key(KEY_F1)) { frame_skip = 1; add_msg("Frame skip disabled"); };
if(check_key(KEY_F2)) { frame_skip = 2; add_msg("Frame skip set to 1"); };
if(check_key(KEY_F3)) { frame_skip = 3; add_msg("Frame skip set to 2"); };
if(check_key(KEY_F4)) { frame_skip = 4; add_msg("Frame skip set to 3"); };
/* State save/load keys */
if(check_key(KEY_F5)) { if(save_state()) add_msg("State saved to slot %d", state_slot); };
if(check_key(KEY_F6)) { state_slot = (state_slot + 1) % 10; add_msg("Slot %d", state_slot); };
if(check_key(KEY_F7)) { if(load_state()) add_msg("State loaded from slot %d", state_slot); };
/* Screen snapshot */
if(check_key(KEY_F8))
{
char name[PATH_MAX];
PALETTE snap_pal;
BITMAP *snap_bmp = create_bitmap_ex(option.video_depth, bitmap.viewport.w, bitmap.viewport.h);
if(snap_bmp)
{
int i;
/* Get current palette */
get_palette(snap_pal);
/* Remove unused palette entries */
for(i = 0x20; i < 0xFE; i++)
snap_pal[i].r = snap_pal[i].g = snap_pal[i].b = 0x00;
/* Clip image */
blit(sms_bmp, snap_bmp, bitmap.viewport.x, bitmap.viewport.y, 0, 0, bitmap.viewport.w, bitmap.viewport.h);
/* Generate file name */
sprintf(name, "snap%04d.pcx", snap_count);
/* Remove unused bits */
if(option.video_depth == 8)
{
int x, y;
for(y = 0; y < bitmap.viewport.h; y++)
for(x = 0; x < bitmap.viewport.w; x++)
putpixel(snap_bmp, x, y, getpixel(snap_bmp, bitmap.viewport.x + x, bitmap.viewport.y + y) & PIXEL_MASK);
}
/* Save snapshot in PCX format */
save_pcx(name, snap_bmp, snap_pal);
/* Deallocate temporary bitmap */
destroy_bitmap(snap_bmp);
/* Bump snapshot counter */
snap_count = (snap_count + 1) & 0xFFFF;
/* Display results */
add_msg("Saved screen to %s", name);
}
}
/* FPS meter toggle */
if(check_key(KEY_F9))
{
option.fps ^= 1;
add_msg("FPS meter %s", option.fps ? "on" : "off");
}
/* Speed throttling */
if(check_key(KEY_F10))
{
if(!option.sound)
{
option.throttle ^= 1;
add_msg("Speed throttling %s", option.throttle ? "on" : "off");
}
}
/* Speed throttling */
if(check_key(KEY_F11))
{
option.vsync ^= 1;
add_msg("VSync %s", option.vsync ? "on" : "off");
}
/* Exit keys */
if(key[KEY_ESC] || key[KEY_END]) running = 0;
//.........这里部分代码省略.........
开发者ID:nworkers,项目名称:smsplus,代码行数:101,代码来源:ui.c
注:本文中的destroy_bitmap函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论