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  */
13 
14 namespace Apps {
15 
17 {
18  int x = 10;
19  while (1) {
20  if (x > 250)
21  x = 10;
22 
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);
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