Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Game Library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Game Development
Game Library
Commits
6f64a0fd
Commit
6f64a0fd
authored
3 years ago
by
Joseph Walton-Rivers
Browse files
Options
Downloads
Patches
Plain Diff
make glfw use the same pseudo-module approach
parent
bf3e5186
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#3039
failed
3 years ago
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
demo/main.cpp
+7
-5
7 additions, 5 deletions
demo/main.cpp
fggl/gfx/compat.hpp
+43
-0
43 additions, 0 deletions
fggl/gfx/compat.hpp
fggl/gfx/window.cpp
+3
-3
3 additions, 3 deletions
fggl/gfx/window.cpp
fggl/gfx/window.hpp
+3
-3
3 additions, 3 deletions
fggl/gfx/window.hpp
with
56 additions
and
11 deletions
demo/main.cpp
+
7
−
5
View file @
6f64a0fd
...
...
@@ -6,6 +6,8 @@
#include
<fggl/gfx/window.hpp>
#include
<fggl/gfx/camera.hpp>
#include
<fggl/gfx/compat.hpp>
#include
<fggl/gfx/ogl/compat.hpp>
#include
<fggl/data/procedural.hpp>
...
...
@@ -170,16 +172,16 @@ void process_freecam(fggl::gfx::Window& window, fggl::ecs::ECS& ecs, fggl::gfx::
}
int
main
(
int
argc
,
char
*
argv
[])
{
fggl
::
gfx
::
Context
ctx
;
// setup ECS
fggl
::
ecs
::
ECS
ecs
;
// build our main window
auto
glfwModule
=
fggl
::
gfx
::
ecsInitGlfw
(
ecs
);
fggl
::
gfx
::
Window
win
(
fggl
::
gfx
::
Input
::
instance
()
);
win
.
title
(
"FGGL Demo"
);
win
.
fullscreen
(
true
);
// setup ECS
fggl
::
ecs
::
ECS
ecs
;
// storage API
fggl
::
data
::
Storage
storage
;
discover
(
storage
.
resolvePath
(
fggl
::
data
::
Data
,
"res"
)
);
...
...
@@ -260,7 +262,7 @@ int main(int argc, char* argv[]) {
while
(
!
win
.
closeRequested
()
)
{
input
.
frame
();
ctx
.
pollEvents
();
glfwModule
->
context
.
pollEvents
();
debug
.
frameStart
();
// update step
...
...
This diff is collapsed.
Click to expand it.
fggl/gfx/compat.hpp
0 → 100644
+
43
−
0
View file @
6f64a0fd
#ifndef FGGL_GFX_GLFW_COMPAT_H
#define FGGL_GFX_GLFW_COMPAT_H
/**
* Window management Calls.
*
* This shouldn't be exposed to the demo app, but the ECS we're using isn't smart enouph to allow us to
* abstract this yet. It's next thing on the list, but this branch is about cleaning up OpenGL not about
* extending our ECS.
*
* Should be removed when the engine has suitable abstractions in place.
*/
#include
<memory>
#include
<fggl/gfx/window.hpp>
#include
<fggl/ecs/ecs.hpp>
namespace
fggl
::
gfx
{
//
// fake module support - allows us to still RAII
//
struct
ecsGlfwModule
{
GlfwContext
context
;
inline
ecsGlfwModule
()
:
context
()
{
}
};
using
GlfwModule
=
std
::
shared_ptr
<
ecsGlfwModule
>
;
//
// fake module/callbacks - our ECS doesn't have module/callback support yet.
//
inline
GlfwModule
ecsInitGlfw
(
ecs
::
ECS
&
ecs
)
{
auto
mod
=
std
::
make_shared
<
ecsGlfwModule
>
();
return
mod
;
}
}
#endif
This diff is collapsed.
Click to expand it.
fggl/gfx/window.cpp
+
3
−
3
View file @
6f64a0fd
...
...
@@ -91,7 +91,7 @@ static void fggl_joystick(int jid, int state) {
}
}
Context
::
Context
()
{
Glfw
Context
::
Glfw
Context
()
{
glfwInitHint
(
GLFW_JOYSTICK_HAT_BUTTONS
,
GLFW_FALSE
);
int
state
=
glfwInit
();
...
...
@@ -106,11 +106,11 @@ Context::Context() {
glfwSetJoystickCallback
(
fggl_joystick
);
}
Context
::~
Context
()
{
Glfw
Context
::~
Glfw
Context
()
{
glfwTerminate
();
}
void
Context
::
pollEvents
()
{
void
Glfw
Context
::
pollEvents
()
{
glfwPollEvents
();
fggl_joystick_poll
();
}
...
...
This diff is collapsed.
Click to expand it.
fggl/gfx/window.hpp
+
3
−
3
View file @
6f64a0fd
...
...
@@ -10,10 +10,10 @@
namespace
fggl
::
gfx
{
class
Context
{
class
Glfw
Context
{
public:
Context
();
~
Context
();
Glfw
Context
();
~
Glfw
Context
();
void
pollEvents
();
};
...
...
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