Skip to content
Snippets Groups Projects
Commit 23e4e6bd authored by BG Dummy's avatar BG Dummy
Browse files

added doxygen setup

parent 55304a6f
No related branches found
No related tags found
No related merge requests found
a.out
html
latex
\ No newline at end of file
Doxyfile 0 → 100644
This diff is collapsed.
/**
*
* \author Benedict R. Gaster
* @file
* @author Benedict R. Gaster
*/
#pragma once
......@@ -11,11 +11,13 @@
namespace uwe {
class Context {
public:
/** \brief Create a context
* \param width an integer setting the window width
* \param height an integer setting the window height
/** @brief Create a context
* @param width an integer setting the window width
* @param height an integer setting the window height
*/
Context(int width, int height);
/// Destory context
~Context();
/// Output details of GPU backend and texture formats
......
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstring>
#include <SDL2/SDL.h>
#include <graphics.hpp>
// if we're compiling for iOS (iPhone/iPad)
#ifdef __IPHONEOS__
# include <SDL2/SDL_opengles.h> // we want to use OpenGL ES
#else
# include <SDL2/SDL_opengl.h> // otherwise we want to use OpenGL
#endif
const int width = 640;
const int height = 480;
int main(int argc, char * argv[])
int main( int argc, char** argv )
{
// Initialize SDL with video
SDL_Init(SDL_INIT_VIDEO);
uwe::Context context{width, height};
// Create an SDL window
SDL_Window* window = SDL_CreateWindow("Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_OPENGL);
context.dump_renderer_info();
// if failed to create a window
if(!window)
{
// we'll print an error message and exit
std::cerr << "Error failed to create window!\n";
return 1;
}
// Create an OpenGL context (so we can use OpenGL functions)
SDL_GLContext context = SDL_GL_CreateContext(window);
// if we failed to create a context
if(!context)
{
// we'll print out an error message and exit
std::cerr << "Error failed to create a context\n!";
return 2;
}
SDL_Event event; // used to store any events from the OS
bool running = true; // used to determine if we're running the game
glClearColor(1, 0, 0, 1);
while(running)
{
// poll for events from SDL
while(SDL_PollEvent(&event))
{
// determine if the user still wants to have the window open
// (this basically checks if the user has pressed 'X')
running = event.type != SDL_QUIT;
}
glClear(GL_COLOR_BUFFER_BIT);
// Swap OpenGL buffers
SDL_GL_SwapWindow(window);
}
// Destroy the context
SDL_GL_DeleteContext(context);
// Destroy the window
SDL_DestroyWindow(window);
// And quit SDL
SDL_Quit();
context.run();
return 0;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment