set new default window width

This commit is contained in:
Colby 2016-09-01 19:51:03 +10:00
parent 5ca8892745
commit dfc9df2f4f

View file

@ -1,16 +1,19 @@
module Waterfoul module Waterfoul
class Screen class Screen
WINDOW_WIDTH = 480
WINDOW_HEIGHT = 432
SCREEN_WIDTH = 160 SCREEN_WIDTH = 160
SCREEN_HEIGHT = 144 SCREEN_HEIGHT = 144
def initialize def initialize
SDL.InitSubSystem SDL::INIT_VIDEO SDL.InitSubSystem SDL::INIT_VIDEO
@buffer = FFI::MemoryPointer.new :uint32, SCREEN_WIDTH * SCREEN_HEIGHT @buffer = FFI::MemoryPointer.new :uint32, SCREEN_WIDTH * SCREEN_HEIGHT
@window = SDL.CreateWindow 'waterfoul', 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL::SDL_WINDOW_RESIZABLE @window = SDL.CreateWindow 'waterfoul', 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, SDL::SDL_WINDOW_RESIZABLE
@renderer = SDL.CreateRenderer @window, -1, 0 @renderer = SDL.CreateRenderer @window, -1, 0
SDL.SetHint "SDL_RENDER_SCALE_QUALITY", "linear" SDL.SetHint "SDL_HINT_RENDER_SCALE_QUALITY", "2"
SDL.RenderSetLogicalSize(@renderer, SCREEN_WIDTH, SCREEN_HEIGHT) SDL.RenderSetLogicalSize(@renderer, WINDOW_WIDTH, WINDOW_HEIGHT)
@texture = SDL.CreateTexture @renderer, SDL::PIXELFORMAT_ARGB8888, 1, SCREEN_WIDTH, SCREEN_HEIGHT @texture = SDL.CreateTexture @renderer, SDL::PIXELFORMAT_ARGB8888, 1, SCREEN_WIDTH, SCREEN_HEIGHT
end end