Mint_21.3 drawing-area和goocanvas的FB笔记(五)

FreeBASIC SDL图形功能

SDL - Simple DirectMedia Layer 是完整的跨平台系统,有自己的窗口、直接捕获键盘、鼠标和游戏操纵杆的事件,直接操作音频和CDROM,在其surface上可使用gfx, openGL和direct3D绘图。Window3.0时代,各种应用程序在Pharlap、DJPP、4GW支持下均突破了常规内存进入了保护模式,因此那个时期是SDL突破性发展的时机,非常多的游戏程序用SDL做支撑(gtk/iup/libui有的功能sdl没有,而sdl有的能力其它的则没有),是开发游戏和工厂流程化应用绘图的优秀工具。C#, Lua, Rust, hollywood, beaflang, Ocamel, Python, 等众多语言有它的封装, Github上的最新稳定版是 2.30.1 , 三天前还在更新。

Github上各平台使用的SDL

游戏:wildfire 野火

DOSBOX: DOS simulator

Humble Bundle 各种游戏

valve 众多游戏

FreeBASIC 完美支持 SDL, 需要安装如下 .so 库文件(SDL, SDL2 二个版本)

#freebasic SDL
sudo apt install libsdl2-dev
sudo apt install libsdl2-ttf-dev
sudo apt install libsdl2-net-dev
sudo apt install libsdl2-mixer-dev
sudo apt install libsdl2-image-dev
sudo apt install libsdl2-gfx-dev
sudo apt install libsdl1.2-dev
sudo apt install libsdl-console-dev
sudo apt install libsdl-mixer1.2-dev
sudo apt install libsdl-gfx1.2-dev
sudo apt install libsdl-net1.2-dev
sudo apt install libsdl-pango-dev
sudo apt install libsdl-sge-dev
sudo apt install libsdl-sound1.2-dev

示例一:放三个图文件:free.jpg, basic.gif, horse.tga

SDL库可读取的的图形文件种类繁多,此示例是在原示例基础上修改的,读取 gif, tga, jpg三种格式的文件。程序首选获取SDL的版本号,初始化 sdl, 作为三个sdl surface装入图形文件并返回图形指针,然后在不同位置放置它们,最后flip显示它们。

' SDL_image example written by Edmond Leung (leung.edmond@gmail.com)
'
' free.jpg, basic.gif and horse.tga are taken from the official freeBasic
' website.

#include  "SDL\SDL.bi"
#include  "SDL\SDL_image.bi"

declare sub blitImage _
   (byval img as SDL_Surface ptr, byval x as integer, byval y as integer)

	dim shared video as SDL_Surface ptr

	dim freeImg as SDL_Surface ptr, basicImg as SDL_Surface ptr, horseImg as SDL_Surface ptr

	dim version as const SDL_version ptr
	version = IMG_Linked_Version()

	' display the version number of the SDL_image being used
	print "Using SDL_image version number: "; SDL_VERSIONNUM(version->major, _
   	version->minor, version->patch)

	' initialise sdl with video support
	if (SDL_Init(SDL_INIT_VIDEO) < 0) then
   		print "Couldn't initialise SDL: "; *SDL_GetError()
	end if

	' check to see if the images are in the correct formats
	if (IMG_isJPG(SDL_RWFromFile("data/free.jpg", "rb")) = 0) then
   		print "The image (free.jpg) is not a jpg file."
	end if
	if (IMG_isGIF(SDL_RWFromFile("data/basic.gif", "rb")) = 0) then
   		print "The image (basic.gif) is not a gif file."
	end if

	' set the video mode to 1024x768x32bpp
	video = SDL_SetVideoMode(1024, 768, 32, SDL_HWSURFACE or SDL_DOUBLEBUF)
	
	if (video = NULL) then
   		print "Couldn't set video mode: "; *SDL_GetError()
	end if

	' load the images into an SDL_RWops structure
	dim freeRw as SDL_RWops ptr, basicRw as SDL_RWops ptr
	freeRw = SDL_RWFromFile("data/free.jpg", "rb")
	basicRw = SDL_RWFromFile("data/basic.gif", "rb")

	' load the images onto an SDL_Surface using three different functions available
	' in the SDL_image library
	freeImg = IMG_LoadJPG_RW(freeRw)
	horseImg = IMG_Load("data/horse.tga")
	basicImg = IMG_LoadTyped_RW(basicRw, 1, "gif")

	dim done as integer
	done = 0

	do while (done = 0)
   		dim event as SDL_Event
   
   		do while (SDL_PollEvent(@event))
      		if (event.type = SDL_QUIT_) then done = 1
      			if (event.type = SDL_KEYDOWN) then
        	 		if (event.key.keysym.sym = SDLK_ESCAPE) then done = 1      
      		end if
   		loop

   		dim destrect as SDL_Rect
   		destrect.w = video->w
   		destrect.h = video->h
   
   		' clear the screen with the colour white
   		SDL_FillRect(video, @destrect, SDL_MapRGB(video->format, 255, 255, 255))
   
   		' draw the images onto the screen

		blitImage freeImg, 170, 205

   		blitImage horseImg, 345, 330 
		blitImage freeImg, 445, 335 
   		blitImage basicImg, 450, 360 
		
		blitImage freeImg, 650, 215 
   		blitImage basicImg, 650, 240 		

		blitImage freeImg, 150, 455 
   		blitImage basicImg, 150, 480 		
	
		SDL_Flip(video)
	loop

	SDL_Quit

' sub-routine used to help with blitting the images onto the screen
sub blitImage _
   (byval img as SDL_Surface ptr, byval x as integer, byval y as integer)
	dim dest as SDL_Rect
   	dest.x = x
   	dest.y = y
   	SDL_BlitSurface(img, NULL, video, @dest)
end sub

示例二:对网络的支持,访问百度站点并取得首页面前部分内容(对于现代编程,这好像是非常基本的能力)。

''
'' simple http get example using the SDL_net library
''

#include once "SDL/SDL_net.bi"

const RECVBUFFLEN = 8192
const NEWLINE = !"\r\n"
'const DEFAULT_HOST = "www.freebasic.net"
const DEFAULT_HOST = "www.baidu.com"

declare sub gethostandpath( byref src as string, byref hostname as string, byref path as string )
	
	
	'' globals
	dim hostname as string
	dim path as string
	
	gethostandpath command, hostname, path
	
	if( len( hostname ) = 0 ) then
		hostname = DEFAULT_HOST
	end if
	
	'' init
	if( SDLNet_Init <> 0 ) then
		print "Error: SDLNet_Init failed"
		end 1
	end if
                         
	'' resolve
	dim ip as IPAddress
    dim socket as TCPSocket
    
    if( SDLNet_ResolveHost( @ip, hostname, 80 ) <> 0 ) then
		print "Error: SDLNet_ResolveHost failed"
		end 1
	end if
    
    '' open
    socket = SDLNet_TCP_Open( @ip )
    if( socket = 0 ) then
		print "Error: SDLNet_TCP_Open failed"
		end 1
	end if
    
    '' send HTTP request
    dim sendbuffer as string
    
	sendBuffer = "GET /" + path + " HTTP/1.0" + NEWLINE + _
				 "Host: " + hostname + NEWLINE + _
				 "Connection: close" + NEWLINE + _
				 "User-Agent: GetHTTP 0.0" + NEWLINE + _
				 NEWLINE
				 
    if( SDLNet_TCP_Send( socket, strptr( sendbuffer ), len( sendbuffer ) ) < len( sendbuffer ) ) then
		print "Error: SDLNet_TCP_Send failed"
		end 1
	end if
    
    '' receive til connection is closed
    dim recvbuffer as zstring * RECVBUFFLEN+1
    dim bytes as integer
    
    do 
    	bytes = SDLNet_TCP_Recv( socket, strptr( recvbuffer ), RECVBUFFLEN )
    	if( bytes <= 0 ) then
    		exit do
    	end if
    	
    	'' add the null-terminator
    	recvbuffer[bytes] = 0
    	
    	'' print it as string
    	print recvbuffer;
    loop
    print
                         
	'' close socket
	SDLNet_TCP_Close( socket )
	
	'' quit
	SDLNet_Quit

'':::::
sub gethostandpath( byref src as string, byref hostname as string, byref path as string )
	dim p as integer
	
	p = instr( src, " " )
	if( p = 0 or p = len( src ) ) then
		hostname = trim( src )
		path = ""
	else
		hostname = trim( left( src, p-1 ) )
		path = trim( mid( src, p+1 ) )
	end if
		
end sub

示例三:SDL 对 gfx 的支持。画任意线条,非常经典的dos年代的一款demo

''
'' simple http get example using the SDL_net library
''

#include once "SDL/SDL_net.bi"

const RECVBUFFLEN = 8192
const NEWLINE = !"\r\n"
'const DEFAULT_HOST = "www.freebasic.net"
const DEFAULT_HOST = "www.baidu.com"

declare sub gethostandpath( byref src as string, byref hostname as string, byref path as string )
	
	
	'' globals
	dim hostname as string
	dim path as string
	
	gethostandpath command, hostname, path
	
	if( len( hostname ) = 0 ) then
		hostname = DEFAULT_HOST
	end if
	
	'' init
	if( SDLNet_Init <> 0 ) then
		print "Error: SDLNet_Init failed"
		end 1
	end if
                         
	'' resolve
	dim ip as IPAddress
    dim socket as TCPSocket
    
    if( SDLNet_ResolveHost( @ip, hostname, 80 ) <> 0 ) then
		print "Error: SDLNet_ResolveHost failed"
		end 1
	end if
    
    '' open
    socket = SDLNet_TCP_Open( @ip )
    if( socket = 0 ) then
		print "Error: SDLNet_TCP_Open failed"
		end 1
	end if
    
    '' send HTTP request
    dim sendbuffer as string
    
	sendBuffer = "GET /" + path + " HTTP/1.0" + NEWLINE + _
				 "Host: " + hostname + NEWLINE + _
				 "Connection: close" + NEWLINE + _
				 "User-Agent: GetHTTP 0.0" + NEWLINE + _
				 NEWLINE
				 
    if( SDLNet_TCP_Send( socket, strptr( sendbuffer ), len( sendbuffer ) ) < len( sendbuffer ) ) then
		print "Error: SDLNet_TCP_Send failed"
		end 1
	end if
    
    '' receive til connection is closed
    dim recvbuffer as zstring * RECVBUFFLEN+1
    dim bytes as integer
    
    do 
    	bytes = SDLNet_TCP_Recv( socket, strptr( recvbuffer ), RECVBUFFLEN )
    	if( bytes <= 0 ) then
    		exit do
    	end if
    	
    	'' add the null-terminator
    	recvbuffer[bytes] = 0
    	
    	'' print it as string
    	print recvbuffer;
    loop
    print
                         
	'' close socket
	SDLNet_TCP_Close( socket )
	
	'' quit
	SDLNet_Quit

'':::::
sub gethostandpath( byref src as string, byref hostname as string, byref path as string )
	dim p as integer
	
	p = instr( src, " " )
	if( p = 0 or p = len( src ) ) then
		hostname = trim( src )
		path = ""
	else
		hostname = trim( left( src, p-1 ) )
		path = trim( mid( src, p+1 ) )
	end if
		
end sub

示例四:SDL 对open_GL的支持。简单的三角形, 颜色glColor3f 后面带3个float参数; glVertext3f,  顶点描述后面带3个float参数。

''
'' gltest.bas - freeBASIC opengl example, using GLUT for simplicity
'' by Blitz
''
'' Opengl code ported from nehe's gl tutorials
''

#include once "GL/gl.bi"
#include once "GL/glu.bi"
#include once "GL/glut.bi"

''
declare sub         doMain           ( )
declare sub         doShutdown		 ( )



    ''
    '' Entry point
    ''
    doMain
    

    

'' ::::::::::::
'' name: doRender
'' desc: Is called by glut to render scene
''
'' ::::::::::::
sub doRender cdecl
    static rtri as single
    static rqud as single
    
    glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
    glPushMatrix
    
    glLoadIdentity
    glTranslatef -1.5, 0.0, -6.0
    glRotatef rtri, 0, 1, 0
         
    glBegin GL_TRIANGLES
		glColor3f   1.0, 0.0, 0.0			'' Red
		glVertex3f  0.0, 1.0, 0.0			'' Top Of Triangle  Front)
		glColor3f   0.0, 1.0, 0.0			'' Green
		glVertex3f -1.0,-1.0, 1.0			'' Left Of Triangle  Front)
		glColor3f   0.0, 0.0, 1.0			'' Blue
		glVertex3f  1.0,-1.0, 1.0			'' Right Of Triangle  Front)
		glColor3f   1.0, 0.0, 0.0			'' Red
		glVertex3f  0.0, 1.0, 0.0			'' Top Of Triangle  Right)
		glColor3f   0.0, 0.0, 1.0			'' Blue
		glVertex3f  1.0,-1.0, 1.0			'' Left Of Triangle  Right)
		glColor3f   0.0, 1.0, 0.0			'' Green
		glVertex3f  1.0,-1.0,-1.0			'' Right Of Triangle  Right)
        glColor3f   1.0, 0.0, 0.0			'' Red
		glVertex3f  0.0, 1.0, 0.0			'' Top Of Triangle  Back)
		glColor3f   0.0, 1.0, 0.0			'' Green
		glVertex3f  1.0,-1.0,-1.0			'' Left Of Triangle  Back)
		glColor3f   0.0, 0.0, 1.0			'' Blue
		glVertex3f -1.0,-1.0,-1.0			'' Right Of Triangle  Back)
		glColor3f   1.0, 0.0, 0.0			'' Red
		glVertex3f  0.0, 1.0, 0.0			'' Top Of Triangle  Left)
		glColor3f   0.0, 0.0, 1.0			'' Blue
		glVertex3f -1.0,-1.0,-1.0			'' Left Of Triangle  Left)
		glColor3f   0.0, 1.0, 0.0			'' Green
		glVertex3f -1.0,-1.0, 1.0			'' Right Of Triangle  Left)
    glEnd
    
    glColor3f 0.5, 0.5, 1.0
    glLoadIdentity    
    glTranslatef -1.5, 0.0, -6.0
	glTranslatef 3.0,0.0,0.0	
	glRotatef rqud, 1.0, 0.0, 0.0
	
	glBegin GL_QUADS
		glVertex3f -1.0, 1.0, 0.0
		glVertex3f  1.0, 1.0, 0.0
		glVertex3f  1.0,-1.0, 0.0
		glVertex3f -1.0,-1.0, 0.0
	glEnd    

    glPopMatrix            
    glutSwapBuffers
    
    rtri = rtri + 2.0
    rqud = rqud + 1.5
    
end sub



'' ::::::::::::
'' name: doInput
'' desc: Handles input
''
'' ::::::::::::
sub doInput CDECL ( byval kbcode as unsigned byte, _
              byval mousex as integer, _
              byval mousey as integer )
              
    if ( kbcode = 27 ) then
        doShutdown
        end 0
    end if

end sub



'' ::::::::::::
'' name: doInitGL
'' desc: Inits OpenGL
''
'' ::::::::::::
sub doInitGL
    dim i as integer
    dim lightAmb(3) as single
    dim lightDif(3) as single
    dim lightPos(3) as single
    
    ''
    '' Rendering stuff
    ''
    glShadeModel GL_SMOOTH
	glClearColor 0.0, 0.0, 0.0, 0.5
	glClearDepth 1.0
	glEnable GL_DEPTH_TEST
	glDepthFunc GL_LEQUAL
    glEnable GL_COLOR_MATERIAL
	glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
    
    ''
    '' Light setup ( not used at the moment )
    ''
    for i = 0 to 3
        lightAmb(i) = 0.5
        lightDif(i) = 1.0
        lightPos(i) = 0.0
    next i

    lightAmb(3) = 1.0
    lightPos(2) = 2.0
    lightPos(3) = 1.0    
	
    glLightfv GL_LIGHT1, GL_AMBIENT, @lightAmb(0)
	glLightfv GL_LIGHT1, GL_DIFFUSE, @lightDif(0)
	glLightfv GL_LIGHT1, GL_POSITION,@lightPos(0)
	glEnable GL_LIGHT1

    ''
    '' Blending ( not used at the moment )
    ''
    glColor4f 1.0, 1.0, 1.0, 0.5
    glBlendFunc GL_SRC_ALPHA, GL_ONE

end sub



'' ::::::::::::
'' name: doReshapeGL
'' desc: Reshapes GL window
''
'' ::::::::::::
sub doReshapeGL CDECL ( byval w as integer, _
                        byval h as integer )
    
    glViewport 0, 0, w, h 
    glMatrixMode GL_PROJECTION
    glLoadIdentity
    
    if ( h = 0 ) then
        gluPerspective  80/2, w, 1.0, 5000.0 
    else
        gluPerspective  80/2, w / h, 1.0, 5000.0
    end if
    
    glMatrixMode GL_MODELVIEW
    glLoadIdentity

end sub

'':::::
sub initGLUT
    ''
    '' Setup glut
    ''
    glutInit 1, strptr( " " )    
    
    glutInitWindowPosition 0, 0
    glutInitWindowSize 640, 480
    glutInitDisplayMode GLUT_RGBA or GLUT_DOUBLE or GLUT_DEPTH
    glutCreateWindow "FreeBASIC OpenGL example"
    
    doInitGL
    
    glutDisplayFunc  @doRender
    glutIdleFunc     @doRender
    glutReshapeFunc  CAST(Any PTR, @doReshapeGL)
    glutKeyboardFunc CAST(Any PTR, @doInput)

end sub

'':::::
sub doInit
    
	''
	'' Init GLUT
	''
	initGLUT    
	
end sub

'':::::
sub shutdownGLUT

	'' GLUT shutdown will be done automatically by atexit()

end sub

'':::::
sub doShutdown
    
	''
	'' GLUT
	''
	shutdownGLUT
	
end sub

'' ::::::::::::
'' name: doMain
'' desc: Main routine
''
'' ::::::::::::
sub doMain
    
    ''
    '' 
    ''
    doInit
    
    ''
    ''
    ''
    glutMainLoop
    
end sub


SDL 对鼠标、键盘、joysticker的响应都比较好。以前研究鼠标鉴相时拆过几个滚球鼠标,通过串口可以读取字节形式的位置信息,游戏操纵杆还没拆过,有时间了拆解一个研究一下它的button和位置实现,估计和早期原理图有很多不同。SDL内容太多,先熟悉它的功能和应用领域,没有做更深入的学习,以后用的话还要多补补课。

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

准谐振PWM控制器-能够实现多种保护功能FAN6921MRMY 功率因数控制器

高度集成的FAN6921MRMY将功率因数控制器 (PFC) 和准谐振 PWM 控制器相结合。集成提供了成本高效的设计&#xff0c;可减少外部组件数量。对于 PFC&#xff0c;FAN6921MRMY使用控制导通时间技术提供调节的直流输出电压&#xff0c;执行自然的功率因数校正。FAN6921MRMY使用创新的…

【代码随想录算法训练营Day40】01背包问题一维dp数组;二维dp数组(滚动数组);416.分割等和子集

文章目录 ❇️Day 41 第九章 动态规划 part04✴️今日任务❇️01背包问题 二维背包问题的区别暴力解法动规五部曲 ❇️01背包问题 一维二维转一维&#xff1a;滚动数组动规五部曲 ❇️416. 分割等和子集随想录思路自己的思路二维方法一维方法 自己的代码二维方法一维方法 ❇️D…

Kibana二次开发环境搭建

1 kibana环境搭建 1.1 搭建后端服务 &#xff08;1&#xff09;java环境安装 ElasticSearch运行需要java jdk支持。所以要先安装JAVA环境。由于ElasticSearch 5.x 往后依赖于JDK 1.8的&#xff0c;所以现在我们下载JDK 1.8或者更高版本。下载JDK1.8,下载完成后安装&#xff…

去电脑维修店修电脑需要注意什么呢?装机之家晓龙

每当电脑出现故障时&#xff0c;你无疑会感到非常沮丧。 如果计算机已过了保修期&#xff0c;您将无法享受制造商的免费保修服务。 这意味着您必须自费找到一家电脑维修店。 去电脑维修店并不容易。 大家一定要知道&#xff0c;电脑维修非常困难&#xff0c;尤其是笔记本电脑维…

qtCreator可以全局包含。VSqt中千万不能全局包含,你的控件头文件会自己变成<>括号,编译就报错

qtCreator可以全局包含。 VSqt中千万不能全局包含&#xff0c;你的控件头文件会自己变成&#xff1c;&#xff1e;括号&#xff0c;编译就报错

重建大师6.2版本的建模效果出现下图中模糊的情况,是什么原因?

可能是因为坐标原点设置的不对&#xff0c;图例中的三角网都出现了精度损失的问题。 坐标原点设置的具体操作&#xff1a;提交产品后&#xff0c;在弹出的界面&#xff0c;可以设定坐标原点。 重建大师是一款专为超大规模实景三维数据生产而设计的集群并行处理软件&#xff0…

第七届强网杯-PWN-【warmup】

文章目录 warmup libc 2.35检查IDA逆向maindeldelete_noteadd_noteshow_noteinput_numberread_16atoi __errno_location()相关解释prctl相关 思路高版本off by null利用技巧产生chunk extend泄露libc基地址泄露heap基地址修改放入tcachebin中的chunk的fd为stdout最后add两个chu…

AI大模型助力创意思维,拓展无限可能性

在当今快速发展的科技时代&#xff0c;人工智能大模型正逐渐成为我们生活中不可或缺的一部分。它们拥有强大的计算能力和学习能力&#xff0c;能够帮助我们解决许多复杂的问题&#xff0c;同时也可以为创意思维的拓展提供无限可能性。 人工智能大模型可以通过对海量数据的分析…

docker部署springboot jar包项目

docker部署springboot jar包项目 前提&#xff0c;服务器环境是docker环境&#xff0c;如果服务器没有安装docker&#xff0c;可以先安装docker环境。 各个环境安装docker&#xff1a; Ubuntu上安装Docker&#xff1a; ubuntu离线安装docker: CentOS7离线安装Docker&#xff1…

华为北向网管NCE开发教程(1)闭坑选接口协议

华为北向网管NCE开发教程&#xff08;1&#xff09;闭坑选接口协议 华为北向网管NCE开发教程&#xff08;2&#xff09;REST接口开发 华为北向网管NCE开发教程&#xff08;3&#xff09;CORBA协议开发 本文一是记录自己开发华为北向网管遇到的坑&#xff0c;二是给需要的人&…

Rocky Linux 的安装

1. 为什么用Rocky 因为CentOS不干了&#xff0c;这是CentOS的现状&#xff1a; CentOS Linux 8 在 2021 年底停止更新&#xff1b; CentOS Linux 7 用户较多&#xff0c;这个版本将在 2024 年 6 月 30 日停止支持&#xff1b; 未来社区不会再有 CentOS Linux 的新版本&…

联立方程模型的可识别性的通俗解释

联立方程模型的可识别性&#xff0c;主要的解法是阶条件算法和秩条件算法&#xff0c;数学公式角度的解释就不讲了&#xff0c;参考下面的前人文献。 【计量经济学】联立方程模型-CSDN博客 说一下公式算法背后的通俗原理。 在计量经济模型中&#xff0c;比如 Y23*Xu中&#x…

[java基础揉碎]super关键字

super关键字: 基本介绍 super代表父类的引用&#xff0c;用于访问父类的属性、方法、构造器 super给编程带来的便利/细节 1.调用父类的构造器的好处(分工明确&#xff0c;父类属性由父类初始化&#xff0c;子类的属性由子类初始化) 2.当子类中有和父类中的成员(属性和方法)重…

Springer旗下SCI,16天见刊!稳定检索13年,质量稳定

毕业推荐 SCIE&#xff1a; • 计算机类&#xff0c;6.5-7.0&#xff0c;JCR1区&#xff0c;中科院2区 • 2个月19天录用&#xff0c;6天见刊&#xff0c;36天检索 SCI&EI&#xff08;CCF-C类&#xff09; • 算法类&#xff0c;2.0-3.0&#xff0c;JCR3区&#xff0c…

数字孪生的大方向趋势及未来

hello宝子们...我们是艾斯视觉擅长ui设计和前端开发10年经验&#xff01;希望我的分享能帮助到您&#xff01;如需帮助可以评论关注私信我们一起探讨&#xff01;致敬感谢感恩&#xff01; 数字孪生的大方向趋势及未来 一、引言 数字孪生&#xff08;Digital Twin&#xff09…

高级语言讲义2016计专(仅高级语言部分)

1.斐波那契序列的第n项可以表示成以下形式&#xff0c;编写一个非递归函数&#xff0c;返回该数列的第n项的数值 #include <stdio.h>int func(int n) {if(n1||n2)return 1;int p1,q1,num;for(int i3; i<n; i) {numpq;qp;pnum;}return num; } 2.在MXN的二维数组A中&am…

Win11 没有网络bug

1.问题描述 没有网络&#xff0c;dns一直是固定的&#xff0c;但是dns已经是自动获取了(MAC地址随机) 2.解决办法 1.首先&#xff0c;删除所有网络的手动dns配置,控制中心那个dns管理没有用,在设置中删除网络,不然问题还会出现 - 2.然后&#xff0c;进入注册表\HKEY_LOCAL_MACH…

数据结构之栈详解(C语言手撕)

&#x1f389;个人名片&#xff1a; &#x1f43c;作者简介&#xff1a;一名乐于分享在学习道路上收获的大二在校生 &#x1f648;个人主页&#x1f389;&#xff1a;GOTXX &#x1f43c;个人WeChat&#xff1a;ILXOXVJE &#x1f43c;本文由GOTXX原创&#xff0c;首发CSDN&…

汉服|高校汉服租赁网站|基于Springboot的高校汉服租赁网站设计与实现(源码+数据库+文档)

高校汉服租赁网站目录 目录 基于Springboot的高校汉服租赁网站设计与实现 一、前言 二、系统设计 三、系统功能设计 1、汉服信息管理 2、汉服租赁管理 3、公告管理 4、公告类型管理 四、数据库设计 1、实体ER图 五、核心代码 六、论文参考 七、最新计算机毕设选…

滤波器:工作原理和分类及应用领域?|深圳比创达电子EMC

滤波器在电子领域中扮演着重要的角色&#xff0c;用于处理信号、抑制噪声以及滤除干扰。本文将详细介绍滤波器的工作原理、分类以及在各个应用领域中的具体应用。 一、滤波器的定义和作用 滤波器是一种电子设备&#xff0c;用于选择性地通过或阻塞特定频率范围内的信号。其主…