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
33c43a2c
Commit
33c43a2c
authored
Jun 27, 2019
by
chili
Browse files
adjustable window size gfx fixes
parent
74d52460
Changes
4
Hide whitespace changes
Inline
Side-by-side
hw3d/App.cpp
View file @
33c43a2c
...
@@ -13,10 +13,10 @@ GDIPlusManager gdipm;
...
@@ -13,10 +13,10 @@ GDIPlusManager gdipm;
App
::
App
()
App
::
App
()
:
:
wnd
(
800
,
60
0
,
"The Donkey Fart Box"
),
wnd
(
1280
,
72
0
,
"The Donkey Fart Box"
),
light
(
wnd
.
Gfx
()
)
light
(
wnd
.
Gfx
()
)
{
{
wnd
.
Gfx
().
SetProjection
(
dx
::
XMMatrixPerspectiveLH
(
1.0
f
,
3
.0
f
/
4
.0
f
,
0.5
f
,
40.0
f
)
);
wnd
.
Gfx
().
SetProjection
(
dx
::
XMMatrixPerspectiveLH
(
1.0
f
,
9
.0
f
/
16
.0
f
,
0.5
f
,
40.0
f
)
);
}
}
void
App
::
DoFrame
()
void
App
::
DoFrame
()
...
...
hw3d/Graphics.cpp
View file @
33c43a2c
...
@@ -15,11 +15,11 @@ namespace dx = DirectX;
...
@@ -15,11 +15,11 @@ namespace dx = DirectX;
#pragma comment(lib,"D3DCompiler.lib")
#pragma comment(lib,"D3DCompiler.lib")
Graphics
::
Graphics
(
HWND
hWnd
)
Graphics
::
Graphics
(
HWND
hWnd
,
int
width
,
int
height
)
{
{
DXGI_SWAP_CHAIN_DESC
sd
=
{};
DXGI_SWAP_CHAIN_DESC
sd
=
{};
sd
.
BufferDesc
.
Width
=
0
;
sd
.
BufferDesc
.
Width
=
width
;
sd
.
BufferDesc
.
Height
=
0
;
sd
.
BufferDesc
.
Height
=
height
;
sd
.
BufferDesc
.
Format
=
DXGI_FORMAT_B8G8R8A8_UNORM
;
sd
.
BufferDesc
.
Format
=
DXGI_FORMAT_B8G8R8A8_UNORM
;
sd
.
BufferDesc
.
RefreshRate
.
Numerator
=
0
;
sd
.
BufferDesc
.
RefreshRate
.
Numerator
=
0
;
sd
.
BufferDesc
.
RefreshRate
.
Denominator
=
0
;
sd
.
BufferDesc
.
RefreshRate
.
Denominator
=
0
;
...
@@ -77,8 +77,8 @@ Graphics::Graphics( HWND hWnd )
...
@@ -77,8 +77,8 @@ Graphics::Graphics( HWND hWnd )
// create depth stensil texture
// create depth stensil texture
wrl
::
ComPtr
<
ID3D11Texture2D
>
pDepthStencil
;
wrl
::
ComPtr
<
ID3D11Texture2D
>
pDepthStencil
;
D3D11_TEXTURE2D_DESC
descDepth
=
{};
D3D11_TEXTURE2D_DESC
descDepth
=
{};
descDepth
.
Width
=
800u
;
descDepth
.
Width
=
width
;
descDepth
.
Height
=
600u
;
descDepth
.
Height
=
height
;
descDepth
.
MipLevels
=
1u
;
descDepth
.
MipLevels
=
1u
;
descDepth
.
ArraySize
=
1u
;
descDepth
.
ArraySize
=
1u
;
descDepth
.
Format
=
DXGI_FORMAT_D32_FLOAT
;
descDepth
.
Format
=
DXGI_FORMAT_D32_FLOAT
;
...
@@ -102,8 +102,8 @@ Graphics::Graphics( HWND hWnd )
...
@@ -102,8 +102,8 @@ Graphics::Graphics( HWND hWnd )
// configure viewport
// configure viewport
D3D11_VIEWPORT
vp
;
D3D11_VIEWPORT
vp
;
vp
.
Width
=
800.0
f
;
vp
.
Width
=
(
float
)
width
;
vp
.
Height
=
600.0
f
;
vp
.
Height
=
(
float
)
height
;
vp
.
MinDepth
=
0.0
f
;
vp
.
MinDepth
=
0.0
f
;
vp
.
MaxDepth
=
1.0
f
;
vp
.
MaxDepth
=
1.0
f
;
vp
.
TopLeftX
=
0.0
f
;
vp
.
TopLeftX
=
0.0
f
;
...
...
hw3d/Graphics.h
View file @
33c43a2c
...
@@ -57,7 +57,7 @@ public:
...
@@ -57,7 +57,7 @@ public:
std
::
string
reason
;
std
::
string
reason
;
};
};
public:
public:
Graphics
(
HWND
hWnd
);
Graphics
(
HWND
hWnd
,
int
width
,
int
height
);
Graphics
(
const
Graphics
&
)
=
delete
;
Graphics
(
const
Graphics
&
)
=
delete
;
Graphics
&
operator
=
(
const
Graphics
&
)
=
delete
;
Graphics
&
operator
=
(
const
Graphics
&
)
=
delete
;
~
Graphics
();
~
Graphics
();
...
...
hw3d/Window.cpp
View file @
33c43a2c
...
@@ -102,7 +102,7 @@ Window::Window( int width,int height,const char* name )
...
@@ -102,7 +102,7 @@ Window::Window( int width,int height,const char* name )
// Init ImGui Win32 Impl
// Init ImGui Win32 Impl
ImGui_ImplWin32_Init
(
hWnd
);
ImGui_ImplWin32_Init
(
hWnd
);
// create graphics object
// create graphics object
pGfx
=
std
::
make_unique
<
Graphics
>
(
hWnd
);
pGfx
=
std
::
make_unique
<
Graphics
>
(
hWnd
,
width
,
height
);
}
}
Window
::~
Window
()
Window
::~
Window
()
...
...
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