⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 join_qiju.cpp

📁 linux下开发的四国军旗源代码,包括客户端和服务器端
💻 CPP
字号:
//###################################################//#Created: LIP//#Description:	The first user_face for JunQi(four country)//#OS :		linux.//#My QQ number: 13066543//#My e_mail: lip94101@btamail.net.cn//####################################################include <stdio.h>#include <stdlib.h>#include <X11/Xlib.h>#include <X11/Xutil.h>#include <X11/Xos.h>#include <X11/Xatom.h>#include <X11/keysym.h>#include <X11/Intrinsic.h>#include "junqi_type.h"#include "const_define.h"extern XChar2b	glb_name_str[32];extern Display *dis;extern Window win;extern GC global_gc;extern XColor green_col;extern XColor blue_col;extern XColor red_col;extern XColor yellow_col;extern XColor orange_col;extern XColor black_col;extern XColor gray_col;extern Colormap colormap;extern XFontStruct *font_info;extern Font	my_font;extern XImage *pbak_image;extern int self_userID;extern int self_qiju_id;extern int self_play_side;extern int run_flag;extern int qi_selected_flag;extern int select_qi_xindex;extern int select_qi_yindex;extern CliUserInfo_s  glb_user_list[MAX_USER_INFO_NUM+1];extern CliQI_Ju_s	glb_qiju_list[MAX_QI_JU_NUM+1];extern char join_qiju_map_flag[15][15];int join_qiju_init_draw();int join_qiju_re_drawall();int join_qiju_draw_chair(int x,int y,int user_index);int join_qiju_draw_table(int table_index);int join_qiju_draw_join_qiju(int userID,int qijuID,int playerID);extern int draw_button_exit();int join_qiju_init_draw(){	XSetForeground(dis,global_gc,gray_col.pixel);	XFillRectangle(dis,win,global_gc,0,0,789,589);	XSetForeground(dis,global_gc,red_col.pixel);	XDrawRectangle(dis,win,global_gc,0,0,789,589);	for(int i=1;i<=MAX_QI_JU_NUM;i++){		join_qiju_draw_table(i);	}	draw_button_exit();	run_flag = RUN_FLAG_SELECT_QIJU;	return 0;}int join_qiju_re_drawall(){	printf("join_qiju_re_drawall called!!!!!!\n");	XSetForeground(dis,global_gc,gray_col.pixel);	XFillRectangle(dis,win,global_gc,0,0,789,589);	XSetForeground(dis,global_gc,red_col.pixel);	XDrawRectangle(dis,win,global_gc,0,0,789,589);	for(int i=1;i<=MAX_QI_JU_NUM;i++){		join_qiju_draw_table(i);	}	draw_button_exit();	return 0;}int join_qiju_draw_chair(int x,int y,int user_index){	XSetForeground(dis,global_gc,black_col.pixel);	XDrawRectangle(dis,win,global_gc,x,y,20,20);	if(user_index==0){		XSetForeground(dis,global_gc,WhitePixel(dis,0));	}	else{		XSetForeground(dis,global_gc,blue_col.pixel);	}	XFillRectangle(dis,win,global_gc,x+1,y+1,18,18);	return 0;}int join_qiju_draw_table(int table_index){	int x,y;	x=90*((table_index-1)%5)+30;	y=((table_index-1)/5)*90+30;	XSetForeground(dis,global_gc,black_col.pixel);	XDrawRectangle(dis,win,global_gc,x,y,30,30);	switch(glb_qiju_list[table_index].state){	case QI_JU_STATE_WAIT_PLAYER:		XSetForeground(dis,global_gc,WhitePixel(dis,0));		break;	case QI_JU_STATE_PLAYER_INIT:		XSetForeground(dis,global_gc,yellow_col.pixel);		break;	case QI_JU_STATE_START_PLAY:		XSetForeground(dis,global_gc,red_col.pixel);		break;	default:		break;	}	XFillRectangle(dis,win,global_gc,x+1,y+1,28,28);	char str_index[8];	memset(str_index,0,sizeof(str_index));	sprintf(str_index,"%d",table_index);	XSetForeground(dis,global_gc,blue_col.pixel);	XDrawString(dis,win,global_gc,x+10,y+20,str_index,strlen(str_index));	if(glb_qiju_list[table_index].user_flag[0]==1){		join_qiju_draw_chair(x+5,y+35,1);	}	else{		join_qiju_draw_chair(x+5,y+35,0);	}	if(glb_qiju_list[table_index].user_flag[1]==1){		join_qiju_draw_chair(x+35,y+5,2);	}	else{		join_qiju_draw_chair(x+35,y+5,0);	}	if(glb_qiju_list[table_index].user_flag[2]==1){		join_qiju_draw_chair(x+5,y-25,3);	}	else{		join_qiju_draw_chair(x+5,y-25,0);	}	if(glb_qiju_list[table_index].user_flag[3]==1){		join_qiju_draw_chair(x-25,y+5,4);	}	else{		join_qiju_draw_chair(x-25,y+5,0);	}	return 0;}int join_qiju_draw_join_qiju(int userID,int qijuID,int playerID){	printf("The join_qiju_draw_join_qiju called userID=%d,qijuID=%d,playerID=%d\n",userID,qijuID,playerID);	glb_user_list[userID].qi_ju_index=qijuID;	glb_user_list[userID].user_state=USER_INFO_STATE_INIT_QI_MAP;	glb_qiju_list[qijuID].user_index[playerID-1]=userID;	glb_qiju_list[qijuID].user_flag[playerID-1]=1;	glb_qiju_list[qijuID].user_num++;	if(glb_qiju_list[qijuID].user_num==4){		glb_qiju_list[qijuID].state=QI_JU_STATE_PLAYER_INIT;	}	join_qiju_draw_table(qijuID);	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -