vc++如何调用图片
#include<stdio.h>#include<conio.h>
#include<stdlib.h>
#include<iostream>
#include <windows.h>
int IMAGE,Nothing,Wall,End,Box,human,DBox;
//#define N 450;
//#define M 330;
int map[11][15]={
{0,0,0,0,1,1,1,1,1,0,0,1,1,1,1},
{0,0,0,0,1,0,0,0,1,0,0,1,3,3,1},
{0,0,0,0,1,4,0,0,1,1,0,1,3,3,1},
{0,0,1,1,1,0,0,4,0,1,0,1,0,0,1},
{1,1,1,0,0,0,1,1,0,1,0,1,0,0,1},
{1,0,0,0,0,0,1,1,0,1,1,1,0,0,1},
{1,0,4,0,0,4,0,0,0,0,0,5,0,0,1},
{1,1,1,1,1,0,1,1,1,0,1,0,0,0,1},
{0,0,0,0,1,0,0,0,0,0,1,1,1,1,1},
{0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
};
void inttgame()
{
loadimage(&Nothing,L"./4/blank.jpg",30,30);
}
void d_map()
{int i,j;
for(i=0;i<11;i++)
{
for(j=0;j<15;j++)
{
switch(map[i][j])
{
case 0:
printf(" ");
break;
case 1:
printf("■");
break;
case 3:
printf("◎");
break;
case 4:
printf("△");
break;
case 5:
printf("♀");
break;
case 7:
printf("◆");
break;
case 8:
printf("♀");
break;
}
}
printf("\n");
}
}
void play()
{
int ch;
int x,y,i,j;
ch=getch();
for(i=0;i<11;i++)
{
for(j=0;j<15;j++)
{
if(map[i][j]==5||map[i][j]==8)
{
x=i;
y=j;
}
}
}
switch(ch)
{
case 'a':
case 'A':
if(map[x][y-1]==0||map[x][y-1]==3)
{
map[x][y]-=5;
map[x][y-1]+=5;
}
else if(map[x][y-1]==4||map[x][y-1]==7)
{
if(map[x][y-2]==3||map[x][y-2]==0)
{
map[x][y]-=5;
map[x][y-1]+=1;
map[x][y-2]+=4;
}
}
break;
case 'd':
case 'D':
if(map[x][y+1]==0||map[x][y+1]==3)
{
map[x][y]-=5;
map[x][y+1]+=5;
}
else if(map[x][y+1]==4||map[x][y+1]==7)
{
if(map[x][y+2]==3||map[x][y+2]==0)
{
map[x][y]-=5;
map[x][y+1]+=1;
map[x][y+2]+=4;
}
}
break;
case 'w':
case 'W':
if(map[x-1][y]==0||map[x-1][y]==3)
{
map[x][y]-=5;
map[x-1][y]+=5;
}
else if(map[x-1][y]==4||map[x-1][y]==7)
{
if(map[x-2][y]==3||map[x-2][y]==0)
{
map[x][y]-=5;
map[x-1][y]+=1;
map[x-2][y]+=4;
}
}
break;
case 's':
case 'S':
if(map[x+1][y]==0||map[x+1][y]==3)
{
map[x][y]-=5;
map[x+1][y]+=5;
}
else if(map[x+1][y]==4||map[x+1][y]==7)
{
if(map[x+2][y]==3||map[x+2][y]==0)
{
map[x][y]-=5;
map[x+1][y]+=1;
map[x+2][y]+=4;
}
}
break;
}
}
int main()
{
while(1)
{
int a;
system("cls");
d_map();
if(map[1][12]==7&&map[1][13]==7&&map[2][12]==7&&map[2][12]==7)
{
printf("666恭喜你通关\n按任意键结束\n");
break;
}
play();
}
return 0;
}