penguins
1.0.0
main.cc
Go to the documentation of this file.
1
#include "
gui/main.hh
"
2
#include "
gui/game.hh
"
3
#include "resources_appicon_16_png.h"
4
#include "resources_appicon_256_png.h"
5
#include "resources_appicon_64_png.h"
6
#include <
wx/app.h
>
7
#include <
wx/defs.h
>
8
#include <
wx/gdicmn.h
>
9
#include <
wx/iconbndl.h
>
10
#include <
wx/image.h
>
11
#include <
wx/imagpng.h
>
12
#include <
wx/mstream.h
>
13
#include <
wx/stdpaths.h
>
14
#include <
wx/version.h
>
15
16
wxIMPLEMENT_APP
(
PenguinsApp
);
17
18
bool
PenguinsApp::OnInit
() {
19
if
(!
wxApp::OnInit
())
return
false
;
20
21
this->
SetAppName
(
"penguins-game-gui"
);
22
#if wxCHECK_VERSION(3, 1, 1)
23
wxStandardPaths::Get
().
SetFileLayout
(wxStandardPathsBase::FileLayout_XDG);
24
#endif
25
wxImage::AddHandler
(
new
wxPNGHandler
());
26
tileset
.
load
();
27
28
auto
add_icon = [](
wxIconBundle
& bundle,
const
void
* data,
size_t
size) {
29
wxMemoryInputStream
input_stream(data, size);
30
bundle.
AddIcon
(input_stream,
wxBITMAP_TYPE_PNG
);
31
};
32
add_icon(this->
app_icon
, resources_appicon_16_png, resources_appicon_16_png_size);
33
add_icon(this->
app_icon
, resources_appicon_64_png, resources_appicon_64_png_size);
34
add_icon(this->
app_icon
, resources_appicon_256_png, resources_appicon_256_png_size);
35
36
this->
game_frame
=
new
GameFrame
(
nullptr
,
wxID_ANY
);
37
this->
game_frame
->
Centre
();
38
this->
game_frame
->
Show
();
39
40
return
true
;
41
}
GameFrame
Definition:
game.hh:99
PenguinsApp
Definition:
main.hh:10
PenguinsApp::app_icon
wxIconBundle app_icon
Definition:
main.hh:16
PenguinsApp::OnInit
virtual bool OnInit() override
Definition:
main.cc:18
PenguinsApp::game_frame
GameFrame * game_frame
Definition:
main.hh:18
PenguinsApp::tileset
TilesetHelper tileset
Definition:
main.hh:17
TilesetHelper::load
void load()
Definition:
tileset.cc:12
wxAppConsole::SetAppName
void SetAppName(const wxString &name)
wxAppConsole::OnInit
virtual bool OnInit()
wxFrame::Centre
void Centre(int direction=wxBOTH)
wxIconBundle
wxIconBundle::AddIcon
void AddIcon(const wxString &file, wxBitmapType type=wxBITMAP_TYPE_ANY)
wxImage::AddHandler
static void AddHandler(wxImageHandler *handler)
wxMemoryInputStream
wxPNGHandler
wxStandardPaths::Get
static wxStandardPaths & Get()
wxStandardPaths::SetFileLayout
void SetFileLayout(FileLayout layout)
wxWindow::Show
virtual bool Show(bool show=true)
defs.h
wxID_ANY
wxID_ANY
game.hh
gdicmn.h
wxBITMAP_TYPE_PNG
wxBITMAP_TYPE_PNG
iconbndl.h
image.h
imagpng.h
app.h
wxIMPLEMENT_APP
wxIMPLEMENT_APP(PenguinsApp)
main.hh
mstream.h
stdpaths.h
version.h
src
gui
main.cc
Generated by
1.9.1