サイズ変更の修正
このコミットが含まれているのは:
コミット
e95a36b778
|
@ -3,6 +3,7 @@
|
|||
* CDNを回避する様に
|
||||
* 画像は大き過ぎるの場合、画面に合うまで小さくにする様に
|
||||
* 「Q」キーを押すと、終了する様に
|
||||
* サイズ変更の修正
|
||||
|
||||
# 0.4.0
|
||||
* URLから画像ファイルを開ける様に
|
||||
|
|
17
main.c
17
main.c
|
@ -92,22 +92,23 @@ void windowevent(SDL_Event e) {
|
|||
if (scaledWidth >= (screenWidth-20)) scaledWidth = screenWidth-20;
|
||||
if (scaledHeight >= (screenHeight-20)) scaledHeight = screenHeight-20;
|
||||
|
||||
// テキスチャーのれんダーリングサイズの設定
|
||||
SDL_Rect renderQuad = { imgWidth, imgHeight, scaledWidth, scaledHeight };
|
||||
SDL_RenderCopy(renderer, texture, NULL, &renderQuad);
|
||||
// テキスチャーのレンダーリングサイズの設定
|
||||
renderQuad.x = imgWidth;
|
||||
renderQuad.y = imgHeight;
|
||||
renderQuad.w = scaledWidth;
|
||||
renderQuad.h = scaledHeight;
|
||||
|
||||
SDL_SetWindowSize(window, scaledWidth, scaledHeight);
|
||||
SDL_RenderCopy(renderer, texture, NULL, &renderQuad);
|
||||
} else if (e.type == SDL_WINDOWEVENT && e.window.event == SDL_WINDOWEVENT_EXPOSED) {
|
||||
SDL_Rect renderQuad = { imgWidth, imgHeight, imgWidth, imgHeight };
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
renderQuad.w = (windowWidth - 20);
|
||||
renderQuad.h = (windowHeight - 20);
|
||||
renderQuad.x = (windowWidth - renderQuad.w) / 2;
|
||||
renderQuad.y = (windowHeight - renderQuad.h) / 2;
|
||||
|
||||
if (init == 0) {
|
||||
renderQuad.w = imgWidth;
|
||||
renderQuad.h = imgHeight;
|
||||
}
|
||||
|
||||
if (
|
||||
(imgWidth >= (screenWidth - 100)) &&
|
||||
imgHeight >= (screenHeight - 100)
|
||||
|
|
読み込み中…
新しいイシューから参照