Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PoroCYon
Bonzomatic
Commits
1c745447
Commit
1c745447
authored
Jan 31, 2015
by
Gargaj
Browse files
add vsync option (fixes #2)
parent
c168ccc8
Changes
7
Hide whitespace changes
Inline
Side-by-side
Renderer.h
View file @
1c745447
...
...
@@ -11,6 +11,7 @@ typedef struct
int
nWidth
;
int
nHeight
;
RENDERER_WINDOWMODE
windowMode
;
bool
bVsync
;
}
RENDERER_SETTINGS
;
namespace
Renderer
...
...
main.cpp
View file @
1c745447
...
...
@@ -12,6 +12,7 @@
int
main
()
{
RENDERER_SETTINGS
settings
;
settings
.
bVsync
=
false
;
#ifdef _DEBUG
settings
.
nWidth
=
1280
;
settings
.
nHeight
=
720
;
...
...
platform_sdl/Renderer.cpp
View file @
1c745447
...
...
@@ -190,6 +190,9 @@ namespace Renderer
SDL_EnableUNICODE
(
true
);
SDL_EnableKeyRepeat
(
250
,
20
);
if
(
settings
->
bVsync
)
wglSwapIntervalEXT
(
1
);
run
=
true
;
return
true
;
...
...
platform_w32_common/SetupDialog.cpp
View file @
1c745447
...
...
@@ -88,6 +88,9 @@ public:
if
(
setup
->
windowMode
==
RENDERER_WINDOWMODE_FULLSCREEN
)
{
SendDlgItemMessage
(
hWnd
,
IDC_FULLSCREEN
,
BM_SETCHECK
,
1
,
1
);
}
if
(
setup
->
bVsync
)
{
SendDlgItemMessage
(
hWnd
,
IDC_VSYNC
,
BM_SETCHECK
,
1
,
1
);
}
return
true
;
}
break
;
...
...
@@ -101,6 +104,7 @@ public:
setup
->
nWidth
=
gaResolutions
[
SendDlgItemMessage
(
hWnd
,
IDC_RESOLUTION
,
CB_GETCURSEL
,
0
,
0
)
].
nWidth
;
setup
->
nHeight
=
gaResolutions
[
SendDlgItemMessage
(
hWnd
,
IDC_RESOLUTION
,
CB_GETCURSEL
,
0
,
0
)
].
nHeight
;
setup
->
windowMode
=
SendDlgItemMessage
(
hWnd
,
IDC_FULLSCREEN
,
BM_GETCHECK
,
0
,
0
)
?
RENDERER_WINDOWMODE_FULLSCREEN
:
RENDERER_WINDOWMODE_WINDOWED
;
setup
->
bVsync
=
SendDlgItemMessage
(
hWnd
,
IDC_VSYNC
,
BM_GETCHECK
,
0
,
0
)
>
0
;
EndDialog
(
hWnd
,
TRUE
);
}
break
;
case
IDCANCEL
:
...
...
platform_w32_common/SetupDialog.rc
View file @
1c745447
...
...
@@ -24,18 +24,20 @@ LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
// Dialog
//
IDD_SETUP DIALOGEX 0, 0, 186,
77
IDD_SETUP DIALOGEX 0, 0, 186,
92
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "mlat design"
FONT 8, "Tahoma", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "Run",IDOK,60,
54
,116,14
PUSHBUTTON "Cancel",IDCANCEL,6,
54
,50,14
DEFPUSHBUTTON "Run",IDOK,60,
66
,116,14
PUSHBUTTON "Cancel",IDCANCEL,6,
66
,50,14
RTEXT "Resolution:",IDC_STATIC,7,22,65,10
COMBOBOX IDC_RESOLUTION,83,20,91,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Fullscreen:",IDC_STATIC,7,36,65,10
CONTROL "",IDC_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,36,9,10
CTEXT "BONZOMATIC",IDC_STATIC,5,8,175,10
RTEXT "Vertical sync:",IDC_STATIC,7,50,65,10
CONTROL "",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,50,9,10
END
...
...
@@ -49,6 +51,7 @@ GUIDELINES DESIGNINFO
BEGIN
IDD_SETUP, DIALOG
BEGIN
BOTTOMMARGIN, 77
END
END
#endif // APSTUDIO_INVOKED
...
...
platform_w32_common/resource.h
View file @
1c745447
...
...
@@ -11,6 +11,7 @@
#define IDC_FULLSCREEN 1003
#define IDC_CHECK2 1004
#define IDC_ONTOP 1004
#define IDC_FULLSCREEN2 1004
#define IDC_CHECK3 1005
#define IDC_VSYNC 1005
#define IDC_COMBO3 1006
...
...
platform_w32_dx9/Renderer.cpp
View file @
1c745447
...
...
@@ -328,7 +328,7 @@ namespace Renderer
d3dpp
.
SwapEffect
=
D3DSWAPEFFECT_DISCARD
;
d3dpp
.
hDeviceWindow
=
hWnd
;
d3dpp
.
Windowed
=
pSetup
->
windowMode
!=
RENDERER_WINDOWMODE_FULLSCREEN
;
d3dpp
.
PresentationInterval
=
D3DPRESENT_INTERVAL_IMMEDIATE
;
d3dpp
.
PresentationInterval
=
pSetup
->
bVsync
?
D3DPRESENT_INTERVAL_ONE
:
D3DPRESENT_INTERVAL_IMMEDIATE
;
d3dpp
.
BackBufferCount
=
1
;
...
...
@@ -461,8 +461,10 @@ namespace Renderer
return
true
;
}
unsigned
int
nCacheFlushCount
=
0
;
void
StartFrame
()
{
nCacheFlushCount
=
0
;
MSG
msg
;
if
(
PeekMessage
(
&
msg
,
NULL
,
0U
,
0U
,
PM_REMOVE
)
)
{
...
...
@@ -702,6 +704,7 @@ namespace Renderer
{
if
(
!
bufferPointer
)
return
;
nCacheFlushCount
++
;
void
*
v
=
NULL
;
pGUIQuadVB
->
Lock
(
0
,
bufferPointer
*
sizeof
(
float
)
*
6
,
&
v
,
NULL
);
CopyMemory
(
v
,
buffer
,
bufferPointer
*
sizeof
(
float
)
*
6
);
...
...
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