Switch from window-size to render-output-size
This commit is contained in:
@@ -99,72 +99,6 @@ void ScrollerPage::onPush(AppState &state) {
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
state_ = &state;
|
||||
|
||||
// Save the current logical presentation (LETTERBOX at design resolution)
|
||||
// and switch to NONE so we render into the full physical window. This
|
||||
// lets the scroller scroll the entire vertical extent of tall/rotated
|
||||
// displays while keeping text at the same pixel scale. onPop restores
|
||||
// the original presentation for other pages.
|
||||
SDL_GetRenderLogicalPresentation(state.renderer, &savedLogicalW_,
|
||||
&savedLogicalH_, &savedMode_);
|
||||
|
||||
SDL_Window *window = SDL_GetRenderWindow(state.renderer);
|
||||
int windowW = 0;
|
||||
int windowH = 0;
|
||||
if (window) {
|
||||
SDL_GetWindowSize(window, &windowW, &windowH);
|
||||
}
|
||||
if (windowW <= 0) {
|
||||
windowW = radiantwave::kDesignWidth;
|
||||
}
|
||||
if (windowH <= 0) {
|
||||
windowH = radiantwave::kDesignHeight;
|
||||
}
|
||||
|
||||
SDL_SetRenderLogicalPresentation(state.renderer, windowW, windowH,
|
||||
SDL_LOGICAL_PRESENTATION_DISABLED);
|
||||
|
||||
screenW_ = static_cast<float>(windowW);
|
||||
screenH_ = static_cast<float>(windowH);
|
||||
// Lines are capped at the full screen width; the widest Fibonacci lines
|
||||
// are sized to fill it with whole words (peak word count derived from the
|
||||
// screen), independent of resolution.
|
||||
maxLineWidth_ = screenW_;
|
||||
|
||||
TTF_Init();
|
||||
buildStreams(state);
|
||||
createFont(state);
|
||||
createPatterns();
|
||||
|
||||
prefilling_ = true;
|
||||
prefillLines();
|
||||
prefilling_ = false;
|
||||
|
||||
// Start audio. In dynamic mode the current stream's solfeggio-frequency
|
||||
// track wins (when its file exists); otherwise the configured manual track
|
||||
// plays. A frequency file that is not on disk yet falls back to the manual
|
||||
// track rather than playing nothing.
|
||||
std::string track = state.config.get().audio.current_track;
|
||||
if (state.config.get().audio.dynamic_audio && !streams_.empty()) {
|
||||
const ProclamationStream &stream = streams_[streamIndex_];
|
||||
if (stream.solfeggio_frequency_id != 0 &&
|
||||
!stream.audioFilename.empty() &&
|
||||
std::filesystem::exists(audioFilePath(stream.audioFilename))) {
|
||||
track = stream.audioFilename;
|
||||
}
|
||||
}
|
||||
if (std::filesystem::exists(audioFilePath(track))) {
|
||||
state.audio.playTrackFadeIn(track, kFadeSeconds);
|
||||
}
|
||||
|
||||
state.keybinds.bind(SDLK_ESCAPE, "scroller_exit", [this]() {
|
||||
if (state_) {
|
||||
state_->pages.pop(*state_);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void ScrollerPage::onResume(AppState &state) {
|
||||
state_ = &state;
|
||||
|
||||
Reference in New Issue
Block a user