Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #222: change resolution in running app
This happens after you exit the options dialog and after you've entered a new name with an existing user file.
- Loading branch information
Showing
19 changed files
with
233 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
module basics.resol; | ||
|
||
/* | ||
* Call all modules that do something with resolution, so that those modules | ||
* do not have to depend on each other as much. | ||
*/ | ||
|
||
import basics.cmdargs; | ||
import basics.user; // don't always change resolution if already OK | ||
import game.physdraw; | ||
import graphic.internal; | ||
import gui.context; | ||
import gui.root; | ||
import hardware.display; | ||
import hardware.mousecur; | ||
import tile.tilelib; | ||
|
||
// //i means not called because not yet implemented. It should be implemented | ||
// before we release changing resolution. | ||
|
||
void changeResolutionBasedOnCmdargsThenUserFile(const(Cmdargs) cmdargs) | ||
{ | ||
hardware.mousecur.deinitialize(); | ||
tile.tilelib.deinitialize(); | ||
game.physdraw.deinitialize(); | ||
graphic.internal.deinitialize(); | ||
gui.root.deinitialize(); | ||
gui.context.deinitialize(); | ||
|
||
hardware.display.setScreenMode(cmdargs); | ||
|
||
gui.context.initialize(displayXl, displayYl); | ||
gui.root.initialize(displayXl, displayYl); | ||
graphic.internal.initialize(cmdargs.mode); | ||
graphic.internal.initializeScale(gui.stretchFactor); | ||
game.physdraw.initialize(); | ||
tile.tilelib.initialize(); | ||
hardware.mousecur.initialize(); | ||
} | ||
|
||
void changeResolutionBasedOnUserFileAlone() | ||
{ | ||
if (weHaveAReasonToChange) | ||
changeResolutionBasedOnCmdargsThenUserFile(new Cmdargs([])); | ||
} | ||
|
||
private bool weHaveAReasonToChange() | ||
{ | ||
if (! display) | ||
return true; | ||
if (displayTryMode.full && currentMode.full) | ||
return false; | ||
return displayTryMode != currentMode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.