Xyris
0.5
animation.cpp
Go to the documentation of this file.
1
/**
2
* @file animation.cpp
3
* @author Michel (JMallone) Gomes (
[email protected]
)
4
* @brief A simple animation for testing duble FrameBuffer
5
* @version 0.1
6
* @date 2021-07-24
7
*
8
* @copyright Copyright the Xyris Contributors (c) 2021
9
*
10
*/
11
#include <
Applications/animation.hpp
>
12
#include <
Devices/Graphics/graphics.hpp
>
13
14
namespace
Apps
{
15
16
void
testAnimation
()
17
{
18
int
x = 10;
19
while
(1) {
20
if
(x > 250)
21
x = 10;
22
23
Graphics::resetDoubleBuffer
();
24
//background
25
Graphics::putrect
(0,0,280,280,0x00FFFF);
26
x+=10;
27
//snake
28
Graphics::putrect
(x,10,10,10,0xFF0000);
29
//apple
30
Graphics::putrect
(50,30,10,10,0xFFFF00);
31
Graphics::swap
();
32
}
33
}
34
35
}
graphics.hpp
Apps
Definition:
animation.cpp:14
Graphics::swap
void swap()
Swap the data on backbuffer to memory video buffer and show in the screen.
Definition:
graphics.cpp:93
Graphics::resetDoubleBuffer
void resetDoubleBuffer()
Fill the backbuffer with '0'.
Definition:
graphics.cpp:86
Apps::testAnimation
void testAnimation()
Run a simple animation.
Definition:
animation.cpp:16
animation.hpp
Graphics::putrect
void putrect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t color)
Draws and fills a rectangle of a given width and height, and color at the provided coordinates.
Definition:
graphics.cpp:71
Kernel
Applications
animation.cpp
Generated by
1.8.17