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
StudyCpp
Commits
ad5630a4
Commit
ad5630a4
authored
Dec 03, 2022
by
Administrator
Browse files
add basic scripts for directX window, also fix a little in hands on
parent
f469e4fe
Changes
7
Show whitespace changes
Inline
Side-by-side
.gitignore
View file @
ad5630a4
...
...
@@ -13,5 +13,8 @@
# Include all configure file under all folder
!**/*.conf
# Include all README file under all folder
!**/README.md
# Include .gitignore itself
!.gitignore
04.HandsOn/common/Constant.cpp
View file @
ad5630a4
#include <iostream>
#include <fstream>
#include <map>
#include <algorithm>
#include "Constant.h"
using
namespace
std
;
...
...
04.HandsOn/main.cpp
View file @
ad5630a4
...
...
@@ -12,4 +12,6 @@ int main() {
cout
<<
"----- Resolution setup -----"
<<
endl
;
cout
<<
"Resolution: "
<<
s
.
getResolution
()
<<
endl
;
system
(
"pause"
);
}
\ No newline at end of file
05.DirectX/README.md
0 → 100644
View file @
ad5630a4
This part start from handon of DirectXTutorial, which can be found through:
http://www.directxtutorial.com/LessonList.aspx?listid=11
\ No newline at end of file
05.DirectX/WinMainMessage.cpp
0 → 100644
View file @
ad5630a4
#ifndef UNICODE
#define UNICODE
#define UNICODE_WAS_UNDEFINED
#endif
#include <windows.h> // include the basic windows header file
// the entry point for any Windows program
int
WINAPI
WinMain
(
HINSTANCE
hInstance
,
HINSTANCE
hPrevInstance
,
LPSTR
lpCmdLine
,
int
nShowCmd
)
{
// create a "Hello World" message box using MessageBox()
MessageBox
(
NULL
,
L"Hello World!"
,
L"Just another Hello World program!"
,
MB_ICONEXCLAMATION
|
MB_OK
);
// return 0 to Windows
return
0
;
}
\ No newline at end of file
05.DirectX/WinMainWindow.cpp
0 → 100644
View file @
ad5630a4
#ifndef UNICODE
#define UNICODE
#define UNICODE_WAS_UNDEFINED
#endif
// include the basic windows header file
#include <windows.h>
#include <windowsx.h>
// the WindowProc function prototype
LRESULT
CALLBACK
WindowProc
(
HWND
hWnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
);
// the entry point for any Windows program
int
WINAPI
WinMain
(
HINSTANCE
hInstance
,
HINSTANCE
hPrevInstance
,
LPSTR
lpCmdLine
,
int
nCmdShow
)
{
// the handle for the window, filled by a function
HWND
hWnd
;
// this struct holds information for the window class
WNDCLASSEX
wc
;
// clear out the window class for use
ZeroMemory
(
&
wc
,
sizeof
(
WNDCLASSEX
));
// fill in the struct with the needed information
wc
.
cbSize
=
sizeof
(
WNDCLASSEX
);
wc
.
style
=
CS_HREDRAW
|
CS_VREDRAW
;
wc
.
lpfnWndProc
=
WindowProc
;
wc
.
hInstance
=
hInstance
;
wc
.
hCursor
=
LoadCursor
(
NULL
,
IDC_ARROW
);
wc
.
hbrBackground
=
(
HBRUSH
)
COLOR_WINDOW
;
wc
.
lpszClassName
=
L"WindowClass1"
;
// register the window class
RegisterClassEx
(
&
wc
);
// create the window and use the result as the handle
hWnd
=
CreateWindowEx
(
NULL
,
L"WindowClass1"
,
// name of the window class
L"Our First Windowed Program"
,
// title of the window
WS_OVERLAPPEDWINDOW
,
// window style
300
,
// x-position of the window
300
,
// y-position of the window
500
,
// width of the window
400
,
// height of the window
NULL
,
// we have no parent window, NULL
NULL
,
// we aren't using menus, NULL
hInstance
,
// application handle
NULL
);
// used with multiple windows, NULL
// display the window on the screen
ShowWindow
(
hWnd
,
nCmdShow
);
// enter the main loop:
// this struct holds Windows event messages
MSG
msg
;
// wait for the next message in the queue, store the result in 'msg'
while
(
GetMessage
(
&
msg
,
NULL
,
0
,
0
))
{
// translate keystroke messages into the right format
TranslateMessage
(
&
msg
);
// send the message to the WindowProc function
DispatchMessage
(
&
msg
);
}
// return this part of the WM_QUIT message to Windows
return
msg
.
wParam
;
}
// this is the main message handler for the program
LRESULT
CALLBACK
WindowProc
(
HWND
hWnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
// sort through and find what code to run for the message given
switch
(
message
)
{
// this message is read when the window is closed
case
WM_DESTROY
:
{
// close the application entirely
PostQuitMessage
(
0
);
return
0
;
}
break
;
}
// Handle any messages the switch statement didn't
return
DefWindowProc
(
hWnd
,
message
,
wParam
,
lParam
);
}
\ No newline at end of file
05.DirectX/tempCodeRunnerFile.cpp
0 → 100644
View file @
ad5630a4
wc
.
style
=
CS_HREDRAW
|
CS_VREDRAW
;
\ No newline at end of file
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