From 83ac4c41bc447a3372769f2b3ef6e3119d2717a2 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 14 Mar 2022 21:31:43 -0400 Subject: window starts in centre of screen --- src/map.h | 25 ------------------------- src/renderer.cpp | 7 +++++-- 2 files changed, 5 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/map.h b/src/map.h index d35b632..2235b07 100644 --- a/src/map.h +++ b/src/map.h @@ -128,31 +128,6 @@ public: return loaded_; } - /*void resize(int newLeft, int newTop, int newWidth, int newHeight) - { - std::vector newData(newWidth * newHeight); - - int winTop = std::max(top_, newTop); - int winBottom = std::min(top_ + height_, newTop + newHeight); - int winLeft = std::max(left_, newLeft); - int winRight = std::min(left_ + width_, newLeft + newWidth); - - for (int y = winTop; y < winBottom; y++) - { - std::move( - std::next(std::begin(data_), (winLeft - left_) + width_ * (y - top_)), - std::next(std::begin(data_), (winRight - left_) + width_ * (y - top_)), - std::next(std::begin(newData), - (winLeft - newLeft) + newWidth * (y - newTop))); - } - - left_ = newLeft; - top_ = newTop; - width_ = newWidth; - height_ = newHeight; - data_.swap(newData); - }*/ - void load(int newLeftChunk, int newTopChunk, int newWidthChunks, int newHeightChunks, std::mt19937& rng) { // Flush the currently loaded data as long as there is any (this isn't the first load). if (!loaded_.empty()) { diff --git a/src/renderer.cpp b/src/renderer.cpp index 87e6553..21c4746 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -3,11 +3,14 @@ Renderer::Renderer() { + SDL_DisplayMode displayMode; + SDL_GetDesktopDisplayMode(0, &displayMode); + win_ = window_ptr( SDL_CreateWindow( "Ether", - 100, - 100, + displayMode.w / 2 - GAME_WIDTH / 2, + displayMode.h / 2 - GAME_HEIGHT / 2, GAME_WIDTH, GAME_HEIGHT, SDL_WINDOW_SHOWN)); -- cgit 1.4.1