Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
hw3d
Commits
83156329
Commit
83156329
authored
Dec 26, 2018
by
chili
Browse files
basic app class
parent
380f88b3
Changes
5
Hide whitespace changes
Inline
Side-by-side
hw3d/App.cpp
0 → 100644
View file @
83156329
#include "App.h"
App
::
App
()
:
wnd
(
800
,
600
,
"The Donkey Fart Box"
)
{}
int
App
::
Go
()
{
MSG
msg
;
BOOL
gResult
;
while
(
(
gResult
=
GetMessage
(
&
msg
,
nullptr
,
0
,
0
))
>
0
)
{
// TranslateMessage will post auxilliary WM_CHAR messages from key msgs
TranslateMessage
(
&
msg
);
DispatchMessage
(
&
msg
);
DoFrame
();
}
// check if GetMessage call itself borked
if
(
gResult
==
-
1
)
{
throw
CHWND_LAST_EXCEPT
();
}
// wParam here is the value passed to PostQuitMessage
return
msg
.
wParam
;
}
void
App
::
DoFrame
()
{
}
\ No newline at end of file
hw3d/App.h
0 → 100644
View file @
83156329
#pragma once
#include "Window.h"
class
App
{
public:
App
();
// master frame / message loop
int
Go
();
private:
void
DoFrame
();
private:
Window
wnd
;
};
\ No newline at end of file
hw3d/WinMain.cpp
View file @
83156329
...
...
@@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License *
* along with The Chili Direct3D Engine. If not, see <http://www.gnu.org/licenses/>. *
******************************************************************************************/
#include "
Window
.h"
#include "
App
.h"
int
CALLBACK
WinMain
(
...
...
@@ -28,25 +28,7 @@ int CALLBACK WinMain(
{
try
{
Window
wnd
(
800
,
300
,
"Donkey Fart Box"
);
MSG
msg
;
BOOL
gResult
;
while
(
(
gResult
=
GetMessage
(
&
msg
,
nullptr
,
0
,
0
))
>
0
)
{
// TranslateMessage will post auxilliary WM_CHAR messages from key msgs
TranslateMessage
(
&
msg
);
DispatchMessage
(
&
msg
);
}
// check if GetMessage call itself borked
if
(
gResult
==
-
1
)
{
throw
CHWND_LAST_EXCEPT
();
}
// wParam here is the value passed to PostQuitMessage
return
msg
.
wParam
;
return
App
{}.
Go
();
}
catch
(
const
ChiliException
&
e
)
{
...
...
hw3d/hw3d.vcxproj
View file @
83156329
...
...
@@ -145,6 +145,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile
Include=
"App.cpp"
/>
<ClCompile
Include=
"ChiliException.cpp"
/>
<ClCompile
Include=
"Keyboard.cpp"
/>
<ClCompile
Include=
"Mouse.cpp"
/>
...
...
@@ -153,6 +154,7 @@
<ClCompile
Include=
"WinMain.cpp"
/>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"App.h"
/>
<ClInclude
Include=
"ChiliException.h"
/>
<ClInclude
Include=
"ChiliWin.h"
/>
<ClInclude
Include=
"Keyboard.h"
/>
...
...
hw3d/hw3d.vcxproj.filters
View file @
83156329
...
...
@@ -33,6 +33,9 @@
<ClCompile
Include=
"Mouse.cpp"
>
<Filter>
Source Files
</Filter>
</ClCompile>
<ClCompile
Include=
"App.cpp"
>
<Filter>
Source Files
</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"WindowsMessageMap.h"
>
...
...
@@ -56,6 +59,9 @@
<ClInclude
Include=
"Mouse.h"
>
<Filter>
Header Files
</Filter>
</ClInclude>
<ClInclude
Include=
"App.h"
>
<Filter>
Header Files
</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile
Include=
"hw3d.rc"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment