使用 Splashkit 逐个显示多个C++图像

display mutiple C++ images on after another using splashkit

本文关键字:C++ 图像 显示 使用 Splashkit      更新时间:2023-10-16

我在使用 C++/splashkit 显示多个图像时遇到问题。

一切看起来都正确,但只显示第一个图像。

我已经创建了过程并调用了它们,但只显示了第一个图像。

代码看起来正确,但没有运气。有什么帮助吗?

这是代码:

#include "splashkit.h"
void house_drawing()
{
clear_screen(COLOR_WHITE);
fill_ellipse(COLOR_GREEN, 0, 400, 800, 400);
fill_rectangle(COLOR_BEIGE, 300, 300, 200, 200);
fill_triangle(COLOR_RED, 250, 300, 400, 150, 550, 300);
refresh_screen(60);
}
void daves_drawing()
{
clear_screen(COLOR_WHITE);
fill_ellipse(COLOR_BROWN, 0, 300, 400, 300);
fill_rectangle(COLOR_YELLOW, 200, 300, 100, 200);
fill_triangle(COLOR_PURPLE, 250, 250, 300, 200, 400, 300);
refresh_screen(60);
}
int main()
{
open_window("Shapes by dave", 800, 600);
house_drawing();
delay(1200);

open_window("daves Drawing", 800, 600);
daves_drawing();
delay(1200);

open_window("Shapes by dave", 800, 600);
house_drawing();
delay(1200);

open_window("Daves Drawing", 800, 600); 
daves_drawing();
delay(1200);

return 0;
}

您只需编写clear_screen();即可在调用函数后清除屏幕。

此外,您无需一次又一次地打开窗口。只需打开一个窗口一次,然后调用第一个窗口并写clear_screen();.

你的代码是这样的。

#include "splashkit.h"

void house_drawing()
{
clear_screen(COLOR_WHITE);
fill_ellipse(COLOR_GREEN, 0, 400, 800, 400);
fill_rectangle(COLOR_BEIGE, 300, 300, 200, 200);
fill_triangle(COLOR_RED, 250, 300, 400, 150, 550, 300);
refresh_screen(60);
}
void daves_drawing()
{
clear_screen(COLOR_WHITE);
fill_ellipse(COLOR_BROWN, 0, 300, 400, 300);
fill_rectangle(COLOR_YELLOW, 200, 300, 100, 200);
fill_triangle(COLOR_PURPLE, 250, 250, 300, 200, 400, 300);
refresh_screen(60);
}
int main()
{
open_window("Shapes by dave", 800, 600);
house_drawing();
delay(1200);
clear_screen();
daves_drawing();
delay(1200);
return 0;
}