小学生python游戏编程arcade----烟花粒子

news2025/7/16 10:30:36

小学生python游戏编程arcade----烟花粒子

    • 前言
    • 烟花粒子
      • 1、Vector向量类
        • 1.1 arcade中的向量类
        • 1.2 应用
      • 2、绘制粒子所有纹理图片
        • 2.1 给定直径和颜色的圆的纹理
        • 2.2 arcade.make_circle_texture函数原码
        • 2.3 make_soft_circle_texture 函数原码
        • 2.4 公共纹理代码
      • 3 效果图
      • 4 代码
    • 源码获取

前言

接上篇文章继续解绍arcade游戏编程的基本知识。粒子系统

烟花粒子

1、Vector向量类

1.1 arcade中的向量类

RGB = Union[Tuple[int, int, int], List[int]]
RGBA = Union[Tuple[int, int, int, int], List[int]]
Color = Union[RGB, RGBA]
Point = Union[Tuple[float, float], List[float]]
NamedPoint = namedtuple(“NamedPoint”, [“x”, “y”])

Vector = Point

1.2 应用

def __init__(
        self,
        filename_or_texture: arcade.FilenameOrTexture,
        change_xy: Vector,

2、绘制粒子所有纹理图片

2.1 给定直径和颜色的圆的纹理

SPARK_textures = [arcade.make_circle_texture(6, clr) for clr in Color_list]

2.2 arcade.make_circle_texture函数原码

def make_circle_texture(diameter: int, color: Color, name: str = None) -> Texture:
    """
    返回具有给定直径和颜色的圆的纹理
    """

    name = name or _build_cache_name("circle_texture", diameter, color[0], color[1], color[2])

    bg_color = (0, 0, 0, 0)  # fully transparent
    img = PIL.Image.new("RGBA", (diameter, diameter), bg_color)
    draw = PIL.ImageDraw.Draw(img)
    draw.ellipse((0, 0, diameter - 1, diameter - 1), fill=color)
    return Texture(name, img)

2.3 make_soft_circle_texture 函数原码

def make_soft_circle_texture(diameter: int, color: Color, center_alpha: int = 255, outer_alpha: int = 0,
                             name: str = None) -> Texture:
    """
    Return a :class:`Texture` of a circle with the given diameter and color, fading out at its edges.

    :param int diameter: Diameter of the circle and dimensions of the square :class:`Texture` returned.
    :param Color color: Color of the circle.
    :param int center_alpha: Alpha value of the circle at its center.
    :param int outer_alpha: Alpha value of the circle at its edges.
    :param str name: Custom or pre-chosen name for this texture

    :returns: New :class:`Texture` object.
    :rtype: arcade.Texture
    """
    # TODO: create a rectangle and circle (and triangle? and arbitrary poly where client passes
    # in list of points?) particle?
    name = name or _build_cache_name("soft_circle_texture", diameter, color[0], color[1], color[2], center_alpha,
                                     outer_alpha)  # name must be unique for caching

    bg_color = (0, 0, 0, 0)  # fully transparent
    img = PIL.Image.new("RGBA", (diameter, diameter), bg_color)
    draw = PIL.ImageDraw.Draw(img)
    max_radius = int(diameter // 2)
    center = max_radius  # for readability
    for radius in range(max_radius, 0, -1):
        alpha = int(lerp(center_alpha, outer_alpha, radius / max_radius))
        clr = (color[0], color[1], color[2], alpha)
        draw.ellipse((center - radius, center - radius, center + radius - 1, center + radius - 1), fill=clr)

    return Texture(name, img)

2.4 公共纹理代码

Color_list = (  # rainbon 彩虹
    arcade.color.ELECTRIC_CRIMSON,
    arcade.color.FLUORESCENT_ORANGE,
    arcade.color.ELECTRIC_YELLOW,
    arcade.color.ELECTRIC_GREEN,
    arcade.color.ELECTRIC_CYAN,
    arcade.color.MEDIUM_ELECTRIC_BLUE,
    arcade.color.ELECTRIC_INDIGO,
    arcade.color.ELECTRIC_PURPLE,
)

SPARK_textures = [arcade.make_circle_texture(6, clr) for clr in Color_list]
# 火花_对
SPARK_list = [
    [SPARK_textures[0], SPARK_textures[3]],
    [SPARK_textures[1], SPARK_textures[5]],
    [SPARK_textures[7], SPARK_textures[2]],
]
ROCKET_smoke_texture = arcade.make_soft_circle_texture(15, arcade.color.GRAY)
PUFF_texture = arcade.make_soft_circle_texture(80, (40, 40, 40))
FLASH_texture = arcade.make_soft_circle_texture(70, (128, 128, 90))
# 云 纹理
CLOUD_textures = [
    arcade.make_soft_circle_texture(50, arcade.color.WHITE),
    arcade.make_soft_circle_texture(50, arcade.color.LIGHT_GRAY),
    arcade.make_soft_circle_texture(50, arcade.color.LIGHT_BLUE),
]
# 星星 纹理
STAR_textures = [
    arcade.make_soft_circle_texture(8, arcade.color.WHITE),
    arcade.make_soft_circle_texture(8, arcade.color.PASTEL_YELLOW),
]

3 效果图

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
粒子大小改大后
在这里插入图片描述

4 代码

"""
粒子焰花
使用焰火展示演示发射器和粒子的“真实世界”用途
"""
import arcade
from arcade import Point, Vector
from arcade.utils import _Vec2  # bring in "private" class
import os
import random
import pyglet

SCREEN_width = 800
SCREEN_height = 600

Color_list = (  # rainbon 彩虹
    arcade.color.ELECTRIC_CRIMSON,
    arcade.color.FLUORESCENT_ORANGE,
    arcade.color.ELECTRIC_YELLOW,
    arcade.color.ELECTRIC_GREEN,
    arcade.color.ELECTRIC_CYAN,
    arcade.color.MEDIUM_ELECTRIC_BLUE,
    arcade.color.ELECTRIC_INDIGO,
    arcade.color.ELECTRIC_PURPLE,
)

SPARK_textures = [arcade.make_circle_texture(6, clr) for clr in Color_list]
# 火花_对
SPARK_list = [
    [SPARK_textures[0], SPARK_textures[3]],
    [SPARK_textures[1], SPARK_textures[5]],
    [SPARK_textures[7], SPARK_textures[2]],
]
ROCKET_smoke_texture = arcade.make_soft_circle_texture(15, arcade.color.GRAY)
PUFF_texture = arcade.make_soft_circle_texture(80, (40, 40, 40))
FLASH_texture = arcade.make_soft_circle_texture(70, (128, 128, 90))
# 云 纹理
CLOUD_textures = [
    arcade.make_soft_circle_texture(50, arcade.color.WHITE),
    arcade.make_soft_circle_texture(50, arcade.color.LIGHT_GRAY),
    arcade.make_soft_circle_texture(50, arcade.color.LIGHT_BLUE),
]
# 星星 纹理
STAR_textures = [
    arcade.make_soft_circle_texture(8, arcade.color.WHITE),
    arcade.make_soft_circle_texture(8, arcade.color.PASTEL_YELLOW),
]
# 旋转器 高
SPINNER_height = 75

# 旋转器  emitter 发射器
def make_spinner():
    spinner = arcade.Emitter(
        center_xy=(SCREEN_width / 2, SPINNER_height - 5),
        emit_controller=arcade.EmitterIntervalWithTime(0.025, 2.0),
        particle_factory=lambda emitter: arcade.FadeParticle(
            filename_or_texture=random.choice(STAR_textures),
            change_xy=(0, 6.0),
            lifetime=0.2
        )
    )
    spinner.change_angle = 16.28
    return spinner


def make_rocket(emit_done_cb):
    """当烟花炮弹升入天空时显示烟雾轨迹的发射器"""
    rocket = RocketEmitter(
        center_xy=(random.uniform(100, SCREEN_width - 100), 25),
        emit_controller=arcade.EmitterIntervalWithTime(0.04, 2.0),
        particle_factory=lambda emitter: arcade.FadeParticle(
            filename_or_texture=ROCKET_smoke_texture,
            change_xy=arcade.rand_in_circle((0.0, 0.0), 0.08),
            scale=0.5,
            lifetime=random.uniform(1.0, 1.5),
            start_alpha=100,
            end_alpha=0,
            mutation_callback=rocket_smoke_mutator
        ),
        emit_done_cb=emit_done_cb
    )
    rocket.change_x = random.uniform(-1.0, 1.0) #
    rocket.change_y = random.uniform(5.0, 7.25)
    return rocket


def make_flash(prev_emitter):
    """当烟花炮弹爆炸时显示短暂闪光的返回发射器"""
    return arcade.Emitter(
        center_xy=prev_emitter.get_pos(),
        emit_controller=arcade.EmitBurst(3),
        particle_factory=lambda emitter: arcade.FadeParticle(
            filename_or_texture=FLASH_texture,
            change_xy=arcade.rand_in_circle((0.0, 0.0), 3.5),
            lifetime=0.15
        )
    )


def make_puff(prev_emitter):
    """返回发射器,用于生成烟花炮弹爆炸后留下的细微烟雾云"""
    return arcade.Emitter(
        center_xy=prev_emitter.get_pos(),
        emit_controller=arcade.EmitBurst(4),
        particle_factory=lambda emitter: arcade.FadeParticle(
            filename_or_texture=PUFF_texture,
            change_xy=(_Vec2(arcade.rand_in_circle((0.0, 0.0), 0.4)) + _Vec2(0.3, 0.0)).as_tuple(),
            lifetime=4.0
        )
    )


class AnimatedAlphaParticle(arcade.LifetimeParticle):
    """在三个不同的alpha级别之间设置动画的自定义粒子"""

    def __init__(
            self,
            filename_or_texture: arcade.FilenameOrTexture,
            change_xy: Vector,
            start_alpha: int = 0,
            duration1: float = 1.0,
            mid_alpha: int = 255,
            duration2: float = 1.0,
            end_alpha: int = 0,
            center_xy: Point = (0.0, 0.0),
            angle: float = 0,
            change_angle: float = 0,
            scale: float = 1.0,
            mutation_callback=None,
    ):
        super().__init__(filename_or_texture,
                         change_xy,
                         duration1 + duration2,
                         center_xy,
                         angle,
                         change_angle,
                         scale,
                         start_alpha,
                         mutation_callback)
        self.start_alpha = start_alpha
        self.in_duration = duration1
        self.mid_alpha = mid_alpha
        self.out_duration = duration2
        self.end_alpha = end_alpha

    def update(self):
        super().update()
        if self.lifetime_elapsed <= self.in_duration:
            u = self.lifetime_elapsed / self.in_duration
            self.alpha = arcade.clamp(arcade.lerp(self.start_alpha, self.mid_alpha, u), 0, 255)
        else:
            u = (self.lifetime_elapsed - self.in_duration) / self.out_duration
            self.alpha = arcade.clamp(arcade.lerp(self.mid_alpha, self.end_alpha, u), 0, 255)


class RocketEmitter(arcade.Emitter):
    """自定义发射器类,向发射器添加重力以表示烟花外壳上的重力"""

    def update(self):
        super().update()
        # 重力
        self.change_y += -0.05


class Game(arcade.Window):
    def __init__(self):
        super().__init__(SCREEN_width, SCREEN_height, '粒子焰火')

        file_path = os.path.dirname(os.path.abspath(__file__))
        os.chdir(file_path)

        arcade.set_background_color(arcade.color.BLACK)
        self.emitters = []

        self.launch_firework(0)
        arcade.schedule(self.launch_spinner, 4.0)

        stars = arcade.Emitter(
            center_xy=(0.0, 0.0),
            emit_controller=arcade.EmitMaintainCount(20),
            particle_factory=lambda emitter: AnimatedAlphaParticle(
                filename_or_texture=random.choice(STAR_textures),
                change_xy=(0.0, 0.0),
                start_alpha=0,
                duration1=random.uniform(2.0, 6.0),
                mid_alpha=128,
                duration2=random.uniform(2.0, 6.0),
                end_alpha=0,
                center_xy=arcade.rand_in_rect((0.0, 0.0), SCREEN_width, SCREEN_height)
            )
        )
        self.emitters.append(stars)

        self.cloud = arcade.Emitter(
            center_xy=(50, 500),
            change_xy=(0.15, 0),
            emit_controller=arcade.EmitMaintainCount(60),
            particle_factory=lambda emitter: AnimatedAlphaParticle(
                filename_or_texture=random.choice(CLOUD_textures),
                change_xy=(_Vec2(arcade.rand_in_circle((0.0, 0.0), 0.04)) + _Vec2(0.1, 0)).as_tuple(),
                start_alpha=0,
                duration1=random.uniform(5.0, 10.0),
                mid_alpha=255,
                duration2=random.uniform(5.0, 10.0),
                end_alpha=0,
                center_xy=arcade.rand_in_circle((0.0, 0.0), 50)
            )
        )
        self.emitters.append(self.cloud)

    def launch_firework(self, delta_time):
        launchers = (
            self.launch_random_firework,
            self.launch_ringed_firework,
            self.launch_sparkle_firework,
        )
        random.choice(launchers)(delta_time)
        pyglet.clock.schedule_once(self.launch_firework, random.uniform(1.5, 2.5))

    def launch_random_firework(self, _delta_time):
        """以随机颜色爆炸的简单烟花"""
        rocket = make_rocket(self.explode_firework)
        self.emitters.append(rocket)

    def launch_ringed_firework(self, _delta_time):
        """"具有基本爆炸和不同颜色圆环形烟花"""
        rocket = make_rocket(self.explode_ringed_firework)
        self.emitters.append(rocket)

    def launch_sparkle_firework(self, _delta_time):
        """火花闪烁的烟花"""
        rocket = make_rocket(self.explode_sparkle_firework)
        self.emitters.append(rocket)

    def launch_spinner(self, _delta_time):
        """启动喷射火花的旋转器"""
        spinner1 = make_spinner()
        spinner2 = make_spinner()
        spinner2.angle = 180
        self.emitters.append(spinner1)
        self.emitters.append(spinner2)

    def explode_firework(self, prev_emitter):
        """烟花炮弹爆炸时发生的动作,生成典型的烟花"""
        self.emitters.append(make_puff(prev_emitter))
        self.emitters.append(make_flash(prev_emitter))

        spark_texture = random.choice(SPARK_textures)
        sparks = arcade.Emitter(
            center_xy=prev_emitter.get_pos(),
            emit_controller=arcade.EmitBurst(random.randint(30, 40)),
            particle_factory=lambda emitter: arcade.FadeParticle(
                filename_or_texture=spark_texture,
                change_xy=arcade.rand_in_circle((0.0, 0.0), 9.0),
                lifetime=random.uniform(0.5, 1.2),
                mutation_callback=firework_spark_mutator
            )
        )
        self.emitters.append(sparks)

    def explode_ringed_firework(self, prev_emitter):
        """当烟花炮弹爆炸时发生的动作,产生环形烟花"""
        self.emitters.append(make_puff(prev_emitter))
        self.emitters.append(make_flash(prev_emitter))

        spark_texture, ring_texture = random.choice(SPARK_list)
        sparks = arcade.Emitter(
            center_xy=prev_emitter.get_pos(),
            emit_controller=arcade.EmitBurst(25),
            particle_factory=lambda emitter: arcade.FadeParticle(
                filename_or_texture=spark_texture,
                change_xy=arcade.rand_in_circle((0.0, 0.0), 8.0),
                lifetime=random.uniform(0.55, 0.8),
                mutation_callback=firework_spark_mutator
            )
        )
        self.emitters.append(sparks)

        ring = arcade.Emitter(
            center_xy=prev_emitter.get_pos(),
            emit_controller=arcade.EmitBurst(20),
            particle_factory=lambda emitter: arcade.FadeParticle(
                filename_or_texture=ring_texture,
                change_xy=arcade.rand_on_circle((0.0, 0.0), 5.0) + arcade.rand_in_circle((0.0, 0.0), 0.25),
                lifetime=random.uniform(1.0, 1.6),
                mutation_callback=firework_spark_mutator
            )
        )
        self.emitters.append(ring)

    def explode_sparkle_firework(self, prev_emitter):
        """烟花炮弹爆炸时发生的动作,产生闪闪发光的烟花"""
        self.emitters.append(make_puff(prev_emitter))
        self.emitters.append(make_flash(prev_emitter))

        spark_texture = random.choice(SPARK_textures)
        sparks = arcade.Emitter(
            center_xy=prev_emitter.get_pos(),
            emit_controller=arcade.EmitBurst(random.randint(30, 40)),
            particle_factory=lambda emitter: AnimatedAlphaParticle(
                filename_or_texture=spark_texture,
                change_xy=arcade.rand_in_circle((0.0, 0.0), 9.0),
                start_alpha=255,
                duration1=random.uniform(0.6, 1.0),
                mid_alpha=0,
                duration2=random.uniform(0.1, 0.2),
                end_alpha=255,
                mutation_callback=firework_spark_mutator
            )
        )
        self.emitters.append(sparks)

    def update(self, delta_time):
        # 在遍历列表时,防止列表发生变化(通常是通过回调)
        emitters_to_update = self.emitters.copy()
        # 更新云
        if self.cloud.center_x > SCREEN_width:
            self.cloud.center_x = 0
        # 更新
        for e in emitters_to_update:
            e.update()
        # 清除
        to_del = [e for e in emitters_to_update if e.can_reap()]
        for e in to_del:
            self.emitters.remove(e)

    def on_draw(self):
        self.clear()
        for e in self.emitters:
            e.draw()
        # 画距形,left, right, top, and bottom
        arcade.draw_lrtb_rectangle_filled(0, SCREEN_width, 25, 0, arcade.color.DARK_GREEN)
        mid = SCREEN_width / 2
        arcade.draw_lrtb_rectangle_filled(mid - 2, mid + 2, SPINNER_height, 10, arcade.color.DARK_BROWN)

    def on_key_press(self, key, modifiers):
        if key == arcade.key.ESCAPE:
            arcade.close_window()


def firework_spark_mutator(particle: arcade.FadeParticle):
    """所有焰火火花共享的mutation_callback"""
    # 重力
    particle.change_y += -0.03
    # drag
    particle.change_x *= 0.92
    particle.change_y *= 0.92


def rocket_smoke_mutator(particle: arcade.LifetimeParticle):
    particle.scale = arcade.lerp(0.5, 3.0, particle.lifetime_elapsed / particle.lifetime_original)


if __name__ == "__main__":
    app = Game()
    arcade.run()

源码获取

关注博主后,私聊博主免费获取
需要技术指导,育娃新思考,企业软件合作等更多服务请联系博主

今天是以此模板持续更新此育儿专栏的第 13/50次。
可以关注我,点赞我、评论我、收藏我啦。

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

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

相关文章

【读点论文】Densely Connected Convolutional Networks用残差连接大力出奇迹,进一步叠加特征图,以牺牲显存为代价

Densely Connected Convolutional Networks Abstract 如果卷积网络在靠近输入的层和靠近输出的层之间包含较短的连接&#xff0c;则卷积网络可以训练得更深入、更准确和有效。在本文中&#xff0c;接受了这种观察&#xff0c;并介绍了密集卷积网络(DenseNet)&#xff0c;它以…

Linux - Linux下Java安装路径查找;配置Java环境变量

一、查看Java的安装路径 1、已经安装好了JDK&#xff0c;也配置了环境变量 1、执行 java -version java -version 出现了版本号&#xff0c;表示安装过了JDK&#xff0c;配置了环境变量 2、在配置过jdk的情况下&#xff0c;执行java -verbose指令&#xff0c;在打印出的文本…

java stream中的peek()用法

文章目录前言最终操作&#xff08;terminal operation&#xff09;peek() vs forEach()peek() 的典型用法&#xff1a;协助调试总结前言 最近看到一段代码&#xff1a; aeFormList.stream().peek(object -> saveInfomation(object, params)).collect(Collectors.toList())…

std::shared_ptr(基础、仿写、安全性)

目录 一、c参考手册 1、解释说明 2、代码示例 3、运行结果 二、对std::shared_ptr分析 1、shared_ptr基础 2、创建shared_ptr实例 3、访问所指对象 4、拷贝和赋值操作 5、检查引用计数 三、仿写std::shared_ptr代码 1、单一对象 2、数组对象 四、shared_ptr遇到问…

MyBatis 环境搭建

MyBatis 环境搭建步骤 1.创建一张表和表对应的实体类 2.创建一个 maven 项目&#xff0c;把项目添加到 git 仓库 创建maven项目 教程见&#xff1a;Maven[项目构建工具]_chen☆的博客-CSDN博客 添加到git仓库&#xff1a; 3.在文件 pom.xml 添加 mybiatis 相关依赖(导入 MyBa…

Java - 利用Nacos做一个动态开关配置功能

Java - 利用Nacos做一个动态开关配置功能前言一. Nacos配置类编写二. 测试三. 展望前言 我公司里有一个Config配置功能&#xff08;我相信这是很普遍的一个功能&#xff09;。简单来说就是&#xff1a; 将相关的键值对放到这个Config配置系统里面。代码里通过这个Config配置系…

博客项目(前台功能实现)

博客项目(前台接口实现) 文章目录博客项目(前台接口实现)1.前置知识1.1Controller1.1.1ResponseResult类1.1.2该类的方法1.2Service1.3ServiceImpl1.4Mapper1.5Vo的理解1.6可能会用到的相关插件1.7设置字面量1.8后端接口测试工具2.热门文章接口分析2.1热门文章接口位置2.2接口的…

Internet Download Manager2023最新版下载器功能介绍

说到下载器在国内就不得不提迅雷&#xff0c;迅雷真是伟大&#xff0c;几乎垄断了国内的下载市场&#xff0c;的确&#xff0c;有的时候用迅雷可以下载到很不错的资源&#xff0c;但在没有VIP的情况下&#xff0c;迅雷是不友好的&#xff0c;相信使用迅雷的各位都有被限速过的经…

三、Eureka

文章目录一、认识服务提供者和服务调用者二、Eureka 的工作流程三、服务调用出现的问题及解决方法四、搭建 eureka-server五、注册 user-service、order-service六、在 order-service 完成服务拉取&#xff08;order 模块能访问 user 模块&#xff09;七、配置远程服务调用八、…

分布式锁:不同实现方式实践测评

Hello读者朋友们&#xff0c;今天打算分享一篇测评实践类的文章&#xff0c;用优雅的代码与真实的数据来讲述在分布式场景下&#xff0c;不同方式实现的分布式锁&#xff0c;分别探究每一种方式的性能情况与最终的优劣分析。 开门见山&#xff0c;我们先看一张表格&#xff0c…

fiddler安卓模拟器与ios手机抓包

一.安卓模拟器(雷电模拟器)抓包 1.1fiddler基本配置 1.2导出Fiddler证书 Tools -> Options -> HTTPS -> Actions -> Export Root Certificate to Desktop 在桌面上看到导出的FiddlerRoot.cer证书文件 1.3下载和安装openssl openssl下载地址 git终端输入 open…

蜂鸟E203学习(一)--RISC的前世今生

第一章 CPU之前世今生 1.1、CPU众生相 1.1.1 处理器&#xff08;cpu&#xff09;和处理器内核&#xff08;core&#xff09;的区分 处理器严格意义上是soc&#xff0c;包含了内核和其他设备或者存储器. 1.1.2 不同CPU架构的诞生时间 CPU架构诞生时间Intel 80861978年ARM19…

Opencv之Mat常用类成员(一篇就够了)

1. 重要类成员 data&#xff1a;数据存储的起始地址 (uchar*类型)&#xff1b;dims&#xff1a;矩阵维度。如 3 * 4 的矩阵为 2 维&#xff0c; 3 * 4 * 5 的为3维&#xff1b;channels()&#xff1a;通道数量&#xff0c;矩阵中表示一个元素所需要的值的个数。例&#xff1a;…

Docker-系统环境

Docker1.Docker与虚拟机的区别2.Docker主要解决的问题3.镜像和容器4.Docker的安装9.查找镜像10.常用命令11.安装数据库12.安装tomcat13.容器使用注意事项1.Docker与虚拟机的区别 Docker是开发运行和部署应用程序的开发管理平台&#xff0c;它类似于虚拟机&#xff0c;可以独立…

七、Feign

文章目录一、Feign实现远程调用1.替换RestTemplate发起远程调用&#xff0c;RestTemplate存在的问题&#xff1a;2.实现Feign远程调用&#xff1a;二、Feign的自定义日志1.Feign可修改的配置如下2.方式一&#xff1a;配置文件方式3.方式二&#xff1a;Java代码方式一、Feign实现…

Qt:信号与槽机制

说实话&#xff0c;Qt给我的感觉像一种魔改版c&#xff0c;不纯粹&#xff0c;看不到内部的源代码&#xff0c;也不知道一些宏是怎么实现的... 信号与槽内部机制 回归正题&#xff0c;其实学过设计模式的应该都能看出来&#xff0c;qt的这个机制是一个观察者模式&#xff1b; …

又解锁了一种OpenFeign的使用方式!

引言 Hello 大家好&#xff0c;这里是Anyin。 在关于OpenFeign那点事儿 - 使用篇 中和大家分享了关于OpenFeign在某些场景下的一些处理和使用方法&#xff0c;而今天Anyin再次解锁了OpenFeign的又一个使用场景&#xff0c;只能说真香。 在我们日常开发中&#xff0c;相信大家…

SSM框架-MyBatis基础

1. MyBatis简介 1.1 MyBatis历史 MyBatis最初是Apache的一个开源项目iBatis&#xff0c;2010年6月这个项目由Apache Software Foundation迁移到了Google Code。随着开发团队转投Google Code旗下&#xff0c;iBatis3.x正式更名为MyBatis。代码于2013年11月迁移到Github。 iBa…

Pipelines in Shell

本篇文章内容需要读者知道 shell 的一些语法和作用&#xff0c;知道 shell 的用途&#xff0c;和一些基本的用法。 这里可以查看原文&#xff1a;Pipelines in Shell 学习 shell 脚本必须要理解 pipeline 的概念&#xff0c;知道 command 的输入&#xff08;input&#xff09;和…

编译概念总结

一个很笨很笨的人的编译自救笔记。 1 程序设计语言 程序设计语言用于书写计算机程序的语言。语言的基础是一组记号和一组规则。根据规则由记号构成的记号串的总体就是语言。在程序设计语言中&#xff0c;这些记号串就是程序。 程序设计语言由三个方面的因素&#xff0c;语法…