Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
assignment_2023
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benedict Gaster
assignment_2023
Commits
23e4e6bd
Commit
23e4e6bd
authored
4 years ago
by
BG Dummy
Browse files
Options
Downloads
Patches
Plain Diff
added doxygen setup
parent
55304a6f
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+3
-1
3 additions, 1 deletion
.gitignore
Doxyfile
+2576
-0
2576 additions, 0 deletions
Doxyfile
include/graphics.hpp
+7
-5
7 additions, 5 deletions
include/graphics.hpp
main.cpp
+14
-64
14 additions, 64 deletions
main.cpp
with
2600 additions
and
70 deletions
.gitignore
+
3
−
1
View file @
23e4e6bd
a.out
html
latex
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Doxyfile
0 → 100644
+
2576
−
0
View file @
23e4e6bd
This diff is collapsed.
Click to expand it.
include/graphics.hpp
+
7
−
5
View file @
23e4e6bd
/**
*
*
\
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
...
...
This diff is collapsed.
Click to expand it.
main.cpp
+
14
−
64
View file @
23e4e6bd
#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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment