新版纸牌游戏《小猫钓鱼》设计制作

此游戏设计是我新创制的简单的卡牌游戏。属于儿童益智类游戏,适用于儿童的认知教育。
游戏规则很简单:找配对的牌消去。
游戏设置2个玩家对玩,鱼池置牌21张,玩家每人5张牌,二人轮转钓鱼,每次换牌5张,直到钓满21条鱼。一局连一局,相互竞争,为提高兴趣有小红花助力点赞高分赢家。
基本操作由玩家手控,通过人机互动,达到培养儿童目的。
这设置主要培养儿童的心理素质,在少儿心理的成长和发展阶段,逐步完善心理的感知和认知,意识和思维,注意力和记忆。多玩游戏,在游戏中学习,对儿童少儿心理发展有所裨益。
程序采用扑克牌形式,纸牌标示牌点和牌花色,另有动物图案,此设置能吸引儿童,提高游戏兴趣,达到培养目的。
程序只设置了2例图案,可另行增加图案。
程序有游戏时间设置,有计分设置,此是游戏的考量。有点竞技的味道。

下面是纸牌游戏设计的通用部分:

shuffle_cards ( ){    //  洗牌设计       }
 cardback ( ){    //发牌时隐藏牌面显示牌背图案    }
 transcards ( ){   //传入牌序号num转为牌点和牌花色,画出牌张     }
 print_t ( ){   //打印标题提示等文字 
                      //**  参数:位置 sx ,  sy,字串 t$,文字尺寸 tsize }

我多年程序设计的方法就是崇尚简捷简洁,用最简单的语言写图形界面,设计最简单的算法达到程序要求。卡牌制作和文字显示可作为卡牌游戏程序的通用功能函数。程序设计提供了界面设计图案和文字显示方法,卡牌制作,洗牌设计和定位画出卡牌的方法。
程序设计的是手机界面,代码是用MySpringC编译器在安卓手机上编写的,简单的语言表述,设计思路适用于初学者。可制作成安卓手机桌面app应用程序。程序提供了一个框架,VB ,  VS 或 JAVA  改写可作为参考。
此样例可复制粘贴到编译器直接使用。

 

//以下是源码:
//***********************************************
 //*    纸牌游戏《小猫钓鱼》  Version   1.1.0    
 //*    制作:张纯叔   
 //***********************************************
 Canvas cs ;       //画布
 string sBarDes[10];
 int nBarId[10];
 float src[4];  //ClearDraw (cls) clear screen
 string s,ss,ss1,ss2,ss3 ;     //print ,  test
 string s1,s2,s3,s4,s5,s6,s7,s8,s9 ;  //print text
 int sx,sy,dx,dy,px,py;      //draw
 int i,j,n,t,k;    //t = times
 int num;      //select card number
 int pn ;        //发牌序号数
 int kn ;       //钓鱼计数
 int p1,p2,c1,c2,px1,py1,px2,py2 ;  //找配对
  int pnum[108];    //洗牌后的牌序列(2付牌)
 int cardnum,cardstyle;   //牌点牌花色
 string cas1,cas2,cas4;   //牌点牌花色图案$
 string cas3,cas5 ;            //牌背花色, 下注图案
 double Rn;    //random number
 string t$;     //提示文字
 int tsize;      //textsize
 int isdo ;    //控制操作:  1 可操作 , 0 不可操作
 int context;    //canvasProc
 int obj;
 int id;
 int event;      //canvasProc
 int tim[3];   //get Time & show finished time
  int thh,tmm,tss;
  int oldhh,oldmm,oldss;
  int newhh,newmm,newss;
  int mms;               //show using time
  string hhts,mmts,ssts;
  string ts,ts1,ts2;    
 int round ;
 int score0,score1,total0,total1 ;   //show score
 int mode ;      //设置卡牌花色
 int wnum ;      //切换玩家 2-4
 int nn,wn,sn,en ;    //北西南东牌序号
 int spn[5];     //user south 牌序列
     //int epn[5];     //user east   牌序列
 int npn[5];     //user north 牌序列
     //int wpn[5];    //user west  牌序列
 int ypn[21];    //鱼池  牌序列
 int yn ;
 string sx$[15] ;     //卡牌花色 
main(){
 setDisplay(1);
   cs.SetBackground(0,120,0);
   cs.Active();
   cs.SetProc (context, mycanvasProc);
    sBarDes[0]="重新开始";
    nBarId[0]=100;
    sBarDes[1]="开   局 ";
    nBarId[1]=101;
    sBarDes[2]="换   牌 ";
    nBarId[2]=102;
    sBarDes[3]="切换玩家";
    nBarId[3]=103;
    sBarDes[4]="退出程序";
    nBarId[4]=104;
    sBarDes[5]="📱" ;
    nBarId[5]=105;
    setToolBarHeight(6);
    setButtonTextSize(13);
    setToolBarBackgroundColor(255,0,120,0);
    setButtonColor(255,0,0,240);
    setButtonTextColor(255,255,255,0);
    setToolBar(100,myToolBarProc,sBarDes,nBarId,6);
   setTitle("纸牌游戏-小猫钓鱼   ");
 //**********
     cas3="🐡";       //预设牌背图案   //sx$牌面花色
     cas5="🐹";       //预设图案   
 sx$[1]="🐭" ; sx$[2]="🐮" ; sx$[3]="🐯" ; sx$[4]="🐰" ;
 sx$[5]="🐊" ; sx$[6]="🐍" ; sx$[7]="🦄" ; sx$[8]="🐑" ;
   sx$[9]="🐵" ; sx$[10]="🐓" ; sx$[11]="🐶" ;
 sx$[12]="🐷" ; sx$[13]="🐼" ; sx$[14]="🐻" ;
       drawcover ();
       round=0 ;   kn=0 ;     //start round
       score0=0 ;  score1=0 ;
       total0=0 ;    total1=0 ;    
       isdo=0 ;
  while (){}
   }//main ()drawcover (){     // 画启动界面封面版本号
      cs.SetColor (255,0,120,0);  //back color
      cs.DrawRect (0,0,720,1030);
      cs.SetColor (255,0,250,0);
      cs.DrawRect (50,320,650,326);
      cs.SetColor (255,250,0,0);
      cs.DrawRect (52,322,648,324);
     px=300;    py=90;   //3♠
         num=2 ;   
         transcards ();
     px=390;    py=90;   //3❤
         num=15;    
         transcards ();
     px=480;    py=120;   //9♣
         num=34;    
         transcards ();
      px=570;    py=120;   //9🔶
         num=47;   
         transcards ();
      t$=cas5 ;
      sx=450;   sy=350;    tsize=140;
      print_t ();
      t$="纸牌游戏" ;
      sx=100;   sy=160;   tsize=60;
      print_t ();
      t$="小猫钓鱼" ;
      sx=100;   sy=260;   tsize=80;
      print_t ();
      t$="欢迎加入纸牌游戏团" ;
      sx=135;   sy=440;   tsize=50;
      print_t1 ();
      cs.SetTextStyle (0);    //0正常,1粗体
      ss="Copyright  v.1.1.0  
      cs.SetTextSize (22);
      cs.SetColor (255,250,250,250);
      cs.DrawText (ss,50,360);      
      cs.Update ();
      isdo=0 ;
 }//drawcover ()mycanvasProc (int context,int obj,int id,int event,float x,float y){
        if (isdo==0) return ;
 //纸牌区域点击切换玩家
       cs.SetFillMode (1);//0不填色,1填色   
   if (x>155&&x<560&&y>38&&y<165&&wnum==0){  
        nn=(int)((x-158)/80) ;     //纸牌排列坐标
        num=npn[nn] ;
        if (num>53) num=num-54 ;   //二付牌
        p1=num ;
        c1=(num-num/13*13) ;
        if (num>51) c1=55 ;   //大小王
        px1=nn*80+158 ;    //调整画牌left,top
        py1=38 ;
                  }    //北家 if (x>150&&x<570&&y>810&&y<950&&wnum==1){
        sn=(int)((x-158)/80) ;     //纸牌排列坐标
        num=spn[sn] ;
        if (num>53) num=num-54 ;   //二付牌
        p1=num ;
        c1=(num-num/13*13) ;
        if (num>51) c1=55 ;   //大小王
        px1=sn*80+158 ;    //调整画牌left,top
        py1=815 ;
                   }    //南家   if (x>50&&x<680&&y>300&&y<690){  //鱼池区域
      dx=(int)((x-50)/90) ;     //纸牌排列坐标
      dy=(int)((y-300)/130) ;
          yn= dy*7+dx ;    //还原牌序号
          num=ypn[yn] ;
          if (num>53) num=num-54 ;   //二付牌
          p2=num ;
          c2=(num-num/13*13) ;
          if (num>51) c2=55 ;   //大小王
          px2=dx*90+50 ;    //调整画牌left,top
          py2=dy*130+300;
                   }     //鱼池      catchit () ;   //找配对
  }//mycanvasProc ()catchit (){
    //**** get pair and cut off
    if (c1==c2){
           if (wnum==0){  
               npn[nn]=-2 ;    //防误
               score0=score0+10 ;   
               total0=total0+10 ;  
               px=600 ;   py=50 ;         }
           if (wnum==1){ 
               spn[sn]=-3 ;    //防误
               score1=score1+10 ;   
               total1=total1+10 ;    
               px=600 ;    py=830 ;       }
          cardback () ;     //已钓鱼显示牌背图
              kn=kn+1 ;      //钓鱼计数
      cs.SetColor (255,0,120,0);  //擦除,消牌计分
      cs.DrawRect (px1,py1,px1+81,py1+130);
      cs.DrawRect (px2,py2,px2+81,py2+126);
      cs.Update () ;      
            ypn[yn]=-1 ;       //防误
            c1=-4 ;   c2=-6 ;   p1=-5 ;  p2=-7 ;    //防误
                        }  if (p1>51&&p2>51){    //大小王对 p1 p2 =55
           if (wnum==0){  
               npn[nn]=-2 ;    //防误
               score0=score0+10 ;   
               total0=total0+10 ;   
               px=600 ;   py=50 ;         }
           if (wnum==1){ 
               spn[sn]=-3 ;    //防误
               score1=score1+10 ;   
               total1=total1+10 ;   
               px=600 ;    py=830 ;       }
          cardback () ;
          kn=kn+1 ;
      cs.SetColor (255,0,120,0);  //擦除,消牌计分
      cs.DrawRect (px1,py1,px1+81,py1+130);
      cs.DrawRect (px2,py2,px2+81,py2+126);
      cs.Update () ;      
            ypn[yn]=-1 ;       //防误
            c1=-4 ;    c2=-6 ;   p1=-5 ;  p2=-7 ;    //防误
                       }      
  
    for (k=0;k<21;k++){  //
         px2=(k-k/7*7)*90+50;
         py2=k/7*130+300;
         if (ypn[k]== -1){   //擦除鱼池已消牌
      cs.SetColor (255,0,120,0);  
      cs.DrawRect (px2,py2,px2+81,py2+126);
            cs.Update () ;    }
                     }    cs.SetFillMode (1);//0不填色,1填色
 //**** show test print 算法测试调试,可注释掉 
     cs.SetTextSize (22);
     cs.SetColor(255,0,130,0); 
     cs.DrawRect (0,960,718,1020);  // clear print
     cs.SetColor(255,0,250,0); 
        s2="用牌pn = "+intToString (pn) ;
                cs.DrawText (s2,5,980) ;
         s3="pnum= "+intToString (num) ;
               cs.DrawText (s3,240,980) ;        s4="p2 = "+intToString (p2) ;
              cs.DrawText (s4,140,1010) ;
         s5="c2 = "+intToString (c2) ;
              cs.DrawText (s5,240,1010) ;
         s6="p1 = "+intToString (p1) ;
              cs.DrawText (s6,340,1010) ;
         s7="c1 = "+intToString (c1) ;
              cs.DrawText (s7,440,1010) ;
         s8="nn = "+intToString (nn) ;
              cs.DrawText (s8,540,980) ;
         s9="sn = "+intToString (sn) ;
              cs.DrawText (s9,540,1010) ;
         ss2="yu = "+intToString (yn) ;
              cs.DrawText (ss2,640,1010) ;
        ss1="已钓kn = "+intToString (kn) ;
              cs.DrawText (ss1,5,1010) ;
   //显示局数,得分
     cs.SetColor(255,0,120,0); 
     cs.DrawRect (0,35,155,250);  // clear print
     cs.DrawRect (0,730,155,930);  // clear print
         t$=ts ;    //show start time
         sx=15;   sy=25;   tsize=24;
             print_t ();   
         t$="第 "+intToString (round)+" 局" ;    
         sx=15;   sy=70;   tsize=32;
             print_t1 ();   
         t$="总分:"+intToString (total0) ;    //北家
         sx=15;   sy=115;   tsize=26;
             print_t ();   
         t$="得分:"+intToString (score0) ;    
         sx=15;   sy=160;   tsize=26;
             print_t ();   
         t$="总分:"+intToString (total1) ;    //南家
         sx=15;   sy=845;   tsize=26;
             print_t ();   
         t$="得分:"+intToString (score1) ;    
         sx=15;   sy=890;   tsize=26;
             print_t ();   
         cs.Update () ; //****  核验钓鱼是否完成
      if (kn==21) {    //已钓鱼21条
          t$="钓鱼完成  🐠" ;
          sx=140;   sy=390;   tsize=80;
          print_t ();   
          t$="钓鱼完成 >   下一局  >    开局" ;
          sx=140;   sy=600;   tsize=36;
          print_t ();   
    showtimes () ;   //finished & show times
          t$=ts1 ;
          sx=200;   sy=490;   tsize=40;
              print_t ();   
          t$=ts2 ;
          sx=200;   sy=530;   tsize=40;
              print_t ();   
         //print 最后得分
         t$="总分:"+intToString (total0) ;    
         sx=15;   sy=115;   tsize=26;
             print_t ();   
         t$="得分:"+intToString (score0) ;    
         sx=15;   sy=160;   tsize=26;
             print_t ();   
         t$="总分:"+intToString (total1) ;    
         sx=15;   sy=845;   tsize=26;
             print_t ();   
         t$="得分:"+intToString (score1) ;    
         sx=15;   sy=890;   tsize=26;
             print_t ();   
          isdo=0 ;    
                     }
         if (total0>total1){    //北家
              t$="🌷";  sx=15;   sy=230;   tsize=50;
             print_t ();       }
         if (total1>total0){    //南家
              t$="🌷";  sx=15;   sy=780;   tsize=50;
              print_t ();       }}//catchit ()

卡牌游戏源码 Java 原创卡牌游戏_经验分享

卡牌游戏源码 Java 原创卡牌游戏_经验分享_02

 

 

set_mode (){    //设置2种卡牌花色
        mode=mode+1 ;  
   if (mode>1) mode=0 ;
       cs.SetColor (255,0,120,0);   //backcolor
       cs.DrawRect (0,0,720,1030);
    shuffle_cards () ;
         t$="纸牌游戏 >>  选择卡牌花色,洗牌验牌,开始游戏" ;
         sx=20;   sy=40;   tsize=30;
         print_t ();
    for (k=0;k<108;k++){    //显示卡牌花色
         px=(k-k/9*9)*78+8;
         py=k/9*70+90;
         num=pnum[k] ;    // 显示已洗牌序列
         transcards () ;      
                }
   //**** renew and start ****
           nn=0 ;   npn[nn]=0 ;  
           sn=0 ;   spn[sn]=0 ;  
           yn=0 ;   ypn[yn]=0 ;  
       round=0 ;     //start round
       score0=0 ;  score1=0 ;
       total0=0 ;    total1=0 ;    
            isdo=0 ;
 }//set_mode ()

卡牌游戏源码 Java 原创卡牌游戏_卡牌游戏源码 Java_03

 

//纸牌序列:
 //cardP num   0 to 12 黑桃 A234..JQK
 //cardP num 13 to 25 红心 A234..JQK
 //cardP num 26 to 38 梅花 A234..JQK
 //cardP num 39 to 51 方块 A234..JQK
 //52 大王  53 小王
 // VB6,VS2007 编程:设picturebox: 
 // cardP(54)图片数组
 // 图片高宽为单张纸牌图大小
 // 预制扑克牌序列图片底图,程序启动时按序将
 // 每单张图片BitBlt..SRCCOPY到图片数组,
 // cardP (i)就是整付牌的图片,洗牌发牌都要用到。
 // 本程序简化用 num 序号表示54张牌
 //********************
 //如果鱼池21张牌同点数超过2张,
 //一付牌就钓不完鱼,故宜用二付牌。
 //二付牌一起洗牌也可能造成
 //同点数牌超4张集中在鱼池起首21张,此情况较少,
 //则可前后二付牌分开洗牌。shuffle_cards (){    //洗牌设计
      cs.SetColor (255,0,120,0);   //backcolor
      cs.DrawRect (0,0,720,1030);
      cs.Update ();
       for (i=0;i<108;i++){ pnum[i]= -1  ;  }
       pn=0;  
 //*** * 洗牌 **********************
   for (i=0;i<108;i++){    //洗牌, 54 ->108二付牌
       ResetPiece:        //已生成牌有相同则重新生成
       Rn=random()*108;  //随机洗牌, 54 一付牌
              num=(int )(Rn);
              pnum[i]=num ;
          for (k=0;k<i; k++){
          if (num==pnum[k]) goto ResetPiece ;        }
                     }   for (k=0;k<108;k++){  //显示牌背面图案
         px=(k-k/9*9)*78+8;
         py=k/9*70+90;
     //cardback ();  //洗牌后可显示牌背或不显示
    num=pnum[k] ;
   //transcards ();  //用于洗牌查验测试,游戏时注释掉
           }
  }//shuffle_cards ()start (){    //开始游戏,先发中间鱼池21张
       cs.SetColor (255,0,120,0);   //backcolor
       cs.DrawRect (0,0,720,1030);
       cs.SetColor (255,0,160,160);   //backcolor
       cs.DrawRect (30,290,690,700);
          t$="纸牌游戏 >>     开局" ;
           sx=50;   sy=250;   tsize=30;
           print_t ();
           cs.Update () ;
    for (k=0;k<21;k++){  //显示牌面图案
         pn=k ;    yn=k ;
         ypn[yn]=pnum[pn]; 
         num=pnum[pn] ;
         px=(k-k/7*7)*90+50;
         py=k/7*130+310;    
             sleep (200) ;
         transcards ();                }
    
      // pn=20 ; 已发21张牌
     for (k=0;k<5;k++){  //玩家各发5张牌
         pn=pn+1 ;  nn=k ;
         npn[nn]=pnum[pn];  
         num=npn[nn];  
         px=nn*80+160 ;   //set position
         py=50;   //北家  
         transcards ();     
              sleep (200) ;
         pn=pn+1 ;  sn=k ;
         spn[sn]=pnum[pn];  
         num=spn[sn];  
         px=sn*80+160 ;   //set position
         py=830;   //南家  
         transcards ();         } //玩家5圈牌      cs.SetColor (255,0,120,0);   //clear print
       cs.DrawRect (2,210,310,260);
            round=round+1 ;
            score0=0 ;  score1=0 ;
            wnum=0 ;    kn=0 ;
            yn=-1 ;   
            c1=-4 ; c2=-6 ; p1=-5 ; p2=-7 ;  //防误
            isdo=1 ;
   getTime (tim);      //取得系统时间
        oldhh=tim[0];
        oldmm=tim[1];
        oldss=tim[2];
    hhts=intToString (tim[0]);
    mmts=intToString (tim[1]);
    ssts=intToString (tim[2]);
    if (oldhh<10)hhts="0"+hhts;
    if (oldmm<10)mmts="0"+mmts;
    if (oldss<10)ssts="0"+ssts;
        ss2=hhts+" : "+mmts+" : "+ssts;
    ts="开始 >  "+ss2;   //show start time
        change_id () ;      //玩家
        catchit () ;     //显示局数及其他
 }//start ()

卡牌游戏源码 Java 原创卡牌游戏_卡牌游戏源码 Java_04

卡牌游戏源码 Java 原创卡牌游戏_c语言_05

 

 

deal (){    //补牌换牌:游戏中换牌
        if (isdo==0) return ;
    if (wnum==0){    //北家换牌
     cs.SetColor(255,0,120,0); 
     cs.DrawRect (158,38,562,165);  
             cs.Update () ;
             sleep (200) ;
     for (k=0;k<5;k++){  //显示牌面图案
         pn=pn+1 ;  nn=k ;
         if (pn>107) { pn= 0 ;    }   //二付牌发完
         npn[nn]=pnum[pn];  
         num=npn[nn];  
         px=nn*80+160 ;   //set position
         py=50;   //北家  
            sleep (200) ;
         transcards ();     
                    }     }
    if (wnum==1){    //南家换牌
     cs.SetColor(255,0,120,0); 
     cs.DrawRect (158,810,562,960);  
             cs.Update () ;
             sleep (200) ;
     for (k=0;k<5;k++){  //显示牌面图案
         pn=pn+1 ;  sn=k ;
         if (pn>107) { pn= 0 ;      }   //二付牌发完
         spn[sn]=pnum[pn];  
         num=spn[sn];  
         px=sn*80+160 ;   //set position
         py=830;   //南家  
             sleep (200) ;
         transcards ();     
                    }     }
         catchit () ;    //显示调试信息
 }//deal ()

卡牌游戏源码 Java 原创卡牌游戏_c语言_06

 

transcards (){  //num 转换 cardnum, cardstyle
 //牌序号转为牌点和牌花色,传入px,py 画出牌张
 //此为游戏通用设置,启动界面画牌
        if (num==-1) return ;
        if (num>53) num=num-54 ;    //二付牌
     //**** draw cards 圆角 ****
       cs.SetTextStyle (0);    //0正常,1粗体
       cs.SetColor (255,250,160,0);  //框线
       cs.DrawRect (px+10,py-10,px+68,py+115);
       cs.DrawRect (px,py-1,px+79,py+104);
       cs.DrawCircle (px+10,py,9);
       cs.DrawCircle (px+10,py+105,9);
       cs.DrawCircle (px+69,py+105,9);
       cs.DrawCircle (px+69,py,9);
       cs.SetColor (255,250,250,250);  //牌面白色
       cs.DrawRect (px+13,py-8,px+65,py+113);
       cs.DrawRect (px+2,py,px+76,py+103);
       cs.DrawCircle (px+12,py+2,10);
       cs.DrawCircle (px+12,py+103,10);
       cs.DrawCircle (px+66,py+103,10);
       cs.DrawCircle (px+66,py+2,10);
      //******* 画出牌面
         cardnum=(num-num/13*13)+1;
         cardstyle=num/13;
         cas1=intToString(cardnum);
         if(cardnum==1) cas1="A";
         if(cardnum==11) cas1="J";
         if(cardnum==12) cas1="Q";
         if(cardnum==13) cas1="K";
         if (cardstyle==0) cas2="♠";
         if (cardstyle==1) cas2="❤";
         if (cardstyle==2) cas2="♣";
         if (cardstyle==3) cas2="🔶";
    if (num>51){ cas2="  " ;  cas1="  " ;  } //大小王
      if(cardstyle==0||cardstyle==2) {
             cs.SetColor (255,0,0,0);     }
      if(cardstyle==1||cardstyle==3) {
             cs.SetColor (255,250,0,0);      }
      cs.SetTextSize (30);
      n=0;
      if (cardnum==10) n=8;           
      cs.DrawText (cas1,px+14-n,py+20);
      cs.DrawText (cas2,px+5,py+50);        
           cs.SetTextSize (26);
      if (mode==0) cas4="🐠" ;      //牌面图案
      if (mode==1) cas4=sx$[cardnum] ;
         if (num==52){  //大王
      cs.SetColor(255,255,0,0) ;
      cs.DrawText ("Joker",px+5,py+30);    
         cas4="🐋" ;      }
         if (num==53){   //小王
      cs.SetColor(255,0,0,0) ;
      cs.DrawText ("Joker",px+5,py+30);      
          cas4="🐬" ;   }  
         cs.SetTextSize (48);      //牌面图
         cs.DrawText (cas4,px+14,py+95);
      cs.Update ();
 }//transcards ()cardback (){   //draw cards back picture
 //发牌时隐藏牌面显示牌背图案
     if (num==-1) return ;
     //**** draw cards 圆角 ****
       cs.SetColor (255,250,160,0);  //框线
       cs.DrawRect (px+10,py-10,px+68,py+115);
       cs.DrawRect (px,py-1,px+79,py+104);
       cs.DrawCircle (px+10,py,9);
       cs.DrawCircle (px+10,py+105,9);
       cs.DrawCircle (px+69,py+105,9);
       cs.DrawCircle (px+69,py,9);
       cs.SetColor (255,0,180,200);  //牌背色
       cs.DrawRect (px+13,py-8,px+65,py+113);
       cs.DrawRect (px+2,py,px+76,py+103);
       cs.DrawCircle (px+12,py+2,10);
       cs.DrawCircle (px+12,py+103,10);
       cs.DrawCircle (px+66,py+103,10);
       cs.DrawCircle (px+66,py+2,10);
       cs.SetTextSize(50);
       cs.DrawText (cas3,px+8,py+70);  //show 背花
       cs.Update ();
 }//cardback ()change_id (){   //切换玩家 id
       cs.SetColor (255,0,160,0);   //clear 
            cs.DrawCircle (360,220,25);
            cs.DrawCircle (360,760,25);
       wnum=wnum+1 ;
       if (wnum>1) wnum=0 ;
       cs.SetTextSize (46);
       if (wnum==0)  cs.DrawText ("🔺",333,228);
       if (wnum==1)  cs.DrawText ("🔻",334,782);
     cs.Update ();
 }//change_id ()showtimes (){    //计算使用时间
       getTime (tim);
       newhh=tim[0];
       newmm=tim[1];
       newss=tim[2];
       hhts=intToString (tim[0]);
       mmts=intToString (tim[1]);
       ssts=intToString (tim[2]);
       if (newhh<10)hhts="0"+hhts;    //格式00:00:00
       if (newmm<10)mmts="0"+mmts;
       if (newss<10)ssts="0"+ssts;
  mms=((newhh-oldhh)*3600)+
         ((newmm-oldmm)*60)+((newss-oldss));    
     if (mms<0) mms=mms+864000;
         thh=mms/3600;
         tmm=(mms-thh*2600)/60;
         tss=mms-thh*3600-tmm*60;
  ss1=intToString (tmm)+" 分  "+intToString (tss)+" 秒";
  ss2=hhts+" : "+mmts+" : "+ssts;
       ts1= "完成 >  "+ss2;      //输出
       ts2= "用时 >   "+ss1;     //输出
  }//showtimes ()print_t (){   //打印标题提示等文字
 //**  参数 sx,sy, ss0=$, tsize=text size   
  cs.SetFillMode (1);//0不填色,1填色
     cs.SetTextStyle (0);    //0正常,1粗体
  cs.SetTextSize (tsize);
     cs.SetColor (255,0,200,60);
  cs.DrawText (t$,sx+2,sy+3);
     cs.SetColor (255,250,120,0);
  cs.DrawText (t$,sx,sy);
  cs.SetFillMode (0);//0不填色,1填色
     cs.SetColor (255,250,250,0);
  cs.DrawText (t$,sx,sy);
  cs.SetFillMode (1);//0不填色,1填色
       cs.Update ();
 }//print _t ()print_t1 (){   //打印标题提示等文字
 //**  参数 sx,sy, ss0=$, tsize=text size   
   cs.SetFillMode (1);//0不填色,1填色
     cs.SetTextStyle (1);    //0正常,1粗体
   cs.SetTextSize (tsize);
     cs.SetColor (255,0,20,100);
  cs.DrawText (t$,sx+3,sy+4);
     cs.SetColor (255,0,250,0);
  cs.DrawText (t$,sx,sy);
  cs.SetFillMode (0);//0不填色,1填色
     cs.SetColor (255,250,0,0);
  cs.DrawText (t$,sx,sy);
  cs.SetFillMode (1);//0不填色,1填色
       cs.Update ();
 }//print _t1 ()myToolBarProc(int nBtn,int nContext){
       if(nBtn==100){  // 卡牌花色
            setDisplay (1);
            set_mode () ;
               }  
       if(nBtn==101){  // 开始摸鱼
            setDisplay (1);
            shuffle_cards () ;    //洗牌
            start () ;                    //开始
                }
       if(nBtn==102){  //换牌
             setDisplay (1);
             deal () ;
                 }
       if(nBtn==103){//
            setDisplay (1);
             change_id () ;
                 }
       if(nBtn==104){//退出程序
            clearOutput();
            cs.ClearDraw (0,src);
            setDisplay (0);
            exit (0);
                }
      if(nBtn==105){//@About
            setDisplay (1);
            drawcover ();
                    }
 }//myToolBar () // 纸牌游戏《小猫钓鱼》V.1.1.0   设计制作
 // 2022年11月15日完成于上海 
//**** End ****