51 lines
1.3 KiB
C++
51 lines
1.3 KiB
C++
/*
|
|
* 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());
|
|
}
|
|
|
|
};
|
|
|
|
// #if defined(__ANDROID__) || defined(ANDROID)
|
|
// int SDL_main()
|
|
// {
|
|
// FillScreen fill_screen = FillScreen();
|
|
// fill_screen.load_gl_context();
|
|
// fill_screen.run();
|
|
// fill_screen.quit();
|
|
// return 0;
|
|
// }
|
|
// #else
|
|
/* Create a game object, load its GL context, and run the game. */
|
|
int main(int argc, char* argv[])
|
|
{
|
|
FillScreen fill_screen = FillScreen();
|
|
fill_screen.load_gl_context();
|
|
fill_screen.run();
|
|
fill_screen.quit();
|
|
return 0;
|
|
}
|
|
// #endif
|