Skip to content

Commit

Permalink
Add "frameless" window option in cfg file, for hiding the window frame.
Browse files Browse the repository at this point in the history
  • Loading branch information
bolrog committed May 12, 2021
1 parent 25e852c commit ac60a07
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
D2DX is a Glide-wrapper and mod that makes the classic Diablo II/LoD run well on modern PCs, while honoring the original look and feel of the game.
Play in a window or in fullscreen, glitch-free, with or without enhancements like widescreen, true high framerate and anti-aliasing.

Version 0.99.512
Version 0.99.512c

## Features
- Turns the game into a well behaved DirectX 11 title on Windows 10 (also 7, 8 and 8.1).
Expand Down Expand Up @@ -79,9 +79,12 @@ D2DX uses the following third party libraries:

## Recent release history

### 0.99.512
### 0.99.512c
- Add "frameless" window option in cfg file, for hiding the window frame.
- Fix corrupt graphics in low lighting detail mode.
- Fix corrupt graphics in perspective mode.
- Fix distorted automap cross.
- Fix mouse sometimes getting stuck on the edge of the screen when setting a custom resolution in the cfg file.

### 0.99.511
- Change resolution mod from D2HD to the newer SGD2FreeRes (both by Mir Drualga).
Expand Down
3 changes: 2 additions & 1 deletion d2dx-defaults.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
#

[window]
scale=1 # range 1-3, an integer scale factor for the window (in windowed mode)
scale=1 # range 1-3, an integer scale factor for the window
position=[-1,-1] # if [-1,-1] the window will be centered, otherwise placed at the explicit position given here
frameless=false # if true, the window frame (caption bar etc) will be removed

[game]
size=[-1,-1] # if [-1,-1] d2dx will decide a suitable game size, otherwise will use the size given here
Expand Down
6 changes: 6 additions & 0 deletions src/d2dx/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ void Options::ApplyCfg(
SetWindowPosition({ (int32_t)x.u.i, (int32_t)y.u.i });
}
}

auto frameless = toml_bool_in(window, "frameless");
if (frameless.ok)
{
SetFlag(OptionsFlag::Frameless, frameless.u.b);
}
}

auto debug = toml_table_in(root, "debug");
Expand Down
2 changes: 2 additions & 0 deletions src/d2dx/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ namespace d2dx

TestMotionPrediction,

Frameless,

Count
};

Expand Down
8 changes: 7 additions & 1 deletion src/d2dx/RenderContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,13 @@ void RenderContext::AdjustWindowPlacement(
const int32_t oldWindowCenterX = (oldWindowRect.left + oldWindowRect.right) / 2;
const int32_t oldWindowCenterY = (oldWindowRect.top + oldWindowRect.bottom) / 2;

const DWORD windowStyle = WS_VISIBLE | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU;
DWORD windowStyle = WS_VISIBLE;

if (!_d2dxContext->GetOptions().GetFlag(OptionsFlag::Frameless))
{
windowStyle |= WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU;
}

RECT windowRect = { 0, 0, _windowSize.width, _windowSize.height };
AdjustWindowRect(&windowRect, windowStyle, FALSE);
const int32_t newWindowWidth = windowRect.right - windowRect.left;
Expand Down

0 comments on commit ac60a07

Please sign in to comment.