| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1472 人关注过本帖
标题:vc++如何调用图片
只看楼主 加入收藏
c905186546
Rank: 2
等 级:论坛游民
帖 子:5
专家分:20
注 册:2017-11-2
结帖率:0
收藏
 问题点数:0 回复次数:2 
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;
}
搜索更多相关主题的帖子: map case printf break || 
2018-03-22 20:05
花脸
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:9
帖 子:788
专家分:907
注 册:2017-1-4
收藏
得分:0 
https://blog.
2018-03-24 21:55
ab1412
Rank: 7Rank: 7Rank: 7
来 自:M78星球
等 级:黑侠
威 望:4
帖 子:103
专家分:537
注 册:2018-3-15
收藏
得分:0 
首先你要有EASYX,不然你那些函数都没法用
其次里面用到的那些图片你要有,不然运行不了这个程序

printf("萌新一枚,请多指教");
2018-03-30 00:27
快速回复:vc++如何调用图片
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034642 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved