summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2022-03-14 21:31:43 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2022-03-14 21:31:43 -0400
commit83ac4c41bc447a3372769f2b3ef6e3119d2717a2 (patch)
tree77a8e7db49b22d3672b398a94f919b5ca78e2e4a /src
parentc3055098edaec16f844fc21731ecf391c8fefe33 (diff)
downloadether-83ac4c41bc447a3372769f2b3ef6e3119d2717a2.tar.gz
ether-83ac4c41bc447a3372769f2b3ef6e3119d2717a2.tar.bz2
ether-83ac4c41bc447a3372769f2b3ef6e3119d2717a2.zip
window starts in centre of screen
Diffstat (limited to 'src')
-rw-r--r--src/map.h25
-rw-r--r--src/renderer.cpp7
2 files changed, 5 insertions, 27 deletions
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:
128 return loaded_; 128 return loaded_;
129 } 129 }
130 130
131 /*void resize(int newLeft, int newTop, int newWidth, int newHeight)
132 {
133 std::vector<T> newData(newWidth * newHeight);
134
135 int winTop = std::max(top_, newTop);
136 int winBottom = std::min(top_ + height_, newTop + newHeight);
137 int winLeft = std::max(left_, newLeft);
138 int winRight = std::min(left_ + width_, newLeft + newWidth);
139
140 for (int y = winTop; y < winBottom; y++)
141 {
142 std::move(
143 std::next(std::begin(data_), (winLeft - left_) + width_ * (y - top_)),
144 std::next(std::begin(data_), (winRight - left_) + width_ * (y - top_)),
145 std::next(std::begin(newData),
146 (winLeft - newLeft) + newWidth * (y - newTop)));
147 }
148
149 left_ = newLeft;
150 top_ = newTop;
151 width_ = newWidth;
152 height_ = newHeight;
153 data_.swap(newData);
154 }*/
155
156 void load(int newLeftChunk, int newTopChunk, int newWidthChunks, int newHeightChunks, std::mt19937& rng) { 131 void load(int newLeftChunk, int newTopChunk, int newWidthChunks, int newHeightChunks, std::mt19937& rng) {
157 // Flush the currently loaded data as long as there is any (this isn't the first load). 132 // Flush the currently loaded data as long as there is any (this isn't the first load).
158 if (!loaded_.empty()) { 133 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 @@
3 3
4Renderer::Renderer() 4Renderer::Renderer()
5{ 5{
6 SDL_DisplayMode displayMode;
7 SDL_GetDesktopDisplayMode(0, &displayMode);
8
6 win_ = window_ptr( 9 win_ = window_ptr(
7 SDL_CreateWindow( 10 SDL_CreateWindow(
8 "Ether", 11 "Ether",
9 100, 12 displayMode.w / 2 - GAME_WIDTH / 2,
10 100, 13 displayMode.h / 2 - GAME_HEIGHT / 2,
11 GAME_WIDTH, 14 GAME_WIDTH,
12 GAME_HEIGHT, 15 GAME_HEIGHT,
13 SDL_WINDOW_SHOWN)); 16 SDL_WINDOW_SHOWN));