2022-11-08 17:16:05 -05:00
|
|
|
/*!<pre>
|
|
|
|
* /\ +------------------------------------------------------+
|
|
|
|
* ____/ \____ /| - Open source game framework licensed to freely use, |
|
|
|
|
* \ / / | copy, modify and sell without restriction |
|
|
|
|
* +--\ ^__^ /--+ | |
|
|
|
|
* | ~/ \~ | | - created for <https://foam.shampoo.ooo> |
|
|
|
|
* | ~~~~~~~~~~~~ | +------------------------------------------------------+
|
|
|
|
* | SPACE ~~~~~ | /
|
|
|
|
* | ~~~~~~~ BOX |/
|
|
|
|
* +--------------+ </pre>
|
|
|
|
*
|
2022-10-07 18:56:20 -04:00
|
|
|
* Fill screen example by frank at shampoo.ooo
|
|
|
|
*
|
|
|
|
* This is an example program that fills the screen with a color every frame. It is a minimal example of a SPACEBOX program
|
|
|
|
* that can be used for testing builds.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "Game.hpp"
|
|
|
|
|
|
|
|
class FillScreen : public Game
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/* Color component values that will increment each frame to combine into a different solid color. */
|
|
|
|
float red = 1.0f, green = 0.5f, blue = 0.25f;
|
|
|
|
|
|
|
|
/* This gets called every frame by the parent class. Clear the screen with a solid color. */
|
|
|
|
void update()
|
|
|
|
{
|
|
|
|
red += 0.004f;
|
|
|
|
green += 0.002f;
|
|
|
|
blue += 0.001f;
|
|
|
|
glClearColor(std::abs(red - int(red) - 0.5f), std::abs(green - int(green) - 0.5f), std::abs(blue - int(blue) - 0.5f), 1.0f);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
|
|
SDL_GL_SwapWindow(window());
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Create a game object, load its GL context, and run the game. */
|
2022-10-17 21:57:56 -04:00
|
|
|
int main(int argc, char* argv[])
|
2022-10-07 18:56:20 -04:00
|
|
|
{
|
|
|
|
FillScreen fill_screen = FillScreen();
|
|
|
|
fill_screen.load_gl_context();
|
|
|
|
fill_screen.run();
|
|
|
|
fill_screen.quit();
|
|
|
|
return 0;
|
|
|
|
}
|