惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
雷峰网
雷峰网
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
V
Visual Studio Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 聂微东
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
U
Unit 42
W
WeLiveSecurity
博客园 - Franky
Recent Announcements
Recent Announcements
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
月光博客
月光博客
The Cloudflare Blog
Spread Privacy
Spread Privacy
腾讯CDC
P
Privacy International News Feed
N
News and Events Feed by Topic
AWS News Blog
AWS News Blog
NISL@THU
NISL@THU
T
Troy Hunt's Blog
小众软件
小众软件
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Microsoft Security Blog
Microsoft Security Blog
L
Lohrmann on Cybersecurity
Webroot Blog
Webroot Blog
Y
Y Combinator Blog
量子位
P
Palo Alto Networks Blog
N
News and Events Feed by Topic
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
IT之家
IT之家
T
Threat Research - Cisco Blogs
Cloudbric
Cloudbric
云风的 BLOG
云风的 BLOG
C
Check Point Blog
Blog — PlanetScale
Blog — PlanetScale
爱范儿
爱范儿
G
Google Developers Blog
S
Secure Thoughts

洛屿的小站

STM32F407 IAR环境下uC/OS-III移植完整指南 STM32 UCOS3+HAL库集成中的FPU HardFault问题 一种简单的卡尔曼滤波器设计 Cadence - 应律而动,落指成音 Zephyr - 聆风之息,为你而奏 不改一行插件代码,实现消息优先级与阻断 洛玖定时任务系统 在 butterfly 主题中添加首页点集动画(基于p2line项目) 你好,2026 stm32f4xx-ads1256驱动 stm32f4xx-ad9854并行驱动 主动式网站状态监测实现及其应用 右键菜单加入用Trae打开文件和文件夹 三角洲行动ID映射表 洛玖SDK说明 为网页文章开头添加原文连接 Hexo-Butterfly主题在主页添加GitHub贡献日历 Proteus中555定时器仿真问题 装饰器 洛玖开发日记 STS3032舵机获取力矩输出 kotlin网页前后端那些事 mspm0g3507-ad9850 奇怪的bug Paddle模型转PaddleLite 人工智能考核 构建一个yolov3网络 yolo和paddle模型常见输出参数 PaddleDetection 随便写的一些东西 实验室C语言第一次考核题目讲解及相关代码解读 C语言神经网络房价预测系统 C、C++数组,指针,指针数组,数组指针的区别 C、C++的大括号是必须的部分吗? C、C++预处理详解 C、C++其他关键字详解 C、C++存储类型关键字详解 C、C++控制语句关键字详解 C、C++数据类型关键字详解 C、C++关键字 C++药品管理系统 Bi-LSTM(Attention)的PyTorch实现 C语言实现波士顿房价预测 edgeboardFZ3A相关问题 Predict.py的编写 Paddle环境搭建 百度Paddle模型训练 GMD09601-0.96OLED显示屏 【LeetCode 1617】统计子树中城市之间最大距离 C语言学习相关 STM32阵列按键 CH32(F10X F20X) 最短路 拓扑排序
easy库的使用
洛屿 · 2023-06-12 · via 洛屿的小站

加载动画

easyx库本身并没有给出gif的加载函数,所以我们需要通过另一种方式实现gif的“播放

通过将gif图提取出相应关键帧,然后对关键帧进行逐帧播放

以下是代码示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <graphics.h>
#include <conio.h>
#include <stdio.h>
#include <iostream>

IMAGE images[92];//92张关键帧
bool isLoaded = 0;
void loadImg() {
wchar_t filename[20];
for (int i = 0; i < 92; i++) {
//这里我是将原有的gif图拆分为了92张关键帧
wsprintf(filename, _T("../gif/%d.png"), i + 1);
loadimage(&images[i], filename, 1080, 810);//读相关图片,并设置读入大小为1080*810
}
}

void loading() {
std::cout << "窗口初始化中..." << std::endl;
// 加载关键帧图片
if (!isLoaded) {
isLoaded = 1;
loadImg();
}
HWND hwnd = initgraph(1080, 810); // 初始化绘图窗口大小
MoveWindow(hwnd, 380, 200, 1096, 849, false);

//采用批量绘制,防闪烁
BeginBatchDraw();//批量绘制开始

for (int i = 0; i < 92; i++) {
cleardevice(); // 清空屏幕
putimage(0, 0, &images[i]); // 绘制当前帧图片
FlushBatchDraw(); // 批量绘制刷新
Sleep(25); // 控制每帧显示时间,单位为毫秒
}
EndBatchDraw();//批量绘制结束
std::cout << "窗口初始化完毕" << std::endl;
}


辅助函数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

#include <codecvt>
#include <comutil.h>
#include <string>
#pragma comment(lib, "comsuppw.lib")

#define _MIN(x,y) (((x)<(y))?(x):(y))

//wstring转string
std::string wstringTostring(const std::wstring& ws) {
_bstr_t t = ws.c_str();
char* pchar = (char*)t;
std::string result = pchar;
return result;
}

//string转wstring
std::wstring stringTowstring(const std::string& s) {
_bstr_t t = s.c_str();
wchar_t* pwchar = (wchar_t*)t;
std::wstring result = pwchar;
return result;
}

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 洛屿的小站

打赏

  • wechat

    wechat

  • alipay

    alipay