Bladeren bron

Fix resolution issues;

bjorn 11 jaren geleden
bovenliggende
commit
f4f2b7b6a2

+ 1 - 1
conf.lua

@@ -1,6 +1,6 @@
 function love.conf(t)
 function love.conf(t)
   t.title = 'groupGore'
   t.title = 'groupGore'
-  t.window.vsync = true
+  t.window.vsync = false
   t.window.width = 800
   t.window.width = 800
   t.window.height = 600
   t.window.height = 600
   t.console = true
   t.console = true

+ 10 - 3
data/hud/hud.lua

@@ -21,6 +21,8 @@ function Hud:init()
   ctx.event:on(evtChat, function(data) self.chat:add(data) end)
   ctx.event:on(evtChat, function(data) self.chat:add(data) end)
   ctx.event:on(evtDead, function(data) self.feed:insert(data) end)
   ctx.event:on(evtDead, function(data) self.feed:insert(data) end)
   ctx.view:register(self)
   ctx.view:register(self)
+
+  self:resize()
 end
 end
 
 
 function Hud:update()
 function Hud:update()
@@ -33,8 +35,6 @@ function Hud:update()
 end
 end
 
 
 function Hud:gui()
 function Hud:gui()
-  g.reset()
-  
   if not ctx.id then return self:connecting() end
   if not ctx.id then return self:connecting() end
   if self.classSelect.active then return self.classSelect:draw() end
   if self.classSelect.active then return self.classSelect:draw() end
 
 
@@ -73,6 +73,11 @@ function Hud:keyreleased(key)
   if self.chat.active or self.classSelect.active then return true end
   if self.chat.active or self.classSelect.active then return true end
 end
 end
 
 
+function Hud:resize()
+  self.u = ctx.view.frame.width
+  self.v = ctx.view.frame.height
+end
+
 function Hud:connecting()
 function Hud:connecting()
   --[[g.setColor(0, 0, 0)
   --[[g.setColor(0, 0, 0)
   g.rectangle('fill', 0, 0, g.getWidth(), g.getHeight())
   g.rectangle('fill', 0, 0, g.getWidth(), g.getHeight())
@@ -97,4 +102,6 @@ function Hud:crosshair()
       if not love.mouse.isVisible() then love.mouse.setVisible(true) end
       if not love.mouse.isVisible() then love.mouse.setVisible(true) end
     end
     end
   end
   end
-end
+
+  love.mouse.setVisible(true)
+end

+ 2 - 1
data/hud/hudblood.lua

@@ -1,12 +1,13 @@
 HudBlood = class()
 HudBlood = class()
 
 
 function HudBlood:draw()
 function HudBlood:draw()
+  local u, v = ctx.hud.u, ctx.hud.v
   local p = ctx.players:get(ctx.id)
   local p = ctx.players:get(ctx.id)
   if p then
   if p then
     local hp = math.lerp(ctx.hud.health.prevVal, ctx.hud.health.val, tickDelta / tickRate)
     local hp = math.lerp(ctx.hud.health.prevVal, ctx.hud.health.val, tickDelta / tickRate)
     local prc = hp / p.maxHealth
     local prc = hp / p.maxHealth
     local image = data.media.graphics.hud['hudBlood' .. 4 - math.floor(math.min(prc * 8, 3))]
     local image = data.media.graphics.hud['hudBlood' .. 4 - math.floor(math.min(prc * 8, 3))]
     love.graphics.setColor(255, 255, 255, math.min(((1 - (math.min(prc, .5) / .5)) + math.max(1 - (tick - p.lastHurt) * tickRate, 0) / 6) * 200, 200))
     love.graphics.setColor(255, 255, 255, math.min(((1 - (math.min(prc, .5) / .5)) + math.max(1 - (tick - p.lastHurt) * tickRate, 0) / 6) * 200, 200))
-    love.graphics.draw(image, 0, 0, 0, love.graphics.width() / image:getWidth(), love.graphics.height() / image:getHeight())
+    love.graphics.draw(image, 0, 0, 0, u / image:getWidth(), v / image:getHeight())
   end
   end
 end
 end

+ 4 - 4
data/hud/hudbuffs.lua

@@ -1,17 +1,17 @@
 HudBuffs = class()
 HudBuffs = class()
 
 
 local g = love.graphics
 local g = love.graphics
-local w, h = love.graphics.width, love.graphics.height
 
 
 function HudBuffs:draw()
 function HudBuffs:draw()
+  local u, v = ctx.hud.u, ctx.hud.v
   local p = ctx.players:get(ctx.id)
   local p = ctx.players:get(ctx.id)
   if p then
   if p then
     g.setColor(255, 255, 255)
     g.setColor(255, 255, 255)
-    local xx = w(.01)
+    local xx = u * .01
     table.each(ctx.buffs.buffs, function(b)
     table.each(ctx.buffs.buffs, function(b)
       if b.owner == p then
       if b.owner == p then
-        g.rectangle('line', xx, h(.1), w(.02), w(.02))
-        xx = xx + w(.025)
+        g.rectangle('line', xx, v * .1, u * .02, u * .02)
+        xx = xx + u * .025
       end
       end
     end)
     end)
   end
   end

+ 14 - 10
data/hud/hudchat.lua

@@ -10,18 +10,20 @@ function HudChat:init()
   self.message = ''
   self.message = ''
   self.log = ''
   self.log = ''
   self.timer = 0
   self.timer = 0
-  self.width = w(.35)
-  self.offset = -self.width - 4
+  self.offset = -love.graphics.getWidth()
   self.richText = nil
   self.richText = nil
 end
 end
 
 
 function HudChat:update()
 function HudChat:update()
+  local u, v = ctx.hud.u, ctx.hud.v
   self.timer = timer.rot(self.timer)
   self.timer = timer.rot(self.timer)
   if self.active then self.timer = 2 end
   if self.active then self.timer = 2 end
-  self.offset = math.lerp(self.offset, (self.timer == 0) and -self.width - 4 or 0, tickRate * 30)
+  self.offset = math.lerp(self.offset, (self.timer == 0) and -(u * .35) - 4 or 0, tickRate * 30)
 end
 end
 
 
 function HudChat:draw()
 function HudChat:draw()
+  local u, v = ctx.hud.u, ctx.hud.v
+  local width = u * .35
   if not self.richText then return end
   if not self.richText then return end
   
   
   g.setFont('pixel', 8)
   g.setFont('pixel', 8)
@@ -30,15 +32,15 @@ function HudChat:draw()
   if self.active then height = height + (font:getHeight() + 6.5) - 1 end
   if self.active then height = height + (font:getHeight() + 6.5) - 1 end
   
   
   g.setColor(0, 0, 0, 180)
   g.setColor(0, 0, 0, 180)
-  g.rectangle('fill', 4 + self.offset, h() - (height + 4), self.width, height)
+  g.rectangle('fill', 4 + self.offset, v - (height + 4), width, height)
   g.setColor(30, 30, 30, 180)
   g.setColor(30, 30, 30, 180)
-  g.rectangle('line', 4 + self.offset, h() - (height + 4), self.width, height)
-  local yy = h() - 4
+  g.rectangle('line', 4 + self.offset, v - (height + 4), width, height)
+  local yy = v - 4
   if self.active then
   if self.active then
     g.setColor(255, 255, 255, 60)
     g.setColor(255, 255, 255, 60)
-    g.line(4.5 + self.offset, h() - 4 - font:getHeight() - 6.5, 3 + self.width + self.offset, h() - 4 - font:getHeight() - 6.5)
+    g.line(4.5 + self.offset, v - 4 - font:getHeight() - 6.5, 3 + width + self.offset, v - 4 - font:getHeight() - 6.5)
     g.setColor(255, 255, 255, 180)
     g.setColor(255, 255, 255, 180)
-    g.printf(self.message .. (self.active and '|' or ''), 4 + 4 + self.offset, math.round(yy - font:getHeight() - 5.5 + 2), self.width, 'left')
+    g.printf(self.message .. (self.active and '|' or ''), 4 + 4 + self.offset, math.round(yy - font:getHeight() - 5.5 + 2), width, 'left')
     yy = yy - font:getHeight() - 6.5
     yy = yy - font:getHeight() - 6.5
   end
   end
 
 
@@ -75,6 +77,8 @@ end
 
 
 function HudChat:add(data)
 function HudChat:add(data)
   local message = data.message
   local message = data.message
+  local u, v = ctx.hud.u, ctx.hud.v
+  local width = u * .35
   
   
   if #message > 0 then
   if #message > 0 then
     if #self.log > 0 then self.log = self.log .. '\n' end
     if #self.log > 0 then self.log = self.log .. '\n' end
@@ -82,10 +86,10 @@ function HudChat:add(data)
   end
   end
 
 
   g.setFont('pixel', 8)
   g.setFont('pixel', 8)
-  while g.getFont():getHeight() * select(2, g.getFont():getWrap(self.log, self.width)) > (h(.25) - 2) do
+  while g.getFont():getHeight() * select(2, g.getFont():getWrap(self.log, width)) > (v * .25 - 2) do
     self.log = self.log:sub(2)
     self.log = self.log:sub(2)
   end
   end
   
   
-  self.richText = rich.new({self.log, self.width, white = {255, 255, 255}, purple = {190, 160, 220}, orange = {240, 160, 140}})
+  self.richText = rich.new({self.log, width, white = {255, 255, 255}, purple = {190, 160, 220}, orange = {240, 160, 140}})
   self.timer = 2
   self.timer = 2
 end
 end

+ 33 - 28
data/hud/hudclassselect.lua

@@ -1,7 +1,6 @@
 HudClassSelect = class()
 HudClassSelect = class()
 
 
 local g = love.graphics
 local g = love.graphics
-local w, h = g.width, g.height
 
 
 function HudClassSelect:init()
 function HudClassSelect:init()
   self.team = purple
   self.team = purple
@@ -19,34 +18,36 @@ function HudClassSelect:update()
 end
 end
 
 
 function HudClassSelect:draw()
 function HudClassSelect:draw()
+  local u, v = ctx.hud.u, ctx.hud.v
+
   g.setColor(0, 0, 0, 153)
   g.setColor(0, 0, 0, 153)
-  g.rectangle('fill', 0, 0, w(), h())
-  
+  g.rectangle('fill', 0, 0, u, v)
+
   g.setColor(0, 0, 0, 89)
   g.setColor(0, 0, 0, 89)
-  g.rectangle('fill', w(.08), h(.313), w(.46), h(.35))
-  g.rectangle('fill', w(.55), h(.313), w(.37), h(.58))
+  g.rectangle('fill', u * .08, v * .313, u * .46, v * .35)
+  g.rectangle('fill', u * .55, v * .313, u * .37, v * .58)
   
   
   g.setColor(255, 255, 255, 25)
   g.setColor(255, 255, 255, 25)
-  g.rectangle('line', w(.08), h(.313), w(.46), h(.35))
-  g.rectangle('line', w(.55), h(.313), w(.37), h(.58))
+  g.rectangle('line', u * .08, v * .313, u * .46, v * .35)
+  g.rectangle('line', u * .55, v * .313, u * .37, v * .58)
   
   
-  g.setFont('BebasNeue', h(.065))
+  g.setFont('BebasNeue', v * .065)
   local fh = g.getFont():getHeight()
   local fh = g.getFont():getHeight()
-  local x, y = love.mouse.getPosition()
+  local x, y = ctx.view:frameMouseX(), ctx.view:frameMouseY()
   local teamStr = self.team == purple and 'purple' or 'orange'
   local teamStr = self.team == purple and 'purple' or 'orange'
   local hover
   local hover
   local white, gray = {255, 255, 255}, {128, 128, 128}
   local white, gray = {255, 255, 255}, {128, 128, 128}
   
   
-  hover = math.inside(x, y, w(.08), h(.106), w(.24) + g.getFont():getWidth(teamStr), fh)
+  hover = math.inside(x, y, u * .08, v * .106, u * .24 + g.getFont():getWidth(teamStr), fh)
   g.setColor(hover and white or gray)
   g.setColor(hover and white or gray)
-  g.print('Team', w(.08), h(.106))
+  g.print('Team', u * .08, v * .106)
 
 
   hover = false
   hover = false
   for i = 1, #data.class do
   for i = 1, #data.class do
     g.setColor(255, 255, 255, 25)
     g.setColor(255, 255, 255, 25)
-    g.rectangle('line', w(.09) * i, h(.326), w(.08), w(.08))
+    g.rectangle('line', u * .09 * i, v * .326, u * .08, u * .08)
 
 
-    if math.inside(x, y, w(.09) * i, h(.326), w(.08), w(.08)) then
+    if math.inside(x, y, u * .09 * i, v * .326, u * .08, u * .08) then
       hover = true
       hover = true
       self:drawClassDetails(i)
       self:drawClassDetails(i)
       g.setColor(255, 255, 255)
       g.setColor(255, 255, 255)
@@ -55,22 +56,22 @@ function HudClassSelect:draw()
     end
     end
 
 
     local s = data.class[i].scale * ctx.view.scale * .75
     local s = data.class[i].scale * ctx.view.scale * .75
-    g.draw(data.class[i].sprite, w(.09) * i + w(.04), h(.326) + w(.04), self.angle, s, s, data.class[i].anchorx, data.class[i].anchory)
+    g.draw(data.class[i].sprite, u * .09 * i + u * .04, v * .326 + u * .04, self.angle, s, s, data.class[i].anchorx, data.class[i].anchory)
   end
   end
 
 
   g.setColor(hover and white or gray)
   g.setColor(hover and white or gray)
-  g.print('Class', w(.08), h(.213))
+  g.print('Class', u * .08, v * .213)
 
 
-  hover = math.inside(x, y, w(.08), h(1 - .213) - fh, g.getFont():getWidth('Disconnect'), fh)
+  hover = math.inside(x, y, u * .08, v * (1 - .213) - fh, g.getFont():getWidth('Disconnect'), fh)
   g.setColor(hover and white or gray)
   g.setColor(hover and white or gray)
-  g.print('Disconnect', w(.08), h(1 - .213) - fh)
+  g.print('Disconnect', u * .08, v * (1 - .213) - fh)
 
 
-  hover = math.inside(x, y, w(.08), h(1 - .106) - fh, g.getFont():getWidth('Exit'), fh)
+  hover = math.inside(x, y, u * .08, v * (1 - .106) - fh, g.getFont():getWidth('Exit'), fh)
   g.setColor(hover and white or gray)
   g.setColor(hover and white or gray)
-  g.print('Exit', w(.08), h(1 - .106) - fh)
+  g.print('Exit', u * .08, v * (1 - .106) - fh)
   
   
   g.setColor(self.team == purple and {190, 160, 220} or {240, 160, 140})
   g.setColor(self.team == purple and {190, 160, 220} or {240, 160, 140})
-  g.print(self.team == purple and 'purple' or 'orange', w(.32), h(.106))
+  g.print(self.team == purple and 'purple' or 'orange', u * .32, v * .106)
 end
 end
 
 
 function HudClassSelect:keypressed(key)
 function HudClassSelect:keypressed(key)
@@ -94,9 +95,12 @@ end
 function HudClassSelect:mousepressed() return self.active end
 function HudClassSelect:mousepressed() return self.active end
 
 
 function HudClassSelect:mousereleased(x, y, button)
 function HudClassSelect:mousereleased(x, y, button)
+  local u, v = ctx.hud.u, ctx.hud.v
+  x, y = ctx.view:frameMouseX(), ctx.view:frameMouseY()
+
   if self.active and button == 'l' then
   if self.active and button == 'l' then
     for i = 1, #data.class do
     for i = 1, #data.class do
-      if math.inside(x, y, w(.09) * i, h(.326), w(.08), w(.08)) then
+      if math.inside(x, y, u * .09 * i, v * .326, u * .08, u * .08) then
         ctx.net:send(msgClass, {
         ctx.net:send(msgClass, {
           class = i,
           class = i,
           team = self.team
           team = self.team
@@ -105,14 +109,14 @@ function HudClassSelect:mousereleased(x, y, button)
     end
     end
     
     
     local str = self.team and 'purple' or 'orange'
     local str = self.team and 'purple' or 'orange'
-    g.setFont('BebasNeue', h(.065))
+    g.setFont('BebasNeue', v * .065)
     local font = g.getFont()
     local font = g.getFont()
-    if math.inside(x, y, w(.08), h(.106), w(.24) + font:getWidth(str), font:getHeight()) then
+    if math.inside(x, y, u * .08, v * .106, u * .24 + font:getWidth(str), font:getHeight()) then
       self.team = 1 - self.team
       self.team = 1 - self.team
-    elseif math.inside(x, y, w(.08), h(1 - .213) - font:getHeight(), font:getWidth('Disconnect'), font:getHeight()) then
+    elseif math.inside(x, y, u * .08, v * (1 - .213) - font:getHeight(), font:getWidth('Disconnect'), font:getHeight()) then
       ctx.net:send(msgLeave)
       ctx.net:send(msgLeave)
       ctx.net.server:disconnect()
       ctx.net.server:disconnect()
-    elseif math.inside(x, y, w(.08), h(1 - .106) - font:getHeight(), font:getWidth('Exit'), font:getHeight()) then
+    elseif math.inside(x, y, u * .08, v * (1 - .106) - font:getHeight(), font:getWidth('Exit'), font:getHeight()) then
       ctx.net:send(msgLeave)
       ctx.net:send(msgLeave)
       ctx.net.server:disconnect()
       ctx.net.server:disconnect()
       love.event.quit()
       love.event.quit()
@@ -123,14 +127,15 @@ function HudClassSelect:mousereleased(x, y, button)
 end
 end
 
 
 function HudClassSelect:drawClassDetails(index)
 function HudClassSelect:drawClassDetails(index)
+  local u, v = ctx.hud.u, ctx.hud.v
   local fh = g.getFont():getHeight()
   local fh = g.getFont():getHeight()
   g.setColor(255, 255, 255)
   g.setColor(255, 255, 255)
-  g.print(data.class[index].name, w(.56), h(.243) + g.getFont():getHeight())
+  g.print(data.class[index].name, u * .56, v * .243 + g.getFont():getHeight())
   
   
   g.setFont('pixel', 8)
   g.setFont('pixel', 8)
   g.setColor(255, 255, 255, 150)
   g.setColor(255, 255, 255, 150)
-  g.print(data.class[index].quote, w(.56) + 2, h(.243) + fh * 2)
+  g.print(data.class[index].quote, u * .56 + 2, v * .243 + fh * 2)
 
 
-  g.setFont('BebasNeue', h(.065))
+  g.setFont('BebasNeue', v * .065)
   g.setColor(255, 255, 255)
   g.setColor(255, 255, 255)
 end
 end

+ 1 - 2
data/hud/huddebug.lua

@@ -1,7 +1,6 @@
 HudDebug = class()
 HudDebug = class()
 
 
 local g = love.graphics
 local g = love.graphics
-local w, h = g.width, g.height
 
 
 function HudDebug:draw()
 function HudDebug:draw()
   ctx.players:each(function(p)
   ctx.players:each(function(p)
@@ -27,5 +26,5 @@ function HudDebug:draw()
     debug = debug .. ', ' .. math.floor(ctx.net.host:total_received_data() / 1000 + .5) .. 'rx'
     debug = debug .. ', ' .. math.floor(ctx.net.host:total_received_data() / 1000 + .5) .. 'rx'
   end
   end
   g.setFont('aeromatics', h(.02))
   g.setFont('aeromatics', h(.02))
-  g.print(debug, w() - g.getFont():getWidth(debug), h() - ctx.view.margin * 2 - g.getFont():getHeight())
+  g.print(debug, ctx.hud.u - g.getFont():getWidth(debug), ctx.hud.v - ctx.view.margin * 2 - g.getFont():getHeight())
 end
 end

+ 11 - 10
data/hud/hudfeed.lua

@@ -1,7 +1,6 @@
 HudFeed = class()
 HudFeed = class()
 
 
 local g = love.graphics
 local g = love.graphics
-local w, h = g.width, g.height
 
 
 function HudFeed:init()
 function HudFeed:init()
   self.entries = {}
   self.entries = {}
@@ -19,6 +18,7 @@ function HudFeed:update()
 end
 end
 
 
 function HudFeed:draw()
 function HudFeed:draw()
+  local u, v = ctx.hud.u, ctx.hud.v
   g.setFont('pixel', 8)
   g.setFont('pixel', 8)
   local font = g.getFont()
   local font = g.getFont()
   local alpha = math.min(self.alpha, 1)
   local alpha = math.min(self.alpha, 1)
@@ -26,11 +26,11 @@ function HudFeed:draw()
     local k = self.entries[i]
     local k = self.entries[i]
     local killer = ctx.players:get(k.kill)
     local killer = ctx.players:get(k.kill)
     local victim = ctx.players:get(k.id)
     local victim = ctx.players:get(k.id)
-    local width = math.max(w(.14), font:getWidth(killer.username) + font:getWidth(victim.username) + 24)
+    local width = math.max(u * .14, font:getWidth(killer.username) + font:getWidth(victim.username) + 24)
     g.setColor(0, 0, 0, 200 * alpha)
     g.setColor(0, 0, 0, 200 * alpha)
-    g.rectangle('fill', k.x, k.y, width, h(.05))
+    g.rectangle('fill', k.x, k.y, width, v * .05)
 
 
-    local yy = h(.025) - (font:getHeight() / 2)
+    local yy = v * .025 - (font:getHeight() / 2)
     if killer.team == purple then g.setColor(190, 160, 220, 255 * alpha)
     if killer.team == purple then g.setColor(190, 160, 220, 255 * alpha)
     else g.setColor(240, 160, 140, 255 * alpha) end
     else g.setColor(240, 160, 140, 255 * alpha) end
     g.print(killer.username, k.x + 8, k.y + yy)
     g.print(killer.username, k.x + 8, k.y + yy)
@@ -42,18 +42,19 @@ function HudFeed:draw()
 end
 end
 
 
 function HudFeed:insert(data)
 function HudFeed:insert(data)
+  local u, v = ctx.hud.u, ctx.hud.v
   while #self.entries > 3 do table.remove(self.entries, 1) end
   while #self.entries > 3 do table.remove(self.entries, 1) end
   if #self.entries == 3 then self.entries[1].targetX = w() end
   if #self.entries == 3 then self.entries[1].targetX = w() end
-  for i = 1, #self.entries do self.entries[i].targetY = self.entries[i].targetY + h(.05) + 4 end
+  for i = 1, #self.entries do self.entries[i].targetY = self.entries[i].targetY + v * .05 + 4 end
   local t = table.copy(data)
   local t = table.copy(data)
-  t.x = w()
-  t.y = -h(.05)
+  t.x = u
+  t.y = -v * .05
   g.setFont('pixel', 8)
   g.setFont('pixel', 8)
   local font = g.getFont()
   local font = g.getFont()
   local u1, u2 = ctx.players:get(data.kill).username, ctx.players:get(data.id).username
   local u1, u2 = ctx.players:get(data.kill).username, ctx.players:get(data.id).username
-  local width = math.max(w(.14), font:getWidth(u1) + font:getWidth(u2) + 24)
-  t.targetX = w() - width - 4
-  t.targetY = 4 + h(.07)
+  local width = math.max(u * .14, font:getWidth(u1) + font:getWidth(u2) + 24)
+  t.targetX = u - width - 4
+  t.targetY = 4 + v * .07
   table.insert(self.entries, t)
   table.insert(self.entries, t)
   self.alpha = 4
   self.alpha = 4
 end
 end

+ 4 - 4
data/hud/hudhealth.lua

@@ -1,7 +1,6 @@
 HudHealth = class()
 HudHealth = class()
 
 
 local g = love.graphics
 local g = love.graphics
-local w, h = g.width, g.height
 
 
 function HudHealth:init()
 function HudHealth:init()
   local health = data.media.graphics.hud.health
   local health = data.media.graphics.hud.health
@@ -19,6 +18,7 @@ function HudHealth:update()
 end
 end
 
 
 function HudHealth:draw()
 function HudHealth:draw()
+  local u, v = ctx.hud.u, ctx.hud.v
   local p = ctx.players:get(ctx.id)
   local p = ctx.players:get(ctx.id)
   
   
   self.canvas:clear()
   self.canvas:clear()
@@ -36,12 +36,12 @@ function HudHealth:draw()
     g.setBlendMode('alpha')
     g.setBlendMode('alpha')
     
     
     love.graphics.push()
     love.graphics.push()
-    love.graphics.translate(0, ctx.view.margin)
+    love.graphics.translate(ctx.view.frame.x, ctx.view.frame.y)
   end)
   end)
   
   
   if p then
   if p then
-    local s = w(.4775) / 382
-    local x = w(.5) - (self.canvas:getWidth() * s * .5)
+    local s = u * .4775 / 382
+    local x = u * .5 - (self.canvas:getWidth() * s * .5)
     g.setColor(255, 255, 255, 90)
     g.setColor(255, 255, 255, 90)
     g.draw(self.canvas, x, 0, 0, s, s)
     g.draw(self.canvas, x, 0, 0, s, s)
     g.setColor(255, 255, 255)
     g.setColor(255, 255, 255)

+ 4 - 3
data/hud/hudicons.lua

@@ -29,15 +29,16 @@ function HudIcons:update()
 end
 end
 
 
 function HudIcons:draw()
 function HudIcons:draw()
-  local top = h(.1)
+  local u, v = ctx.hud.u, ctx.hud.v
+  local top = v * .1
   local p = ctx.players:get(ctx.id)
   local p = ctx.players:get(ctx.id)
   if p then
   if p then
     local width = data.media.graphics.icons[p.slots[1].code]:getWidth()
     local width = data.media.graphics.icons[p.slots[1].code]:getWidth()
-    local s = g.minUnit(.08) / width
+    local s = math.min(u, v) * .08 / width
     for i = 1, 5 do
     for i = 1, 5 do
       local icon = data.media.graphics.icons[p.slots[i].code]
       local icon = data.media.graphics.icons[p.slots[i].code]
       local alpha = math.min(math.lerp(self.prevLabelAlphas[i], self.labelAlphas[i], tickDelta / tickRate), 1) * 200
       local alpha = math.min(math.lerp(self.prevLabelAlphas[i], self.labelAlphas[i], tickDelta / tickRate), 1) * 200
-      local iconx = w(.5) - g.minUnit(.213) + g.minUnit(.1065 * (i - 1))
+      local iconx = u * .5 - (math.min(u, v) * .213) + math.min(u, v) * (.1065 * (i - 1))
       g.setColor(255, 255, 255, math.max(alpha, 100) * (255 / 200))
       g.setColor(255, 255, 255, math.max(alpha, 100) * (255 / 200))
       g.draw(icon, iconx - (width * s / 2), top, 0, s, s)
       g.draw(icon, iconx - (width * s / 2), top, 0, s, s)
 
 

+ 7 - 7
data/hud/hudleft.lua

@@ -1,16 +1,16 @@
 HudLeft = class()
 HudLeft = class()
 
 
 local g = love.graphics
 local g = love.graphics
-local w, h = g.width, g.height
 
 
 function HudLeft:draw()
 function HudLeft:draw()
+  local u, v = ctx.hud.u, ctx.hud.v
   local s = ctx.view.scale
   local s = ctx.view.scale
 
 
   g.setColor(255, 255, 255, 64)
   g.setColor(255, 255, 255, 64)
-  g.draw(data.media.graphics.hud.leftBg, -w(.0825), -h(.0083), 0, s, s)
+  g.draw(data.media.graphics.hud.leftBg, -u * .0825, -v * .0083, 0, s, s)
   
   
   g.setColor(255, 255, 255)
   g.setColor(255, 255, 255)
-  g.draw(data.media.graphics.hud.left, -w(.08), -h(.013), 0, s, s)
+  g.draw(data.media.graphics.hud.left, -u * .08, -v * .013, 0, s, s)
   
   
   local p = ctx.players:get(ctx.id)
   local p = ctx.players:get(ctx.id)
   if p then
   if p then
@@ -18,14 +18,14 @@ function HudLeft:draw()
     local ammo = tostring(p.slots[p.weapon].currentAmmo)
     local ammo = tostring(p.slots[p.weapon].currentAmmo)
 
 
     if clip ~= 'nil' and ammo ~= 'nil' then
     if clip ~= 'nil' and ammo ~= 'nil' then
-      g.setFont('BebasNeue', h(.065))
+      g.setFont('BebasNeue', v * .065)
       local font = g:getFont()
       local font = g:getFont()
       g.setColor(255, 255, 255)
       g.setColor(255, 255, 255)
-      g.printCenter(clip .. ' /', w(.055), -h(.004), true, false)
+      g.printCenter(clip .. ' /', u * .055, -v * .004, true, false)
       
       
-      g.setFont('BebasNeue', h(.045))
+      g.setFont('BebasNeue', v * .045)
       g.setColor(255, 255, 255, 153)
       g.setColor(255, 255, 255, 153)
-      g.printCenter(ammo, w(.0575) + (font:getWidth(clip .. ' /') / 2) + (g.getFont():getWidth(ammo) / 2), h(.015), true, false)
+      g.printCenter(ammo, u * .0575 + (font:getWidth(clip .. ' /') / 2) + (g.getFont():getWidth(ammo) / 2), v * .015, true, false)
     end
     end
   end
   end
 end
 end

+ 2 - 3
data/hud/hudplayers.lua

@@ -1,15 +1,14 @@
 HudPlayers = class()
 HudPlayers = class()
 
 
 local g = love.graphics
 local g = love.graphics
-local w, h = g.width, g.height
 
 
 function HudPlayers:draw()
 function HudPlayers:draw()
-  g.setFont('aeromatics', h(.02))
+  g.setFont('pixel', 8)
   ctx.players:each(function(p)
   ctx.players:each(function(p)
     local vx, vy = math.lerp(ctx.view.prevx, ctx.view.x, tickDelta / tickRate), math.lerp(ctx.view.prevy, ctx.view.y, tickDelta / tickRate)
     local vx, vy = math.lerp(ctx.view.prevx, ctx.view.x, tickDelta / tickRate), math.lerp(ctx.view.prevy, ctx.view.y, tickDelta / tickRate)
     local px, py = p:drawPosition()
     local px, py = p:drawPosition()
     local alpha = p.alpha * (1 - (p.cloak / (p.team == ctx.players:get(ctx.id).team and 2 or 1)))
     local alpha = p.alpha * (1 - (p.cloak / (p.team == ctx.players:get(ctx.id).team and 2 or 1)))
-    g.setColor(0, 0, 0, 100 * alpha)
+    g.setColor(0, 0, 0, 150 * alpha)
     g.printCenter(p.username, (px - vx) * ctx.view.scale + 1, ((py - vy) * ctx.view.scale) - 60 + 1)
     g.printCenter(p.username, (px - vx) * ctx.view.scale + 1, ((py - vy) * ctx.view.scale) - 60 + 1)
     if p.team == purple then g.setColor(190, 160, 220, alpha * 255)
     if p.team == purple then g.setColor(190, 160, 220, alpha * 255)
     elseif p.team == orange then g.setColor(240, 160, 140, alpha * 255) end
     elseif p.team == orange then g.setColor(240, 160, 140, alpha * 255) end

+ 15 - 10
data/hud/hudright.lua

@@ -1,28 +1,33 @@
 HudRight = class()
 HudRight = class()
 
 
 local g = love.graphics
 local g = love.graphics
-local w, h = g.width, g.height
 
 
 function HudRight:draw()
 function HudRight:draw()
+  local u, v = ctx.hud.u, ctx.hud.v
   local s = ctx.view.scale
   local s = ctx.view.scale
 
 
   g.setColor(255, 255, 255, 64)
   g.setColor(255, 255, 255, 64)
-  g.draw(data.media.graphics.hud.rightBg, w(.81375), -h(.003), 0, s, s)
+  g.draw(data.media.graphics.hud.rightBg, u * .81375, -v * .003, 0, s, s)
   
   
   g.setColor(255, 255, 255, 255)
   g.setColor(255, 255, 255, 255)
-  g.draw(data.media.graphics.hud.right, w(.80375), -h(.01), 0, s, s)
+  g.draw(data.media.graphics.hud.right, u * .80375, -v * .01, 0, s, s)
   
   
   local p = ctx.players:get(ctx.id)
   local p = ctx.players:get(ctx.id)
   if p then
   if p then
-    g.setFont('BebasNeue', h(.052))
+    g.setFont('BebasNeue', v * .052)
     
     
-    if p.team == purple then love.graphics.setColor(190, 160, 220)
-    else love.graphics.setColor(240, 160, 140) end
-    g.print(tostring(ctx.map.points[p.team]), w(.85875), -h(.008))
+    g.setColor(0, 0, 0, 100)
+    g.print(tostring(ctx.map.points[p.team]), u * .85 + 2, -v * .008 + 2)
+    if p.team == purple then g.setColor(190, 160, 220)
+    else g.setColor(240, 160, 140) end
+    g.print(tostring(ctx.map.points[p.team]), u * .85, -v * .008)
     
     
-    if p.team == purple then love.graphics.setColor(240, 160, 140)
-    else love.graphics.setColor(190, 160, 220) end
     local str = tostring(ctx.map.points[1 - p.team])
     local str = tostring(ctx.map.points[1 - p.team])
-    g.print(str, w(.95) - g.getFont():getWidth(str), -h(.008))
+    local x = u * (.80375 + (data.media.graphics.hud.right:getWidth() * s / u) - .0525) - g.getFont():getWidth(str)
+    g.setColor(0, 0, 0, 100)
+    g.print(str, x + 2, -v * .008 + 2)
+    if p.team == purple then g.setColor(240, 160, 140)
+    else g.setColor(190, 160, 220) end
+    g.print(str, x, -v * .008)
   end
   end
 end
 end

+ 1 - 1
data/prop/tree.lua

@@ -14,7 +14,7 @@ end
 
 
 function Tree:update()
 function Tree:update()
   if ctx.view then
   if ctx.view then
-    self.depth = -2000 + math.distance(ctx.view.x + ctx.view.w / 2, ctx.view.y + ctx.view.h / 2, self.x, self.y)
+    self.depth = -2000 + math.distance(ctx.view.x + ctx.view.width / 2, ctx.view.y + ctx.view.height / 2, self.x, self.y)
   end
   end
 end
 end
 
 

+ 4 - 4
data/prop/wall.lua

@@ -72,7 +72,7 @@ end
 function Wall:update()
 function Wall:update()
   if ctx.view then
   if ctx.view then
     if not self:inView() then return end
     if not self:inView() then return end
-    local x1, y1 = ctx.view.x + ctx.view.w / 2, ctx.view.y + ctx.view.h / 2
+    local x1, y1 = ctx.view.x + ctx.view.width / 2, ctx.view.y + ctx.view.height / 2
     local x2, y2 = perim(x1, y1, self.x, self.y, self.width, self.height)
     local x2, y2 = perim(x1, y1, self.x, self.y, self.width, self.height)
     self.depth = math.clamp(math.distance(x1, y1, x2, y2) * ctx.view.scale - 1000, -4096, -16)
     self.depth = math.clamp(math.distance(x1, y1, x2, y2) * ctx.view.scale - 1000, -4096, -16)
   end
   end
@@ -98,7 +98,7 @@ function Wall:draw()
   self.top:setVertex(4, llx, lly, 0, h)
   self.top:setVertex(4, llx, lly, 0, h)
 
 
   love.graphics.setColor(255, 255, 255)
   love.graphics.setColor(255, 255, 255)
-  local y2 = ctx.view.y + (ctx.view.h / 2)
+  local y2 = ctx.view.y + (ctx.view.height / 2)
   if self.y > y2 then
   if self.y > y2 then
     self.north:setVertex(3, urx, ury, w, h)
     self.north:setVertex(3, urx, ury, w, h)
     self.north:setVertex(4, ulx, uly, 0, h)
     self.north:setVertex(4, ulx, uly, 0, h)
@@ -111,7 +111,7 @@ function Wall:draw()
     love.graphics.draw(self.south, 0, 0)
     love.graphics.draw(self.south, 0, 0)
   end
   end
 
 
-  local x2 = ctx.view.x + (ctx.view.w / 2)
+  local x2 = ctx.view.x + (ctx.view.width / 2)
   if self.x > x2 then
   if self.x > x2 then
     self.west:setVertex(2, ulx, uly, w, 0)
     self.west:setVertex(2, ulx, uly, w, 0)
     self.west:setVertex(3, llx, lly, w, h)
     self.west:setVertex(3, llx, lly, w, h)
@@ -130,7 +130,7 @@ end
 function Wall:inView()
 function Wall:inView()
   local x, y, w, h = self.x, self.y, self.width, self.height
   local x, y, w, h = self.x, self.y, self.width, self.height
   local v = ctx.view
   local v = ctx.view
-  return x + w >= v.x and x <= v.x + v.w and y + h >= v.y and y <= v.y + v.h
+  return x + w >= v.x and x <= v.x + v.width and y + h >= v.y and y <= v.y + v.height
 end
 end
 
 
 function Wall:updateMesh()
 function Wall:updateMesh()

+ 1 - 1
data/weapon/shotgun.lua

@@ -33,7 +33,7 @@ Shotgun.tipy = -10
 ----------------
 ----------------
 function Shotgun:crosshair()
 function Shotgun:crosshair()
   local g, p, x, y = love.graphics, ctx.players:get(ctx.id), love.mouse.getPosition()
   local g, p, x, y = love.graphics, ctx.players:get(ctx.id), love.mouse.getPosition()
-  local vx, vy, s = ctx.view:mouseX(), ctx.view:mouseY(), ctx.view.scale
+  local vx, vy, s = ctx.view:worldMouseX(), ctx.view:worldMouseY(), ctx.view.scale
   local d = math.distance(p.x, p.y, vx, vy)
   local d = math.distance(p.x, p.y, vx, vy)
   local alpha = 50 + ((300 - math.clamp(d - 200, 0, 300)) / 300) * 205
   local alpha = 50 + ((300 - math.clamp(d - 200, 0, 300)) / 300) * 205
   
   

+ 1 - 1
data/weapon/smg.lua

@@ -32,7 +32,7 @@ SMG.tipy = 0
 ----------------
 ----------------
 function SMG:crosshair()
 function SMG:crosshair()
   local g, p, x, y = love.graphics, ctx.players:get(ctx.id), love.mouse.getPosition()
   local g, p, x, y = love.graphics, ctx.players:get(ctx.id), love.mouse.getPosition()
-  local vx, vy, s = ctx.view:mouseX(), ctx.view:mouseY(), ctx.view.scale
+  local vx, vy, s = ctx.view:worldMouseX(), ctx.view:worldMouseY(), ctx.view.scale
   local d = math.distance(p.x, p.y, vx, vy)
   local d = math.distance(p.x, p.y, vx, vy)
   local r = math.abs(math.atan(self.spread)) * math.distance(p.x, p.y, vx, vy) * s
   local r = math.abs(math.atan(self.spread)) * math.distance(p.x, p.y, vx, vy) * s
   local len = 4 * s
   local len = 4 * s

+ 1 - 1
data/weather/snow.lua

@@ -29,7 +29,7 @@ end
 function Snow:gui()
 function Snow:gui()
   love.graphics.setColor(255, 255, 255, 90)
   love.graphics.setColor(255, 255, 255, 90)
   local factor = 1
   local factor = 1
-  local x, y = (ctx.view.x + ctx.view.w / 2 - self.x), (ctx.view.y + ctx.view.h / 2 - self.y)
+  local x, y = (ctx.view.x + ctx.view.width / 2 - self.x), (ctx.view.y + ctx.view.height / 2 - self.y)
   
   
   for _, z in ipairs({64, 128, 256}) do
   for _, z in ipairs({64, 128, 256}) do
     local scale = 1 + (ctx.view:convertZ(z) / 500)
     local scale = 1 + (ctx.view:convertZ(z) / 500)

+ 1 - 0
lib/core/game.lua

@@ -44,5 +44,6 @@ function Game:textinput(character) self.hud:textinput(character) end
 
 
 function Game:resize()
 function Game:resize()
   self.view:resize()
   self.view:resize()
+  self.hud:resize()
   Typo:resize()
   Typo:resize()
 end
 end

+ 57 - 29
lib/core/view.lua

@@ -6,14 +6,24 @@ function View:init()
 
 
   self.x = 0
   self.x = 0
   self.y = 0
   self.y = 0
-  self.w = 800
-  self.h = 600
-  self.xlimit = self.w
-  self.ylimit = self.h
+  self.width = 960
+  self.height = 600
+  self.xmin = 0
+  self.ymin = 0
+  self.xmax = self.width
+  self.ymax = self.height
+
+  self.frame = {}
+  self.frame.x = 0
+  self.frame.y = 0
+  self.frame.width = love.window.getWidth()
+  self.frame.height = love.window.getHeight()
+
   self.toDraw = {}
   self.toDraw = {}
   self.target = nil
   self.target = nil
 
 
   self:resize()
   self:resize()
+
   self.prevx = 0
   self.prevx = 0
   self.prevy = 0
   self.prevy = 0
   self.prevscale = self.scale
   self.prevscale = self.scale
@@ -30,11 +40,11 @@ end
 
 
 function View:draw()
 function View:draw()
   love.graphics.push()
   love.graphics.push()
-  love.graphics.translate(0, self.margin)
+  love.graphics.translate(self.frame.x, self.frame.y)
 
 
   love.graphics.push()
   love.graphics.push()
-  local x, y = math.lerp(self.prevx, self.x, tickDelta / tickRate), math.lerp(self.prevy, self.y, tickDelta / tickRate)
-  love.graphics.scale(math.lerp(self.prevscale, self.scale, tickDelta / tickRate))
+  local x, y, s = unpack(table.interpolate({self.prevx, self.prevy, self.prevscale}, {self.x, self.y, self.scale}, tickDelta / tickRate))
+  love.graphics.scale(s)
   love.graphics.translate(-x, -y)
   love.graphics.translate(-x, -y)
   
   
   table.sort(self.toDraw, function(a, b)
   table.sort(self.toDraw, function(a, b)
@@ -49,14 +59,32 @@ function View:draw()
   
   
   local w, h = love.graphics.getDimensions()
   local w, h = love.graphics.getDimensions()
   love.graphics.pop()
   love.graphics.pop()
+
   love.graphics.setColor(0, 0, 0, 255)
   love.graphics.setColor(0, 0, 0, 255)
-  love.graphics.rectangle('fill', 0, 0, w, self.margin)
-  love.graphics.rectangle('fill', 0, h - self.margin, w, self.margin)
+  love.graphics.rectangle('fill', 0, 0, w, self.frame.y)
+  love.graphics.rectangle('fill', 0, 0, self.frame.x, h)
+  love.graphics.rectangle('fill', 0, self.frame.y + self.frame.height, w, h - (self.frame.y + self.frame.height))
+  love.graphics.rectangle('fill', self.frame.x + self.frame.width, 0, w - (self.frame.x + self.frame.width), h)
 end
 end
 
 
 function View:resize()
 function View:resize()
-  self.scale = love.graphics.getWidth() / self.w
-  self.margin = math.max(math.round(((love.graphics.getHeight() - love.graphics.getWidth() * (self.h / self.w)) / 2)), 0)
+  self.frame.x, self.frame.y = 0, 0
+  self.frame.width, self.frame.height = self.width, self.height
+  if (self.width / self.height) > (love.graphics.getWidth() / love.graphics.getHeight()) then
+    self.margin = math.max(math.round(((love.graphics.getHeight() - love.graphics.getWidth() * (self.height / self.width)) / 2)), 0)
+    self.scale = love.graphics.getWidth() / self.width
+    local margin = math.max(math.round(((love.graphics.getHeight() - love.graphics.getWidth() * (self.height / self.width)) / 2)), 0)
+    self.frame.y = margin
+    self.frame.height = love.graphics.getHeight() - 2 * margin
+    self.frame.width = love.graphics.width()
+  else
+    self.margin = math.max(math.round(((love.graphics.getWidth() - love.graphics.getHeight() * (self.width / self.height)) / 2)), 0)
+    self.scale = love.graphics.getHeight() / self.height
+    local margin = math.max(math.round(((love.graphics.getWidth() - love.graphics.getHeight() * (self.width / self.height)) / 2)), 0)
+    self.frame.x = margin
+    self.frame.width = love.graphics.getWidth() - 2 * margin
+    self.frame.height = love.graphics.getHeight()
+  end
 end
 end
 
 
 function View:register(x)
 function View:register(x)
@@ -70,47 +98,47 @@ function View:unregister(x)
   end
   end
 end
 end
 
 
-function View:setTarget(obj)
-  self.target = obj
-end
-
 function View:convertZ(z)
 function View:convertZ(z)
   return (.8 * z) ^ (1 + (.0008 * z))  
   return (.8 * z) ^ (1 + (.0008 * z))  
 end
 end
 
 
 function View:three(x, y, z)
 function View:three(x, y, z)
   z = self:convertZ(z)
   z = self:convertZ(z)
-  return x - (z * ((self.x + self.w / 2 - x) / 500)), y - (z * ((self.y + self.h / 2 - y) / 500))
+  return x - (z * ((self.x + self.width / 2 - x) / 500)), y - (z * ((self.y + self.height / 2 - y) / 500))
 end
 end
 
 
 function View:contain()
 function View:contain()
-  self.x = math.clamp(self.x, 0, self.xlimit - self.w)
-  self.y = math.clamp(self.y, 0, self.ylimit - self.h)
+  self.x = math.clamp(self.x, 0, self.xmax - self.width)
+  self.y = math.clamp(self.y, 0, self.ymax - self.height)
 end
 end
 
 
 function View:follow()
 function View:follow()
   if not self.target then return end
   if not self.target then return end
 
 
-  local dis, dir = math.vector(self.target.x, self.target.y, self:mouseX(), self:mouseY())
+  local dis, dir = math.vector(self.target.x, self.target.y, self:worldMouseX(), self:worldMouseY())
   local margin = 0.8
   local margin = 0.8
   
   
   dis = 0--dis / 10
   dis = 0--dis / 10
  
  
-  self.x = self.target.x + math.dx(dis, dir) - (self.w / 2)
-  self.y = self.target.y + math.dy(dis, dir) - (self.h / 2)
+  self.x = self.target.x + math.dx(dis, dir) - (self.width / 2)
+  self.y = self.target.y + math.dy(dis, dir) - (self.height / 2)
   
   
-  self.x = math.clamp(self.x, self.target.x - (self.w * margin), self.target.x + (self.w * margin) - self.w)
-  self.y = math.clamp(self.y, self.target.y - (self.h * margin), self.target.y + (self.h * margin) - self.h)
+  self.x = math.clamp(self.x, self.target.x - (self.width * margin), self.target.x + (self.width * margin) - self.width)
+  self.y = math.clamp(self.y, self.target.y - (self.height * margin), self.target.y + (self.height * margin) - self.height)
 end
 end
 
 
-function View:setLimits(x, y)
-  self.xlimit, self.ylimit = x, y
+function View:worldMouseX()
+  return math.round(((love.mouse.getX() - self.frame.x) / self.scale) + self.x)
 end
 end
 
 
-function View:mouseX()
-  return math.round((love.mouse.getX() / self.scale) + self.x)
+function View:worldMouseY()
+  return math.round(((love.mouse.getY() - self.frame.y) / self.scale) + self.y)
 end
 end
 
 
-function View:mouseY()
-  return math.round(((love.mouse.getY() - self.margin) / self.scale) + self.y)
+function View:frameMouseX()
+  return love.mouse.getX() - self.frame.x
 end
 end
+
+function View:frameMouseY()
+  return love.mouse.getY() - self.frame.y
+end

+ 1 - 1
lib/editor/editordeletor.lua

@@ -5,7 +5,7 @@ local function invoke(x, k, ...) return x.editor[k](x, ...) end
 function EditorDeletor:keypressed(key)
 function EditorDeletor:keypressed(key)
   if key == 'delete' then
   if key == 'delete' then
     table.each(ctx.map.props, function(p)
     table.each(ctx.map.props, function(p)
-      if math.inside(ctx.view:mouseX(), ctx.view:mouseY(), invoke(p, 'boundingBox')) then
+      if math.inside(ctx.view:worldMouseX(), ctx.view:worldMouseY(), invoke(p, 'boundingBox')) then
         ctx.view:unregister(p)
         ctx.view:unregister(p)
         ctx.map.props = table.filter(ctx.map.props, function(prop) return p ~= prop end)
         ctx.map.props = table.filter(ctx.map.props, function(prop) return p ~= prop end)
         ctx.event:emit('prop.destroy', p)
         ctx.event:emit('prop.destroy', p)

+ 3 - 3
lib/editor/editordragger.lua

@@ -14,7 +14,7 @@ function EditorDragger:update()
   if self.dragging then
   if self.dragging then
     ctx.selector:each(function(prop)
     ctx.selector:each(function(prop)
       local ox, oy = ctx.grid:snap(prop._dragX, prop._dragY)
       local ox, oy = ctx.grid:snap(prop._dragX, prop._dragY)
-      local x, y = ctx.grid:snap(ctx.view:mouseX() - self.dragX, ctx.view:mouseY() - self.dragY)
+      local x, y = ctx.grid:snap(ctx.view:worldMouseX() - self.dragX, ctx.view:worldMouseY() - self.dragY)
       prop.x, prop.y = ox + x, oy + y
       prop.x, prop.y = ox + x, oy + y
       ctx.event:emit('collision.move', {object = prop, x = ox + x, y = oy + y})
       ctx.event:emit('collision.move', {object = prop, x = ox + x, y = oy + y})
     end)
     end)
@@ -30,8 +30,8 @@ function EditorDragger:mousepressed(x, y, button)
       self.deselect = true
       self.deselect = true
     end
     end
     self.dragging = true
     self.dragging = true
-    self.dragX = ctx.view:mouseX()
-    self.dragY = ctx.view:mouseY()
+    self.dragX = ctx.view:worldMouseX()
+    self.dragY = ctx.view:worldMouseY()
     ctx.selector:each(function(prop)
     ctx.selector:each(function(prop)
       prop._dragX = prop.x
       prop._dragX = prop.x
       prop._dragY = prop.y
       prop._dragY = prop.y

+ 1 - 1
lib/editor/editormenu.lua

@@ -73,7 +73,7 @@ function EditorMenu:mousepressed(x, y, button)
   if button == 'l' then
   if button == 'l' then
     for i = 1, #self.props do
     for i = 1, #self.props do
       if math.inside(x, y, self.x, self.y + h(.09) + (g.getFont():getHeight() + 1) * i, self.w, g.getFont():getHeight()) then
       if math.inside(x, y, self.x, self.y + h(.09) + (g.getFont():getHeight() + 1) * i, self.w, g.getFont():getHeight()) then
-        local x, y = ctx.view.x + ctx.view.w / 2, ctx.view.y + ctx.view.h / 2
+        local x, y = ctx.view.x + ctx.view.width / 2, ctx.view.y + ctx.view.height / 2
         table.insert(ctx.map.props, ctx.map:initProp({
         table.insert(ctx.map.props, ctx.map:initProp({
           kind = self.props[i],
           kind = self.props[i],
           x = x,
           x = x,

+ 2 - 2
lib/editor/editorscaler.lua

@@ -59,8 +59,8 @@ function EditorScaler:mousepressed(x, y, button)
     if p then
     if p then
       local x, y = ctx.view:transform(x, y)
       local x, y = ctx.view:transform(x, y)
       self.scaling = p
       self.scaling = p
-      self.scaleOriginX = ctx.view:mouseX()
-      self.scaleOriginY = ctx.view:mouseY()
+      self.scaleOriginX = ctx.view:worldMouseX()
+      self.scaleOriginY = ctx.view:worldMouseY()
       p._scaleX = p.x
       p._scaleX = p.x
       p._scaleY = p.y
       p._scaleY = p.y
       if p.collision.shape == 'rectangle' then
       if p.collision.shape == 'rectangle' then

+ 2 - 1
lib/map.lua

@@ -74,7 +74,8 @@ function Map:init(name)
   self.depth = 5
   self.depth = 5
   if ctx.view then
   if ctx.view then
     ctx.view:register(self)
     ctx.view:register(self)
-    ctx.view:setLimits(self.width, self.height)
+    ctx.view.xmax = self.width
+    ctx.view.ymax = self.height
   end
   end
  
  
   if self.weather then
   if self.weather then

+ 13 - 11
lib/playermain.lua

@@ -10,9 +10,9 @@ function PlayerMain:activate()
   self.lastHurt = tick
   self.lastHurt = tick
   if self.heartbeatSound then self.heartbeatSound:stop() end
   if self.heartbeatSound then self.heartbeatSound:stop() end
   self.heartbeatSound = ctx.sound:loop({sound = 'heartbeat'})
   self.heartbeatSound = ctx.sound:loop({sound = 'heartbeat'})
-  self.heartbeatSound:pause()
+  if self.heartbeatSound then self.heartbeatSound:pause() end
 
 
-  ctx.view:setTarget(self)
+  ctx.view.target = self
 
 
   Player.activate(self)
   Player.activate(self)
 end
 end
@@ -38,12 +38,14 @@ function PlayerMain:update()
   self:slot(input)
   self:slot(input)
   self:fade()
   self:fade()
   
   
-  if self.health < self.maxHealth * .5 then
-    if self.heartbeatSound:isPaused() then self.heartbeatSound:resume() end
-    local prc = self.health / self.maxHealth
-    self.heartbeatSound:setVolume(math.min(1 - ((prc - .3) / .2), 1.0))
-  elseif not self.heartbeatSound:isPaused() then
-    self.heartbeatSound:pause()
+  if self.heartbeatSound then
+    if self.health < self.maxHealth * .5 then
+      if self.heartbeatSound:isPaused() then self.heartbeatSound:resume() end
+      local prc = self.health / self.maxHealth
+      self.heartbeatSound:setVolume(math.min(1 - ((prc - .3) / .2), 1.0))
+    elseif not self.heartbeatSound:isPaused() then
+      self.heartbeatSound:pause()
+    end
   end
   end
  
  
   ctx.net:buffer(msgInput, input)
   ctx.net:buffer(msgInput, input)
@@ -82,8 +84,8 @@ function PlayerMain:readInput()
     t[k] = love.keyboard.isDown(k)
     t[k] = love.keyboard.isDown(k)
   end
   end
   
   
-  t.x = ctx.view:mouseX()
-  t.y = ctx.view:mouseY()
+  t.x = ctx.view:worldMouseX()
+  t.y = ctx.view:worldMouseY()
   t.l = love.mouse.isDown('l')
   t.l = love.mouse.isDown('l')
   t.r = love.mouse.isDown('r')
   t.r = love.mouse.isDown('r')
 
 
@@ -121,6 +123,6 @@ function PlayerMain:hurt()
 end
 end
 
 
 function PlayerMain:die()
 function PlayerMain:die()
-  self.heartbeatSound:pause()
+  if self.heartbeatSound then self.heartbeatSound:pause() end
   Player.die(self)
   Player.die(self)
 end
 end