Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
f48d5e4c
There was an error fetching the commit references. Please try again later.
Commit
f48d5e4c
authored
6 years ago
by
adityaruplaha
Browse files
Options
Downloads
Patches
Plain Diff
SDL2: Implement fullscreen. (Original PR: citra-emu/citra#3607)
parent
c6ab2c94
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
+26
-1
26 additions, 1 deletion
src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
src/yuzu_cmd/emu_window/emu_window_sdl2.h
+4
-1
4 additions, 1 deletion
src/yuzu_cmd/emu_window/emu_window_sdl2.h
src/yuzu_cmd/yuzu.cpp
+10
-2
10 additions, 2 deletions
src/yuzu_cmd/yuzu.cpp
with
40 additions
and
4 deletions
src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
+
26
−
1
View file @
f48d5e4c
...
@@ -56,7 +56,28 @@ void EmuWindow_SDL2::OnResize() {
...
@@ -56,7 +56,28 @@ void EmuWindow_SDL2::OnResize() {
UpdateCurrentFramebufferLayout
(
width
,
height
);
UpdateCurrentFramebufferLayout
(
width
,
height
);
}
}
EmuWindow_SDL2
::
EmuWindow_SDL2
()
{
void
EmuWindow_SDL2
::
Fullscreen
()
{
if
(
SDL_SetWindowFullscreen
(
render_window
,
SDL_WINDOW_FULLSCREEN
)
==
0
)
{
return
;
}
NGLOG_ERROR
(
Frontend
,
"Fullscreening failed: {}"
,
SDL_GetError
());
// Try a different fullscreening method
NGLOG_INFO
(
Frontend
,
"Attempting to use borderless fullscreen..."
);
if
(
SDL_SetWindowFullscreen
(
render_window
,
SDL_WINDOW_FULLSCREEN_DESKTOP
)
==
0
)
{
return
;
}
NGLOG_ERROR
(
Frontend
,
"Borderless fullscreening failed: {}"
,
SDL_GetError
());
// Fallback algorithm: Maximise window.
// Works on all systems (unless something is seriously wrong), so no fallback for this one.
NGLOG_INFO
(
Frontend
,
"Falling back on a maximised window..."
);
SDL_MaximizeWindow
(
render_window
);
}
EmuWindow_SDL2
::
EmuWindow_SDL2
(
bool
fullscreen
)
{
InputCommon
::
Init
();
InputCommon
::
Init
();
SDL_SetMainReady
();
SDL_SetMainReady
();
...
@@ -90,6 +111,10 @@ EmuWindow_SDL2::EmuWindow_SDL2() {
...
@@ -90,6 +111,10 @@ EmuWindow_SDL2::EmuWindow_SDL2() {
exit
(
1
);
exit
(
1
);
}
}
if
(
fullscreen
)
{
Fullscreen
();
}
gl_context
=
SDL_GL_CreateContext
(
render_window
);
gl_context
=
SDL_GL_CreateContext
(
render_window
);
if
(
gl_context
==
nullptr
)
{
if
(
gl_context
==
nullptr
)
{
...
...
This diff is collapsed.
Click to expand it.
src/yuzu_cmd/emu_window/emu_window_sdl2.h
+
4
−
1
View file @
f48d5e4c
...
@@ -12,7 +12,7 @@ struct SDL_Window;
...
@@ -12,7 +12,7 @@ struct SDL_Window;
class
EmuWindow_SDL2
:
public
EmuWindow
{
class
EmuWindow_SDL2
:
public
EmuWindow
{
public:
public:
EmuWindow_SDL2
();
explicit
EmuWindow_SDL2
(
bool
fullscreen
);
~
EmuWindow_SDL2
();
~
EmuWindow_SDL2
();
/// Swap buffers to display the next frame
/// Swap buffers to display the next frame
...
@@ -43,6 +43,9 @@ private:
...
@@ -43,6 +43,9 @@ private:
/// Called by PollEvents when any event that may cause the window to be resized occurs
/// Called by PollEvents when any event that may cause the window to be resized occurs
void
OnResize
();
void
OnResize
();
/// Called when user passes the fullscreen parameter flag
void
Fullscreen
();
/// Called when a configuration change affects the minimal size of the window
/// Called when a configuration change affects the minimal size of the window
void
OnMinimalClientAreaChangeRequest
(
void
OnMinimalClientAreaChangeRequest
(
const
std
::
pair
<
unsigned
,
unsigned
>&
minimal_size
)
override
;
const
std
::
pair
<
unsigned
,
unsigned
>&
minimal_size
)
override
;
...
...
This diff is collapsed.
Click to expand it.
src/yuzu_cmd/yuzu.cpp
+
10
−
2
View file @
f48d5e4c
...
@@ -41,6 +41,7 @@ static void PrintHelp(const char* argv0) {
...
@@ -41,6 +41,7 @@ static void PrintHelp(const char* argv0) {
std
::
cout
<<
"Usage: "
<<
argv0
std
::
cout
<<
"Usage: "
<<
argv0
<<
" [options] <filename>
\n
"
<<
" [options] <filename>
\n
"
"-g, --gdbport=NUMBER Enable gdb stub on port NUMBER
\n
"
"-g, --gdbport=NUMBER Enable gdb stub on port NUMBER
\n
"
"-f, --fullscreen Start in fullscreen mode
\n
"
"-h, --help Display this help and exit
\n
"
"-h, --help Display this help and exit
\n
"
"-v, --version Output version information and exit
\n
"
;
"-v, --version Output version information and exit
\n
"
;
}
}
...
@@ -67,15 +68,18 @@ int main(int argc, char** argv) {
...
@@ -67,15 +68,18 @@ int main(int argc, char** argv) {
#endif
#endif
std
::
string
filepath
;
std
::
string
filepath
;
bool
fullscreen
=
false
;
static
struct
option
long_options
[]
=
{
static
struct
option
long_options
[]
=
{
{
"gdbport"
,
required_argument
,
0
,
'g'
},
{
"gdbport"
,
required_argument
,
0
,
'g'
},
{
"fullscreen"
,
no_argument
,
0
,
'f'
},
{
"help"
,
no_argument
,
0
,
'h'
},
{
"help"
,
no_argument
,
0
,
'h'
},
{
"version"
,
no_argument
,
0
,
'v'
},
{
"version"
,
no_argument
,
0
,
'v'
},
{
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
},
};
};
while
(
optind
<
argc
)
{
while
(
optind
<
argc
)
{
char
arg
=
getopt_long
(
argc
,
argv
,
"g:hv"
,
long_options
,
&
option_index
);
char
arg
=
getopt_long
(
argc
,
argv
,
"g:
f
hv"
,
long_options
,
&
option_index
);
if
(
arg
!=
-
1
)
{
if
(
arg
!=
-
1
)
{
switch
(
arg
)
{
switch
(
arg
)
{
case
'g'
:
case
'g'
:
...
@@ -89,6 +93,10 @@ int main(int argc, char** argv) {
...
@@ -89,6 +93,10 @@ int main(int argc, char** argv) {
exit
(
1
);
exit
(
1
);
}
}
break
;
break
;
case
'f'
:
fullscreen
=
true
;
NGLOG_INFO
(
Frontend
,
"Starting in fullscreen mode..."
);
break
;
case
'h'
:
case
'h'
:
PrintHelp
(
argv
[
0
]);
PrintHelp
(
argv
[
0
]);
return
0
;
return
0
;
...
@@ -128,7 +136,7 @@ int main(int argc, char** argv) {
...
@@ -128,7 +136,7 @@ int main(int argc, char** argv) {
Settings
::
values
.
use_gdbstub
=
use_gdbstub
;
Settings
::
values
.
use_gdbstub
=
use_gdbstub
;
Settings
::
Apply
();
Settings
::
Apply
();
std
::
unique_ptr
<
EmuWindow_SDL2
>
emu_window
{
std
::
make_unique
<
EmuWindow_SDL2
>
()};
std
::
unique_ptr
<
EmuWindow_SDL2
>
emu_window
{
std
::
make_unique
<
EmuWindow_SDL2
>
(
fullscreen
)};
Core
::
System
&
system
{
Core
::
System
::
GetInstance
()};
Core
::
System
&
system
{
Core
::
System
::
GetInstance
()};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment