C++ [项目] 飞机大战

news2024/10/23 18:35:31

现在才发现C++游戏的支持率这么高,那就发几篇吧

一、基本介绍

        支持Dev-C++5.11版本(务必调为英文输入法),基本操作看游戏里的介绍,怎么做的……懒得说,能看懂就看注释,没有的自己猜,如果你很固执……私我吧

二、代码部分

/*=============== 2024.8.13=========================*/
#include<iostream>
#include<windows.h>
#include<conio.h>
#include<time.h>
#include<string>
#include<cstring>
#define long long long
using namespace std;
bool flag;
int xxx=1,scorecc,score;
string title,titlecc;
/*=============== all the structures ===============*/
 
typedef struct Frame {
	COORD position[2];
	int flag;
} Frame;
 
 
/*=============== all the functions ===============*/
 
void SetPos(COORD a) { // set cursor
	HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(out, a);
}
 
void SetPos(int i, int j) { // set cursor
	COORD pos= {i, j};
	SetPos(pos);
}
 
void HideCursor() {
	CONSOLE_CURSOR_INFO cursor_info = {1, 0};
	SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
 
//把第y行,[x1, x2) 之间的坐标填充为 ch
void drawRow(int y, int x1, int x2, char ch) {
	SetPos(x1,y);
	for(int i = 0; i <= (x2-x1); i++)
		cout<<ch;
}
 
//在a, b 纵坐标相同的前提下,把坐标 [a, b] 之间填充为 ch
void drawRow(COORD a, COORD b, char ch) {
	if(a.Y == b.Y)
		drawRow(a.Y, a.X, b.X, ch);
	else {
		SetPos(0, 25);
		cout<<"error code 01:无法填充行,因为两个坐标的纵坐标(x)不相等";
		system("pause");
	}
}
 
//把第x列,[y1, y2] 之间的坐标填充为 ch
void drawCol(int x, int y1, int y2, char ch) {
	int y=y1;
	while(y!=y2+1) {
		SetPos(x, y);
		cout<<ch;
		y++;
	}
}
 
//在a, b 横坐标相同的前提下,把坐标 [a, b] 之间填充为 ch
void drawCol(COORD a, COORD b, char ch) {
	if(a.X == b.X)
		drawCol(a.X, a.Y, b.Y, ch);
	else {
		SetPos(0, 25);
		cout<<"error code 02:无法填充列,因为两个坐标的横坐标(y)不相等";
		system("pause");
	}
}
 
//左上角坐标、右下角坐标、用row填充行、用col填充列
void drawFrame(COORD a, COORD  b, char row, char col) {
	drawRow(a.Y, a.X+1, b.X-1, row);
	drawRow(b.Y, a.X+1, b.X-1, row);
	drawCol(a.X, a.Y+1, b.Y-1, col);
	drawCol(b.X, a.Y+1, b.Y-1, col);
}
 
void drawFrame(int x1, int y1, int x2, int y2, char row, char col) {
	COORD a= {x1, y1};
	COORD b= {x2, y2};
	drawFrame(a, b, row, col);
}
 
void drawFrame(Frame frame, char row, char col) {
	COORD a = frame.position[0];
	COORD b = frame.position[1];
	drawFrame(a, b, row, col);
}
 
void drawPlaying() {
	drawFrame(0, 0, 48, 24, '=', '|');//    draw map frame;
	drawFrame(49, 0, 79, 4, '-', '|');//        draw output frame
	drawFrame(49, 4, 79, 9, '-', '|');//        draw score frame
	drawFrame(49, 9, 79, 20, '-', '|');//    draw operate frame
	drawFrame(49, 20, 79, 24, '-', '|');//    draw other message frame
	SetPos(52, 6);
	cout<<"得分:";
	SetPos(52, 7);
	cout<<"称号:";
	SetPos(52,10);
	cout<<"操作方式:";
	SetPos(52,12);
	cout<<"  a,s,d,w 控制战机移动。";
	SetPos(52,14);
	cout<<"  p 暂停游戏。";
	SetPos(52,16);
	cout<<"  e 退出游戏。";
	SetPos(52,18);
	cout<<"  k 发射子弹。" ;
}
 
//在[a, b)之间产生一个随机整数
int random(int a, int b) {
	int c=(rand() % (a-b))+ a;
	return c;
}
 
//在两个坐标包括的矩形框内随机产生一个坐标
COORD random(COORD a, COORD b) {
	int x=random(a.X, b.X);
	int y=random(a.Y, b.Y);
	COORD c= {x, y};
	return c;
}
 
bool  judgeCoordInFrame(Frame frame, COORD spot) {
	if(spot.X>=frame.position[0].X)
		if(spot.X<=frame.position[1].X)
			if(spot.Y>=frame.position[0].Y)
				if(spot.Y<=frame.position[0].Y)
					return true;
	return false;
}
 
void printCoord(COORD a) {
	cout    <<"( "<<a.X<<" , "<<a.Y<<" )";
}
 
void printFrameCoord(Frame a) {
	printCoord(a.position[0]);
	cout    <<" - ";
	printCoord(a.position[1]);
}
 
 
DWORD WINAPI MusicFun(LPVOID lpParamte) {
	return 0;
}
DWORD WINAPI BulletShot(LPVOID lpParamte) {
	return 0;
}
DWORD WINAPI StartStage(LPVOID lpParamte) {
	return 0;
}
int drawMenu() {
	HANDLE MFUN;
	MFUN= CreateThread(NULL, 0, StartStage, NULL, 0, NULL);
	SetPos(30, 1);
	cout<<"P l a n e  W a r";
	drawRow(3, 0, 79, '-');
	drawRow(5, 0, 79, '-');
	SetPos(28, 4);
	cout<<"w 和 s 选择, k 确定";
	SetPos(15, 11);
	cout<<"1. 简单的敌人";
	SetPos(15, 13);
	cout<<"2. 冷酷的敌人";
	drawRow(20, 0, 79, '-');
	drawRow(22, 0, 79, '-');
	SetPos(47, 11);
	cout<<"简单的敌人:";
	SetPos(51, 13);
	cout<<"简单敌人有着较慢的移动速度。";
	SetPos(28, 21);
	cout<<"制作:一只水饺吖<*)))><<";
	int j=11;
	SetPos(12, j);
	cout<<">>";
 
	drawFrame(46, 9, 89, 17, '=', '|');
 
	while(1) {
		if( _kbhit() ) {
			char x=_getch();
			switch (x) {
				case 'w' : {
					if( j == 13) {
						SetPos(12, j);
						cout<<" ";
						j = 11;
						SetPos(12, j);
						cout<<">>";
						SetPos(51, 13);
						cout<<"            ";
						SetPos(47, 11);
						cout<<"简单的敌人:";
						SetPos(51, 13);
						cout<<"简单敌人有着较慢的移动速度,容易对付。";
					}
					break;
				}
				case 's' : {
					if( j == 11 ) {
						SetPos(12, j);
						cout<<" ";
						j = 13;
						SetPos(12, j);
						cout<<">>";
						SetPos(51, 13);
						cout<<"              ";
						SetPos(47, 11);
						cout<<"冷酷的敌人:";
						SetPos(51, 13);
						cout<<"冷酷的敌人移动速度较快,难对付哟!!!";
					}
					break;
				}
				case 'k' : {
					if (j == 8)    return 1;
					else return 2;
				}
			}
		}
	}
}
 
/*================== the Game Class ==================*/
 
class Game {
	public:
		COORD position[10];
		COORD bullet[10];
		Frame enemy[8];
		//int score;
		int rank;
		int rankf;
		//string title;
		int flag_rank;
 
		Game ();
 
		//初始化所有
		void initPlane();
		void initBullet();
		void initEnemy();
 
		//初始化其中一个
		//void initThisBullet( COORD );
		//void initThisEnemy( Frame );
 
		void planeMove(char);
		void bulletMove();
		void enemyMove();
 
		//填充所有
		void drawPlane();
		void drawPlaneToNull();
		void drawBullet();
		void drawBulletToNull();
		void drawEnemy();
		void drawEnemyToNull();
 
		//填充其中一个
		void drawThisBulletToNull( COORD );
		void drawThisEnemyToNull( Frame );
 
		void Pause();
		void Playing();
		void judgePlane();
		void judgeEnemy();
 
		void Shoot();
 
		void GameOver();
		void printScore();
};
 
Game::Game() {
	initPlane();
	initBullet();
	initEnemy();
	score = 0;
	rank = 25;
	rankf = 0;
	flag_rank = 0;
}
 
void Game::initPlane() {
	COORD centren= {39, 22};
	position[0].X=position[5].X=position[7].X=position[9].X=centren.X;
	position[1].X=centren.X-2;
	position[2].X=position[6].X=centren.X-1;
	position[3].X=position[8].X=centren.X+1;
	position[4].X=centren.X+2;
	for(int i=0; i<=4; i++)
		position[i].Y=centren.Y;
	for(int i=6; i<=8; i++)
		position[i].Y=centren.Y+1;
	position[5].Y=centren.Y-1;
	position[9].Y=centren.Y-2;
}
 
void Game::drawPlane() {
	for(int i=0; i<9; i++) {
		SetPos(position[i]);
		if(i!=5)
			cout<<"O";
		else if(i==5)
			cout<<"|";
	}
}
 
void Game::drawPlaneToNull() {
	for(int i=0; i<9; i++) {
		SetPos(position[i]);
		cout<<" ";
	}
}
 
void Game::initBullet() {
	for(int i=0; i<10; i++)
		bullet[i].Y = 30;
}
 
void Game::drawBullet() {
	for(int i=0; i<10; i++) {
		if( bullet[i].Y != 30) {
			SetPos(bullet[i]);
			cout<<"^";
		}
	}
}
 
void Game::drawBulletToNull() {
	for(int i=0; i<10; i++)
		if( bullet[i].Y != 30 ) {
			COORD pos= {bullet[i].X, bullet[i].Y+1};
			SetPos(pos);
			cout<<" ";
		}
}
 
void Game::initEnemy() {
	COORD a= {1, 1};
	COORD b= {45, 15};
	for(int i=0; i<8; i++) {
		enemy[i].position[0] = random(a, b);
		enemy[i].position[1].X = enemy[i].position[0].X + 3;
		enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
	}
}
 
void Game::drawEnemy() {
	for(int i=0; i<8; i++)
		drawFrame(enemy[i].position[0], enemy[i].position[1], '-', '|');
}
 
void Game::drawEnemyToNull() {
	for(int i=0; i<8; i++) {
		drawFrame(enemy[i].position[0], enemy[i].position[1], ' ', ' ');
	}
}
 
void Game::Pause() {
	SetPos(61,2);
	cout<<"               ";
	SetPos(61,2);
	cout<<"暂停中...";
	HANDLE MFUN;
	MFUN= CreateThread(NULL, 0, BulletShot, NULL, 0, NULL);
	char c=_getch();
	while(c!='p')
		c=_getch();
	SetPos(61,2);
	cout<<"         ";
	MFUN= CreateThread(NULL, 0, MusicFun, NULL, 0, NULL);
}
 
void Game::planeMove(char x) {
	if(x == 'a')
		if(position[1].X != 1)
			for(int i=0; i<=9; i++)
				position[i].X -= 2;
 
	if(x == 's')
		if(position[7].Y != 23)
			for(int i=0; i<=9; i++)
				position[i].Y += 1;
 
	if(x == 'd')
		if(position[4].X != 47)
			for(int i=0; i<=9; i++)
				position[i].X += 2;
 
	if(x == 'w')
		if(position[5].Y != 3)
			for(int i=0; i<=9; i++)
				position[i].Y -= 1;
}
 
void Game::bulletMove() {
	for(int i=0; i<10; i++) {
		if( bullet[i].Y != 30) {
			bullet[i].Y -= 1;
			if( bullet[i].Y == 1 ) {
				COORD pos= {bullet[i].X, bullet[i].Y+1};
				drawThisBulletToNull( pos );
				bullet[i].Y=30;
			}
 
		}
	}
}
 
void Game::enemyMove() {
	for(int i=0; i<8; i++) {
		for(int j=0; j<2; j++)
			enemy[i].position[j].Y++;
 
		if(24 == enemy[i].position[1].Y) {
			COORD a= {1, 1};
			COORD b= {45, 3};
			enemy[i].position[0] = random(a, b);
			enemy[i].position[1].X = enemy[i].position[0].X + 3;
			enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
		}
	}
}
 
void Game::judgePlane() {
	for(int i = 0; i < 8; i++)
		for(int j=0; j<9; j++)
			if(judgeCoordInFrame(enemy[i], position[j])) {
				SetPos(62, 1);
				cout<<"坠毁";
				drawFrame(enemy[i], '+', '+');
				Sleep(1000);
				GameOver();
				break;
			}
 
}
 
void Game::drawThisBulletToNull( COORD c) {
	SetPos(c);
	cout<<" ";
}
 
void Game::drawThisEnemyToNull( Frame f ) {
	drawFrame(f, ' ', ' ');
}
 
void Game::judgeEnemy() {
	for(int i = 0; i < 8; i++)
		for(int j = 0; j < 10; j++)
			if( judgeCoordInFrame(enemy[i], bullet[j]) ) {
				score += 5;
				drawThisEnemyToNull( enemy[i] );
				COORD a= {1, 1};
				COORD b= {45, 3};
				enemy[i].position[0] = random(a, b);
				enemy[i].position[1].X = enemy[i].position[0].X + 3;
				enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
				drawThisBulletToNull( bullet[j] );
				bullet[j].Y = 30;
			}
 
}
 
void Game::Shoot() {
	for(int i=0; i<10; i++)
		if(bullet[i].Y == 30) {
			bullet[i].X = position[5].X;
			bullet[i].Y = position[5].Y-1;
			break;
		}
}
 
void Game::printScore() {
	if(score == 120 && flag_rank == 0) {
		rank -= 3;
		flag_rank = 1;
	}
 
	else if( score == 360 && flag_rank == 1) {
		rank -= 5;
		flag_rank = 2;
	} else if( score == 480 && flag_rank == 2) {
		rank -= 5;
		flag_rank = 3;
	}
	int x=rank/5;
	SetPos(60, 6);
	cout<<score;
 
	if( rank!=rankf ) {
		SetPos(60, 7);
		if( x == 5)
			title="初级飞行员";
		else if( x == 4)
			title="中级飞行员";
		else if( x == 3)
			title="高级飞行员";
		else if( x == 2 )
			title="王牌飞行员";
		else 
			title="顶级飞行员";
		cout<<title;
	}
	rankf = rank;
}
 
void Game::Playing() {
	HANDLE MFUN;
	MFUN= CreateThread(NULL, 0, MusicFun, NULL, 0, NULL);
 
	drawEnemy();
	drawPlane();
 
	int flag_bullet = 0;
	int flag_enemy = 0;
 
	while(1) {
		Sleep(8);
		if(_kbhit()) {
			char x = _getch();
			if ('a' == x || 's' == x || 'd' == x || 'w' == x) {
				drawPlaneToNull();
				planeMove(x);
				drawPlane();
				judgePlane();
			} else if ('p' == x)
				Pause();
			else if( 'k' == x)
				Shoot();
			else if( 'e' == x) {
				CloseHandle(MFUN);
				GameOver();
				break;
			}
 
		}
		/* 处理子弹 */
		if( 0 == flag_bullet ) {
			bulletMove();
			drawBulletToNull();
			drawBullet();
			judgeEnemy();
		}
		flag_bullet++;
		if( 5 == flag_bullet )
			flag_bullet = 0;
 
		/* 处理敌人 */
		if( 0 == flag_enemy ) {
			drawEnemyToNull();
			enemyMove();
			drawEnemy();
			judgePlane();
		}
		flag_enemy++;
		if( flag_enemy >= rank )
			flag_enemy = 0;
 
		/* 输出得分 */
		printScore();
	}
}
 
void Game::GameOver() {
	system("cls");
	COORD p1= {28,9};
	COORD p2= {53,15};
	drawFrame(p1, p2, '=', '|');
	SetPos(36,12);
	string str="Game Over!";
	for(int i=0; i<str.size(); i++) {
		Sleep(80);
		cout<<str[i];
	}
	Sleep(1000);
	system("cls");
	drawFrame(p1, p2, '=', '|');
	SetPos(31, 11);
	cout<<"击落敌机:"<<score/5<<" 架";
	SetPos(31, 12);
	cout<<"得  分:"<<score;
	SetPos(31, 13);
	cout<<"获得称号:"<<title;
	SetPos(30, 16);
	Sleep(1000);
//	cout<<"是否复活 (*≧︶≦))( ̄▽ ̄* )ゞ 是(y)| 否(n)"<<endl;
//	char kkksc03;
//	cin>>kkksc03;
//	if(kkksc03=='y'){
//		xxx--;
//		flag=true;
//		if(xxx==0){
//			cout<<"已使用"<<endl;
//			cout<<"剩余0次机会" <<endl; 
//			score=scorecc;
//			titlecc=title;
//			//Main();
//		}
//		else{
//			cout<<"你没机会了,gun⑧"<<endl;
//		}
//	}
	cout<<"继续? 是(y)| 否(n)制作:一只水饺吖<*)))><<";
	HANDLE MFUN;
	MFUN= CreateThread(NULL, 0, MusicFun, NULL, 0, NULL);
as:
	char x=_getch();
	if (x == 'n')
		exit(0);
	else if (x == 'y') {
		system("cls");
		Game game;
		int a = drawMenu();
		if(a == 2)
			game.rank = 20;
		system("cls");
		drawPlaying();
		game.Playing();
	} else goto as;
}
void Main(){

 //游戏准备
	srand((int)time(0));    //随机种子
	HideCursor();    //隐藏光标
 
	Game game;
	int a = drawMenu();
	if(a == 2)
		game.rank = 20;
	HANDLE MFUN;
	MFUN= CreateThread(NULL, 0, MusicFun, NULL, 0, NULL);
	system("cls");
	drawPlaying();
	if(flag==true){
		flag=false;
		score=scorecc;
		title=titlecc;
	}
	game.Playing();
}
/*================== the main function ==================*/
int main() {
	Main(); 
	return 0; 
}

如果觉得不错就点个赞吧

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2221786.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

RabbitMQ系列学习笔记(三)--工作队列模式

文章目录 一、工作队列模式原理二、工作队列模式实战1、抽取工具类2、消费者代码3、生产者代码4、查看运行结果 本文参考 尚硅谷RabbitMQ教程丨快速掌握MQ消息中间件rabbitmq RabbitMQ 详解 Centos7环境安装Erlang、RabbitMQ详细过程(配图) 一、工作队列模式原理 与简单模式相…

企业级 接口自动化测试框架:Pytest+Allure+Excel

1. Allure 简介 简介 Allure 框架是一个灵活的、轻量级的、支持多语言的测试报告工具&#xff0c;它不仅以 Web 的方式展示了简介的测试结果&#xff0c;而且允许参与开发过程的每个人可以从日常执行的测试中&#xff0c;最大限度地提取有用信息。 Allure 是由 Java 语言开发…

MySQL 【日期】函数大全(七)

目录 1、UNIX_TIMESTAMP() 将指定的日期/日期时间转为 UNIX 时间戳值。 2、WEEK() 返回给定日期位于当年的第几周。 3、WEEKDAY() 返回给定日期的工作日编号。 4、WEEKOFYEAR() 返回给定日期位于当年的第几周 5、YEAR() 提取日期的年份部分并作为数字返回。 6、YEARWEEK()…

Jmeter 实战 JDBC配置

​ JDBC JDBC&#xff08;Java Database Connectivity&#xff09;是一种用于执行SQL语句的Java API。通过这个API&#xff0c;可以直接连接并执行SQL脚本&#xff0c;与数据库进行交互。 使用JMeter压力测试时&#xff0c;操作数据库的场景 在使用JMeter进行接口压力测试时…

Gin 协程mysql客户端

一、Gin框架 mysql配置 这里选择yaml文件配置 二、配置读取 viper 读取yaml文件中对应配置 三、mysql 的协程客户端 文件位置 package databaseimport ("database/sql""fmt""github.com/spf13/viper""log""net/http"&quo…

JavaWeb 25.Vite

目录 一、Vite的介绍 二、Vite创建Vue3工程化项目 ViteVue3项目的创建、启动、停止 创建 启动 停止 干净感来源于对自我的驯服 —— 24.10.23 一、Vite的介绍 在浏览器支持 ES 模块之前&#xff0c;JavaScript 并没有提供原生机制让开发者以模块化的方式进行开发。这也正是我们…

Missing classes detected while running R8报错解决方案

Android 打包release版本时报错如下&#xff1a; > Task :printlib:minifyReleaseWithR8 FAILED AGPBI: {"kind":"error","text":"Missing classes detected while running R8. Please add the missing classes or apply additional ke…

canvas-editor首行缩进

canvas-editor中渲染部分的源码都在Draw.ts里&#xff0c;能找到computeRowList方法中并没有实现首行缩进相关的逻辑&#xff0c;但是实现了element.type ElementType.TAB的缩进&#xff0c;如图&#xff1a; 因此我们可以基于tab进行首行缩进的逻辑编写&#xff0c;在main.ts…

通过DevTools逃离Chrome沙盒(CVE-2024-6778和CVE-2024-5836)

介绍 这篇博文详细介绍了如何发现CVE-2024-6778和CVE-2024-5836的&#xff0c;这是Chromium web浏览器中的漏洞&#xff0c;允许从浏览器扩展&#xff08;带有一点点用户交互&#xff09;中进行沙盒逃逸。 简而言之&#xff0c;这些漏洞允许恶意的Chrome扩展在你的电脑上运行…

2015年-2017年 计算机技术专业 程序设计题(算法题)实战_c语言程序设计数据结构程序设计分析

文章目录 20151.C语言算法设计部分2.数据结构算法设计部分 20161.C语言算法设计部分2.数据结构算法设计部分 2017年1. C语言算法设计部分2.数据结构算法设计部分 2015 1.C语言算法设计部分 int total(int n) {if(n1) return 1;return total(n-1)n1; } //主函数测试代码已省略…

Android 15 推出新安全功能以保护敏感数据

Android 15 带来了增强的安全功能&#xff0c;可保护您的敏感健康、财务和个人数据免遭盗窃和欺诈。 它还为大屏幕设备带来了生产力改进&#xff0c;并对相机、消息和密钥等应用进行了更新。 Android 防盗保护 Google 开发并严格测试了一套全面的功能&#xff0c;以在盗窃之…

Ubuntu22.04 制作系统ISO镜像

第一步&#xff1a;安装软件-Systemback 1.如果已经添加过ppa&#xff0c;可以删除重新添加或者跳过此步 sudo add-apt-repository --remove ppa:nemh/systemback 2.添加ppa 我是ubuntu20&#xff0c;但这个软件最后支持的是 ubuntu16.04版本&#xff0c;所以加一个16版本…

【Docker】Harbor 私有仓库和管理

目录 一、搭建本地私有仓库 二、harbor简介&#xff08;特性、构成、架构的数据流向&#xff09; 2.1 什么是Harbor 2.2 Harbor的特性 2.3 Harbor的构成 2.4 Harbor的工作原理&#xff08;运行流程&#xff09; 三、harbor部署以及配置文件 1. 部署 Docker-Compose 服…

2010年国赛高教杯数学建模B题上海世博会影响力的定量评估解题全过程文档及程序

2010年国赛高教杯数学建模 B题 上海世博会影响力的定量评估 2010年上海世博会是首次在中国举办的世界博览会。从1851年伦敦的“万国工业博览会”开始&#xff0c;世博会正日益成为各国人民交流历史文化、展示科技成果、体现合作精神、展望未来发展等的重要舞台。请你们选择感兴…

Hadoop生态圈三大组件:HDFS的读写流程、MapReduce计算流程、Yarn资源调度

文章目录 1. HDFS的读写流程1.1 HDFS读流程1.2 HDFS写流程 2. MapReduce计算流程3. Yarn资源调度一、客户端请求资源二、Resource Manager处理请求三、任务资源计算与申请四、Resource Manager分配资源五、Node Manager执行任务六、任务执行与监控 1. HDFS的读写流程 1.1 HDFS…

C++ 中的友元(Friend)用法详解

什么是友元&#xff08;Friend&#xff09;&#xff1f;&#x1f46d; 友元 (C) | Microsoft Learn 在C中&#xff0c;友元&#xff08;Friend&#xff09;是一种机制&#xff0c;允许外部函数或类访问某个类的私有&#xff08;private&#xff09;或保护&#xff08;protecte…

[Unity Demo]从零开始制作空洞骑士Hollow Knight第十五集:制作更多地图,更多敌人,更多可交互对象

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、第一个代表性场景 1.制作更多敌人2.制作更多可交互对象二、第二个代表性场景 1.制作更多敌人2.制作更多可交互对象三、第三个代表性场景 1.制作更多敌人2.制…

【计算机网络 - 基础问题】每日 3 题(五十二)

✍个人博客&#xff1a;https://blog.csdn.net/Newin2020?typeblog &#x1f4e3;专栏地址&#xff1a;http://t.csdnimg.cn/fYaBd &#x1f4da;专栏简介&#xff1a;在这个专栏中&#xff0c;我将会分享 C 面试中常见的面试题给大家~ ❤️如果有收获的话&#xff0c;欢迎点赞…

Solr5.5.0单机部署

Solr5.5.0集成Tomcat8部署 1、 准备条件 JDK1.7以上 Solr5.5.0部署包&#xff08;solr-5.5.0.zip&#xff09; Tomcat8部署包 &#xff08;apache-tomcat-8.5.16.tar.gz&#xff09; 上传Solr5.5.0和tomcat8 部署包并解压使用 2、准备部署 将./solr-5.5.0/server/solr-we…

SPI的学习

工作原理 SPI的工作原理基于主从架构。主设备通过四条主要信号线与一个或多个从设备进行通信&#xff1a; MOSI&#xff08;主输出&#xff0c;从输入&#xff09;DI&#xff08;Master Output Slave Input&#xff09;&#xff1a;主设备发送数据到从设备。MISO&#xff08;…