/ zzf / 讨论 / 分享 /

地图模板(更新中)

**

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <windows.h>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include "man.h"
#define traw 5000
#define tlist 5000
#define For(i,l,r) for(int i=l;i<=r;i++)
#define Dor(i,l,r) Dor(int i=l;i>=r;i--)
using namespace std;


struct mapn{
    mapn(){
        memset(con,' ',sizeof(con));
        memset(boo,1,sizeof(boo));
    }
    int  raw;
    int  list;
    char con[traw][tlist];
    int  boo[traw][tlist];
};

mapn main_map;

void appGetXY(int &x,int &y)//获得光标位置
{
    HANDLE hStdout;
    CONSOLE_SCREEN_BUFFER_INFO pBuffer;
    hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
    GetConsoleScreenBufferInfo(hStdout, &pBuffer);
    x=pBuffer.dwCursorPosition.X;
    y=pBuffer.dwCursorPosition.Y;
}
void appGotoXY(int x,int y)//移动光标 
{
    CONSOLE_SCREEN_BUFFER_INFO    csbiInfo;                           
    HANDLE    hConsoleOut;
    hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
    GetConsoleScreenBufferInfo(hConsoleOut,&csbiInfo);
    csbiInfo.dwCursorPosition.X = x;                                   
    csbiInfo.dwCursorPosition.Y = y;                                   
    SetConsoleCursorPosition(hConsoleOut,csbiInfo.dwCursorPosition);   
}

//改变任务坐标 
void chan_cooM(){
    
    drag_map();
    pri_map();
    printf("lalala\n");
    
}

//输出地图
void pri_map(){
    For(i,max(coo_x-10,0),min(coo_x+10,traw)){
        For(j,max(coo_y-20,0),min(coo_y+20,tlist))
            printf("%c",main_map.con[i][j]);
        printf("\n");
    }
} 

//拖拽地图
void drag_map(){
    
}


//人物平移
void chra_tran(){
    appGotoXY(coo_x,coo_y);
    printf(" ");
    int x,y;
    appGetXY(x,y);  
}

//地图初始化
void map_init(){
    For(i,0,main_map.raw)
    For(j,0,main_map.list){
        if((i==main_map.raw|| !i) && (j==main_map.list || !j)) {
            main_map.con[i][j]='+';
            main_map.boo[i][j]=0;
        }else if(i==main_map.raw || !i){
            main_map.con[i][j]='-';
            main_map.boo[i][j]=0;
        }else if(j==main_map.list || !j){
            main_map.con[i][j]='|';
            main_map.boo[i][j]=0;
        }
    }
}

int main(void){
    
    int r,l;
    scanf("%d%d",&main_map.raw,&main_map.list);
     
    main_map.raw++;
    main_map.list++;
    map_init();
    while(1)
    chan_cooM();
}

**

2 条评论

  • @ 2018-11-16 17:38:06
    #include "zzf.h" 
    class grow{
        public:
        ll hp;//生命 
        ll Matt;//特攻 
        ll Mdef;//特防 
        ll Patt;//物攻 
        ll Pdef;//物防 
    };
    class charactor{
        public:
        charactor(){};
        void init(int v,int l);
        char name[M];//名字 
        ll lv;//等级 
        ll hp;//生命 
        ll Matt;//特攻 
        ll Mdef;//特防 
        ll Patt;//物攻 
        ll Pdef;//物防 
        grow now;
    }all[N];
    void charactor::init(int v,int l){
        strcpy(name,all[v].name);
        lv=l;
        hp=all[v].hp+(l-1)*now.hp;
        Matt=all[v].Matt+(l-1)*now.Matt;
        Mdef=all[v].Mdef+(l-1)*now.Mdef;
        Patt=all[v].Patt+(l-1)*now.Patt;
        Pdef=all[v].Pdef+(l-1)*now.Pdef;
    }
    void Ainit(){
        freopen("charactor.in","r",stdin);
        For(i,1,12){
            scanf("%s",all[i].name);
            scanf("%lld%lld%lld%lld%lld%lld",&all[i].lv,&all[i].hp,&all[i].Matt,&all[i].Mdef,&all[i].Patt,&all[i].Pdef);
            scanf("%lld%lld%lld%lld%lld",&all[i].now.hp,&all[i].now.Matt,&all[i].now.Mdef,&all[i].now.Patt,&all[i].now.Pdef);
        }
        fclose(stdin);
    }
    void appGetXY(int &x,int &y)//获得光标位置 
    { 
        HANDLE hStdout;
        CONSOLE_SCREEN_BUFFER_INFO pBuffer; 
        hStdout = GetStdHandle(STD_OUTPUT_HANDLE); 
        GetConsoleScreenBufferInfo(hStdout, &pBuffer); 
        x=pBuffer.dwCursorPosition.X;
        y=pBuffer.dwCursorPosition.Y; 
    }
    void appGotoXY(int x,int y)//移动光标  
    {
        CONSOLE_SCREEN_BUFFER_INFO    csbiInfo;                            
        HANDLE    hConsoleOut;
        hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
        GetConsoleScreenBufferInfo(hConsoleOut,&csbiInfo);
        csbiInfo.dwCursorPosition.X = x;                                    
        csbiInfo.dwCursorPosition.Y = y;                                    
        SetConsoleCursorPosition(hConsoleOut,csbiInfo.dwCursorPosition);   
    }
    void full_screen()
    {
        
    }
    ll rnd(ll l,ll r){
        return rand()%(r-l+1)+l;
    }
    void Init(){    
        system("mode con: cols=80 lines=25");
        system("color 8b");
        full_screen();
        Ainit();    
    }
    void play(){
        char plot[M];
        freopen("plot.in","r",stdin);
        scanf("%s",plot);
        fclose(stdin);
        int len=strlen(plot);
         
    }
    int main(){
    
        srand((int)time(NULL));
        Init();
        
        return 0;
    }
    
  • @ 2018-11-15 19:56:49

    #include <cstdio>
    #include <iostream>
    #include <algorithm>
    #include <cmath>
    #include <vector>
    #include <queue>
    void chan_cooM();//改变角色坐标 
    void chra_tran();//角色平移 
    void drag_map();//拖拽地图 
    void map_init();//初始化地图 
    void pri_map();//输出地图
    void appGotoXY();//移动光标 
    void appGetXY();//获得光标位置
    
    int coo_x=1;
    int coo_y=1;
    char coo=' ';
    
  • 1