Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distortion fixes #2395

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/autosave_warning.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ function state:enter()
Timer.add(8, function()
Gamestate.switch('scanning')
end)
local width, height, flags = love.window.getMode()
self.width = width*window.scale
self.height = height*window.scale
end

function state:leave()
Expand All @@ -40,8 +43,8 @@ function state:draw()
local width = self.background:getWidth()
local height = self.background:getHeight()

local x = (window.width - width)/2
local y = (window.height - height)/2
local x = (self.width - width)/2
local y = (self.height - height)/2

love.graphics.draw(self.background, x, y)
self.savingAnimation:draw(self.savingImage, x + 10, y + 10)
Expand Down
58 changes: 35 additions & 23 deletions src/blackjackgame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ end
function state:enter(previous, player, screenshot)
sound.playMusic( "tavern" )
--lazy because i want to reset all position data

local width, height, flags = love.window.getMode()
self.width = width*window.scale
self.height = height*window.scale
self.x = camera.x + (self.width - window.width)/2
self.y = camera.y + (self.height - window.height)/2

self.previous = previous
self.screenshot = screenshot
Expand All @@ -91,22 +97,22 @@ function state:enter(previous, player, screenshot)

self.cardback = love.graphics.newQuad( self.cardback_idx * self.card_width, self.card_height * 4, self.card_width, self.card_height, self.cardSprite:getDimensions() )

self.chip_x = 168 + camera.x
self.chip_y = 237 + camera.y
self.chip_x = 168 + self.x
self.chip_y = 237 + self.y

self.center_x = ( window.width / 2 ) + camera.x
self.center_y = ( window.height / 2 ) + camera.y
self.dealer_stack_x = 386 + camera.x
self.dealer_stack_y = 66 + camera.y
self.center_x = ( window.width / 2 ) + self.x
self.center_y = ( window.height / 2 ) + self.y
self.dealer_stack_x = 386 + self.x
self.dealer_stack_y = 66 + self.y

self.dealer_result_pos_x = 346 + camera.x
self.dealer_result_pos_y = 89 + camera.y
self.dealer_result_pos_x = 346 + self.x
self.dealer_result_pos_y = 89 + self.y

self.outcome_pos_x = 225 + camera.x
self.outcome_pos_y = 141 + camera.y
self.outcome_pos_x = 225 + self.x
self.outcome_pos_y = 141 + self.y

self.options_x = 395 + camera.x
self.options_y = 145 + camera.y
self.options_x = 395 + self.x
self.options_y = 145 + self.y
self.selection = 4

-- Don't allow the player to bet more money than they have
Expand Down Expand Up @@ -356,7 +362,7 @@ end

function state:dealCard(to) -- Deal out an individual card, will update score as well, no bust logic
--Initiate location of card
x = 293 + camera.x
x = 293 + self.x

-- cards dealt face up except for second dealer card
local face_up = true
Expand All @@ -367,14 +373,14 @@ function state:dealCard(to) -- Deal out an individual card, will update score as

if to == 'dealer' then
hand = self.dealerHand[1]
y = 66 + camera.y
y = 66 + self.y
-- second card is not shown
if #self.dealerHand[1].cards == 1 then
face_up = false
end
elseif to == 'player' then
hand = self.playerHand[self.activeHand]
y = 169 + ( self.activeHand - 1 ) * 9 + camera.y
y = 169 + ( self.activeHand - 1 ) * 9 + self.y
end

self.card_moving = true
Expand Down Expand Up @@ -476,7 +482,7 @@ function state:split()

--move 2nd card to new hand and move to new row
self.playerHand[newHandNum].cards[1] = table.remove(self.playerHand[self.activeHand].cards) --move second card to new hand
self.playerHand[newHandNum].cards[1].y = 169 + camera.y + ( newHandNum - 1 ) * 9 -- place hand in new row
self.playerHand[newHandNum].cards[1].y = 169 + self.y + ( newHandNum - 1 ) * 9 -- place hand in new row
self.playerHand[newHandNum].cards[1].x = self.playerHand[self.activeHand].cards[1].x

if self.playerHand[self.activeHand].cards[1].card == 1 then
Expand Down Expand Up @@ -612,14 +618,20 @@ function state:updateScore(hand) -- Accepts dealerHand[1] or playerHand[activeHa
end

function state:draw()

if self.screenshot then
love.graphics.draw(self.screenshot, camera.x, camera.y, 0,
window.width / love.graphics:getWidth(), window.height / love.graphics:getHeight() )
love.graphics.draw( self.screenshot, self.x + camera.x, self.y + camera.y, 0, self.width / love.graphics:getWidth(), self.height / love.graphics:getHeight() )
-- hiding the HUD
love.graphics.setColor( 0, 0, 0, 255)
love.graphics.rectangle("fill", camera.x, camera.y, (self.width - window.width)/2, self.height)
love.graphics.rectangle("fill", camera.x, camera.y, self.width, (self.height - window.height)/2)
love.graphics.setColor( 255, 255, 255, 255)
else
love.graphics.setColor(0, 0, 0, 255)
love.graphics.rectangle('fill', 0, 0, love.graphics:getDimensions() )
love.graphics.setColor(255, 255, 255, 255)
love.graphics.setColor( 0, 0, 0, 255 )
love.graphics.rectangle( 'fill', 0, 0, self.width, self.height )
love.graphics.setColor( 255, 255, 255, 255 )
end

love.graphics.draw( self.table, self.center_x - ( self.table:getWidth() / 2 ), self.center_y - ( self.table:getHeight() / 2 ))

--dealer stack
Expand Down Expand Up @@ -726,9 +738,9 @@ function state:draw()
love.graphics.print(self.outcome, self.outcome_pos_x, self.outcome_pos_y, 0, 0.5)
end
-- print current money
love.graphics.print( 'On Hand\n $ ' .. self.player.money, 110+camera.x, 244+camera.y, 0, 0.5)
love.graphics.print( 'On Hand\n $ ' .. self.player.money, 110+self.x, 244+self.y, 0, 0.5)
-- print current bet
love.graphics.print('Bet $ ' .. self.currentBet, 361+camera.x, 141+camera.y, 0, 0.5)
love.graphics.print('Bet $ ' .. self.currentBet, 361+self.x, 141+self.y, 0, 0.5)

love.graphics.setColor( 255, 255, 255, 255 )

Expand Down
17 changes: 10 additions & 7 deletions src/brewing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ end
--enter may take additional arguments from previous as necessary
--@param previous the actual gamestate that the player came from (not just its name)
function state:enter(previous, player, screenshot, supplierName)
local width, height, flags = love.window.getMode()
self.width = width*window.scale
self.height = height*window.scale

fonts.set( 'arial' )
sound.playMusic( "potionlab" )
self.previous = previous
Expand Down Expand Up @@ -191,17 +195,17 @@ end
function state:draw()

if self.screenshot then
love.graphics.draw( self.screenshot, camera.x, camera.y, 0, window.width / love.graphics:getWidth(), window.height / love.graphics:getHeight() )
love.graphics.draw( self.screenshot, camera.x, camera.y, 0, self.width / love.graphics:getWidth(), self.height / love.graphics:getHeight() )
else
love.graphics.setColor( 0, 0, 0, 255 )
love.graphics.rectangle( 'fill', 0, 0, love.graphics:getWidth(), love.graphics:getHeight() )
love.graphics.rectangle( 'fill', 0, 0, love.graphics:getDimensions() )
love.graphics.setColor( 255, 255, 255, 255 )
end

self.hud:draw( self.player )

local width = window.width
local height = window.height
local width = self.width
local height = self.height
local menu_right = camera.x + width/2 - self.background:getWidth()/2
local menu_top = camera.y + height/2 - self.background:getHeight()/2
love.graphics.draw( self.background, menu_right,menu_top, 0 )
Expand All @@ -213,9 +217,8 @@ function state:draw()
love.graphics.newQuad(0,0,selectionSprite:getWidth(),selectionSprite:getHeight(),selectionSprite:getWidth(),selectionSprite:getHeight()),
firstcell_right, firstcell_top + ((self.selected-1) * 22))

love.graphics.setColor( 255, 255, 255, 255 )
love.graphics.printf(self.player.controls:getKey('JUMP') .. " BREW", 0, 200, width, 'center')
love.graphics.printf(self.player.controls:getKey('START') .. " CANCEL", 0, 213, width, 'center')
love.graphics.printf(self.player.controls:getKey('JUMP') .. " BREW", menu_right, 200, self.background:getWidth(), 'center')
love.graphics.printf(self.player.controls:getKey('START') .. " CANCEL", menu_right, 213, self.background:getWidth(), 'center')

for i = 1,4 do
if self.values[i+self.offset] ~= nil then
Expand Down
8 changes: 6 additions & 2 deletions src/cheatscreen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ function cheatscreen:enter( previous, real_previous )

camera:setPosition(0, 0)
self.previous = real_previous

local width, height, flags = love.window.getMode()
self.width = width*window.scale
self.height = height*window.scale

self.current_key = 'g'
end
Expand Down Expand Up @@ -186,9 +190,9 @@ function cheatscreen:keypressed( button )
end

function cheatscreen:draw()
local y = self.cmd.offset_y
local y = self.cmd.offset_y + (self.height - window.height)/2
love.graphics.setColor( 0, 0, 0, 255 )
love.graphics.rectangle( 'fill', 0, 0, window.width, window.height )
love.graphics.rectangle( 'fill', camera.x, camera.y, self.width, self.height )
love.graphics.setColor( 88, 246, 0, 255 )
for i,n in pairs(self.cmd.queue) do
love.graphics.print( n, self.cmd.offset_x, y, 0, 0.5, 0.5 )
Expand Down
5 changes: 4 additions & 1 deletion src/credits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ function state:enter(previous)
self.ty = 0
camera:setPosition(0, self.ty)
self.previous = previous
local width, height, flags = love.window.getMode()
self.width = width*window.scale
self.height = height*window.scale
end

function state:leave()
Expand Down Expand Up @@ -378,7 +381,7 @@ function state:draw()
for i = shift - 14, shift + 1 do
local name = self.credits[i]
if name then
love.graphics.printf(name, 0, window.height + 25 * i, window.width, 'center')
love.graphics.printf(name, 0, self.height + 25 * i, self.width, 'center')
end
end
end
Expand Down
15 changes: 9 additions & 6 deletions src/frying.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ end
--enter may take additional arguments from previous as necessary
--@param previous the actual gamestate that the player came from (not just its name)
function state:enter(previous, player, screenshot, supplierName)
local width, height, flags = love.window.getMode()
self.width = width*window.scale
self.height = height*window.scale
fonts.set( 'arial' )
sound.playMusic( "potionlab" )
self.previous = previous
Expand Down Expand Up @@ -191,17 +194,17 @@ end
function state:draw()

if self.screenshot then
love.graphics.draw( self.screenshot, camera.x, camera.y, 0, window.width / love.graphics:getWidth(), window.height / love.graphics:getHeight() )
love.graphics.draw( self.screenshot, camera.x, camera.y, 0, self.width / love.graphics:getWidth(), self.height / love.graphics:getHeight() )
else
love.graphics.setColor( 0, 0, 0, 255 )
love.graphics.rectangle( 'fill', 0, 0, love.graphics:getWidth(), love.graphics:getHeight() )
love.graphics.rectangle( 'fill', 0, 0, love.graphics:getDimensions() )
love.graphics.setColor( 255, 255, 255, 255 )
end

self.hud:draw( self.player )

local width = window.width
local height = window.height
local width = self.width
local height = self.height
local menu_right = camera.x + width/2 - self.background:getWidth()/2
local menu_top = camera.y + height/2 - self.background:getHeight()/2
love.graphics.draw( self.background, menu_right,menu_top, 0 )
Expand All @@ -214,8 +217,8 @@ function state:draw()
firstcell_right, firstcell_top + ((self.selected-1) * 22))

love.graphics.setColor( 255, 255, 255, 255 )
love.graphics.printf(self.player.controls:getKey('JUMP') .. " fry", 0, 200, width, 'center')
love.graphics.printf(self.player.controls:getKey('START') .. " CANCEL", 0, 213, width, 'center')
love.graphics.printf(self.player.controls:getKey('JUMP') .. " fry", menu_right, 200, self.background:getWidth(), 'center')
love.graphics.printf(self.player.controls:getKey('START') .. " CANCEL", menu_right, 213, self.background:getWidth(), 'center')

for i = 1,4 do
if self.values[i+self.offset] ~= nil then
Expand Down
25 changes: 15 additions & 10 deletions src/instructions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ menu:onSelect(function()
state.statusText = "PRESS NEW KEY" end)

function state:init()
VerticalParticles.init()

self.arrow = love.graphics.newImage("images/menu/arrow.png")
self.background = love.graphics.newImage("images/menu/pause.png")
Expand All @@ -56,12 +55,16 @@ end
function state:enter(previous)
fonts.set( 'big' )
sound.playMusic( "daybreak" )

VerticalParticles.init()

camera:setPosition(0, 0)
self.instructions = controls:getActionmap()
self.previous = previous
self.option = 0
self.statusText = ''
local width, height, flags = love.window.getMode()
self.width = width*window.scale
self.height = height*window.scale
end

function state:leave()
Expand All @@ -82,29 +85,31 @@ function state:draw()
VerticalParticles.draw()

love.graphics.draw(self.background,
camera:getWidth() / 2 - self.background:getWidth() / 2,
camera:getHeight() / 2 - self.background:getHeight() / 2)
(self.width - self.background:getWidth()) / 2,
(self.height - self.background:getHeight()) / 2)

local n = 1

local x = (self.width - window.width)/2
local y = (self.height - window.height)/2

love.graphics.setColor(255, 255, 255)
local back = controls:getKey("START") .. ": BACK TO MENU"
local howto = controls:getKey("ATTACK") .. " OR " .. controls:getKey("JUMP") .. ": REASSIGN CONTROL"

love.graphics.print(back, 25, 25)
love.graphics.print(howto, 25, 55)
love.graphics.print(self.statusText, self.left_column, 280)
love.graphics.print(self.statusText, x + self.left_column, y + 280)
love.graphics.setColor( 0, 0, 0, 255 )

for i, button in ipairs(menu.options) do
local y = self.top + self.spacing * (i - 1)
local z = y + self.top + self.spacing * (i - 1)
local key = controls:getKey(button)
love.graphics.print(descriptions[button], self.left_column, y, 0, 0.5)
love.graphics.print(key, self.right_column, y, 0, 0.5)
love.graphics.print(descriptions[button], x + self.left_column, z, 0, 0.5)
love.graphics.print(key, x + self.right_column, z, 0, 0.5)
end

love.graphics.setColor( 255, 255, 255, 255 )
love.graphics.draw(self.arrow, 135, 87 + self.spacing * menu:selected())
love.graphics.draw(self.arrow, x + 135, y + 87 + self.spacing * menu:selected())
end

function state:remapKey(key)
Expand Down
Loading