Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2Classic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
chromaticpipe
SRB2Classic
Commits
22d35248
Commit
22d35248
authored
1 year ago
by
Lactozilla
Browse files
Options
Downloads
Patches
Plain Diff
Set fullscreen resolution defaults to the current display's size
parent
9d9be887
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/i_video.h
+8
-0
8 additions, 0 deletions
src/i_video.h
src/sdl/i_video.c
+55
-14
55 additions, 14 deletions
src/sdl/i_video.c
with
63 additions
and
14 deletions
src/i_video.h
+
8
−
0
View file @
22d35248
...
@@ -100,10 +100,18 @@ const char *VID_GetModeName(INT32 modenum);
...
@@ -100,10 +100,18 @@ const char *VID_GetModeName(INT32 modenum);
void
VID_PrepareModeList
(
void
);
/// note hack for SDL
void
VID_PrepareModeList
(
void
);
/// note hack for SDL
/** \brief Returns true if the window is maximized, and false if not
*/
boolean
VID_IsMaximized
(
void
);
boolean
VID_IsMaximized
(
void
);
/** \brief Restores the window
*/
void
VID_RestoreWindow
(
void
);
void
VID_RestoreWindow
(
void
);
/** \brief Gets the current display's size; returns true if it succeeded, and false if not
*/
boolean
VID_GetNativeResolution
(
INT32
*
width
,
INT32
*
height
);
/** \brief can video system do fullscreen
/** \brief can video system do fullscreen
*/
*/
extern
boolean
allow_fullscreen
;
extern
boolean
allow_fullscreen
;
...
...
This diff is collapsed.
Click to expand it.
src/sdl/i_video.c
+
55
−
14
View file @
22d35248
...
@@ -146,6 +146,8 @@ static void Impl_SetupSoftwareBuffer(void);
...
@@ -146,6 +146,8 @@ static void Impl_SetupSoftwareBuffer(void);
static
void
Impl_InitOpenGL
(
void
);
static
void
Impl_InitOpenGL
(
void
);
static
void
Impl_SetDefaultWindowSizes
(
void
);
#if defined(HAVE_IMAGE)
#if defined(HAVE_IMAGE)
#define USE_WINDOW_ICON
#define USE_WINDOW_ICON
#endif
#endif
...
@@ -360,6 +362,8 @@ static SDL_bool SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen, SDL_b
...
@@ -360,6 +362,8 @@ static SDL_bool SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen, SDL_b
SDL_SetWindowSize
(
window
,
width
,
height
);
SDL_SetWindowSize
(
window
,
width
,
height
);
if
(
fullscreen
)
if
(
fullscreen
)
SDL_SetWindowFullscreen
(
window
,
fullscreen_type
);
SDL_SetWindowFullscreen
(
window
,
fullscreen_type
);
Impl_SetDefaultWindowSizes
();
}
}
if
(
Impl_RenderContextReset
()
==
SDL_FALSE
)
if
(
Impl_RenderContextReset
()
==
SDL_FALSE
)
...
@@ -410,6 +414,36 @@ static UINT32 VID_GetRefreshRate(void)
...
@@ -410,6 +414,36 @@ static UINT32 VID_GetRefreshRate(void)
return
m
.
refresh_rate
;
return
m
.
refresh_rate
;
}
}
static
void
Impl_SetDefaultWindowSizes
(
void
)
{
INT32
native_width
,
native_height
;
if
(
!
VID_GetNativeResolution
(
&
native_width
,
&
native_height
))
return
;
char
*
result
,
*
buffer1
,
*
buffer2
;
result
=
va
(
"%d"
,
native_width
);
buffer1
=
malloc
(
strlen
(
result
)
+
1
);
if
(
!
buffer1
)
return
;
strcpy
(
buffer1
,
result
);
result
=
va
(
"%d"
,
native_height
);
buffer2
=
malloc
(
strlen
(
result
)
+
1
);
if
(
!
buffer2
)
{
free
(
buffer1
);
return
;
}
strcpy
(
buffer2
,
result
);
cv_scr_width
.
defaultvalue
=
buffer1
;
cv_scr_height
.
defaultvalue
=
buffer2
;
}
static
INT32
Impl_SDL_Scancode_To_Keycode
(
SDL_Scancode
code
)
static
INT32
Impl_SDL_Scancode_To_Keycode
(
SDL_Scancode
code
)
{
{
if
(
code
>=
SDL_SCANCODE_A
&&
code
<=
SDL_SCANCODE_Z
)
if
(
code
>=
SDL_SCANCODE_A
&&
code
<=
SDL_SCANCODE_Z
)
...
@@ -1473,38 +1507,45 @@ boolean VID_CheckRenderer(void)
...
@@ -1473,38 +1507,45 @@ boolean VID_CheckRenderer(void)
return
rendererchanged
;
return
rendererchanged
;
}
}
#if 0
static
boolean
Impl_GetCurrentDisplayMode
(
INT32
*
width
,
INT32
*
height
)
static void Impl_GetCurrentDisplayMode(INT32 *width, INT32 *height)
{
{
int
i
=
SDL_GetWindowDisplayIndex
(
window
);
int
i
=
SDL_GetWindowDisplayIndex
(
window
);
SDL_DisplayMode resolution;
if
(
i
<
0
)
if
(
i
<
0
)
return;
return
false
;
SDL_DisplayMode
resolution
;
if (
!
SDL_GetCurrentDisplayMode(i, &resolution))
if
(
SDL_GetCurrentDisplayMode
(
i
,
&
resolution
)
==
0
)
{
{
if
((
*
width
)
==
0
)
if
((
*
width
)
==
0
)
(
*
width
)
=
(
INT32
)(
resolution
.
w
);
(
*
width
)
=
(
INT32
)(
resolution
.
w
);
if
((
*
height
)
==
0
)
if
((
*
height
)
==
0
)
(
*
height
)
=
(
INT32
)(
resolution
.
h
);
(
*
height
)
=
(
INT32
)(
resolution
.
h
);
return
true
;
}
}
return
false
;
}
}
void
VID_GetNativeResolution(INT32 *width, INT32 *height)
boolean
VID_GetNativeResolution
(
INT32
*
width
,
INT32
*
height
)
{
{
INT32
w
=
0
,
h
=
0
;
INT32
w
=
0
,
h
=
0
;
if (!w || !h)
boolean
success
=
Impl_GetCurrentDisplayMode
(
&
w
,
&
h
);
Impl_GetCurrentDisplayMode(&w, &h);
if (!w) w = BASEVIDWIDTH;
if
(
!
success
)
if (!h) h = BASEVIDHEIGHT;
{
w
=
BASEVIDWIDTH
;
h
=
BASEVIDHEIGHT
;
}
if
(
width
)
*
width
=
w
;
if
(
height
)
*
height
=
h
;
if (width) *width = w;
return
success
;
if (height) *height = h;
}
}
#endif
void
VID_SetSize
(
INT32
width
,
INT32
height
)
void
VID_SetSize
(
INT32
width
,
INT32
height
)
{
{
...
...
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