From 833bdcdd2bd282fb51fb320a8511ff68b8118531 Mon Sep 17 00:00:00 2001 From: Paul Lewis Date: Tue, 6 Sep 2016 19:00:56 -0500 Subject: [PATCH] Add support for setting glyph scale back to Display. It was tossed inadvertently, and instead of fixing it here, I apparently decided to update all of the demos to work withou it... --- rotLove/rotLove.lua | 9 +++++---- src/display.lua | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/rotLove/rotLove.lua b/rotLove/rotLove.lua index b3f5bc1..076dbc3 100644 --- a/rotLove/rotLove.lua +++ b/rotLove/rotLove.lua @@ -516,12 +516,13 @@ ROT.Display = class { } -- @tparam[opt=false] boolean vsync Use vsync -- @tparam[opt=0] int fsaa Number of fsaa passes -- @return nil -function ROT.Display:__init(w, h, dfg, dbg, fullOrFlags, vsync, fsaa) +function ROT.Display:__init(w, h, scale, dfg, dbg, fullOrFlags, vsync, fsaa) self.__name='Display' self.widthInChars = w and w or 80 self.heightInChars= h and h or 24 - self.charWidth=9 - self.charHeight=16 + self.scale=scale or 1 + self.charWidth=9*self.scale + self.charHeight=16*self.scale self.glyphs={} self.chars={{}} self.backgroundColors={{}} @@ -595,7 +596,7 @@ function ROT.Display:draw() if c~=32 and c~=255 then local qd=self.glyphs[c] self:_setColor(fg) - self.drawQ(self.glyphSprite, qd, px, py) + self.drawQ(self.glyphSprite, qd, px, py, nil, self.scale) end self.oldChars[x][y] = c diff --git a/src/display.lua b/src/display.lua index ea0f473..3d1ca58 100644 --- a/src/display.lua +++ b/src/display.lua @@ -17,12 +17,13 @@ Display.__name='Display' -- @tparam[opt=false] boolean vsync Use vsync -- @tparam[opt=0] int fsaa Number of fsaa passes -- @return nil -function Display:__init(w, h, dfg, dbg, fullOrFlags, vsync, fsaa) +function Display:__init(w, h, scale, dfg, dbg, fullOrFlags, vsync, fsaa) self.__name='Display' self.widthInChars = w and w or 80 self.heightInChars= h and h or 24 - self.charWidth=9 - self.charHeight=16 + self.scale=scale or 1 + self.charWidth=9*self.scale + self.charHeight=16*self.scale self.glyphs={} self.chars={{}} self.backgroundColors={{}} @@ -94,7 +95,7 @@ function Display:draw() if c~=32 and c~=255 then local qd=self.glyphs[c] self:_setColor(fg) - self.drawQ(self.glyphSprite, qd, px, py) + self.drawQ(self.glyphSprite, qd, px, py, nil, self.scale) end self.oldChars[x][y] = c