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
38a1e10c
Commit
38a1e10c
authored
2 years ago
by
Joseph Walton-Rivers
Browse files
Options
Downloads
Patches
Plain Diff
seperate the service API stuff into it's own function to improve reablity
parent
cb8b6849
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
demo/demo/main.cpp
+10
-6
10 additions, 6 deletions
demo/demo/main.cpp
with
10 additions
and
6 deletions
demo/demo/main.cpp
+
10
−
6
View file @
38a1e10c
...
...
@@ -69,19 +69,23 @@ static void test_atlas_api() {
auto
*
atlas
=
fggl
::
gfx
::
ImageAtlas
<
char
>::
pack
(
images
);
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
fggl
::
App
app
(
"fggl-demo"
);
// FIXME: janky API(s)
auto
&
locator
=
fggl
::
util
::
ServiceLocator
::
instance
();
static
void
setupServiceLocators
(
fggl
::
util
::
ServiceLocator
&
locator
)
{
// FIXME: janky API(s)
auto
inputs
=
locator
.
supply
<
fggl
::
input
::
Input
>
(
std
::
make_shared
<
fggl
::
input
::
Input
>
());
auto
storage
=
locator
.
supply
<
fggl
::
data
::
Storage
>
(
std
::
make_shared
<
fggl
::
data
::
Storage
>
());
locator
.
supply
<
fggl
::
gui
::
FontLibrary
>
(
std
::
make_shared
<
fggl
::
gui
::
FontLibrary
>
());
locator
.
supply
<
fggl
::
ecs3
::
TypeRegistry
>
(
std
::
make_shared
<
fggl
::
ecs3
::
TypeRegistry
>
());
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
fggl
::
App
app
(
"fggl-demo"
);
auto
&
locator
=
fggl
::
util
::
ServiceLocator
::
instance
();
setupServiceLocators
(
locator
);
// Would be nice to not take args like this, it messes with lifetimes
auto
&
windowing
=
app
.
use
<
fggl
::
gfx
::
ecsGlfwModule
>
(
inputs
);
auto
&
windowing
=
app
.
use
<
fggl
::
gfx
::
ecsGlfwModule
>
(
locator
.
get
<
fggl
::
input
::
Input
>
()
);
// -- should not be our problem - this is a broken api
auto
window
=
windowing
.
createWindow
(
"Demo Game"
);
...
...
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