diff options
author | Indrajith K L | 2022-03-01 20:43:10 +0530 |
---|---|---|
committer | Indrajith K L | 2022-03-01 20:43:10 +0530 |
commit | 67c80456895ed13f79999e6cb7162680d3e8909d (patch) | |
tree | ff3b48eb2ed7debe9d96a5a6234de7ed34b9e542 /core/map.lua | |
parent | 6227a1c681c0559add922a7e68cd634fcc85df41 (diff) | |
download | YEAD-67c80456895ed13f79999e6cb7162680d3e8909d.tar.gz YEAD-67c80456895ed13f79999e6cb7162680d3e8909d.tar.bz2 YEAD-67c80456895ed13f79999e6cb7162680d3e8909d.zip |
* Adds Fullscreen+Toggle Support
* Window Resolution changed to 1280x720
Diffstat (limited to 'core/map.lua')
-rw-r--r-- | core/map.lua | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/core/map.lua b/core/map.lua index 280057a..2bd0110 100644 --- a/core/map.lua +++ b/core/map.lua @@ -1,19 +1,20 @@ Class = require("libs.hump.class") Gamestate = require("libs.hump.gamestate") STI = require("libs.sti") -Moonshine = require("libs.moonshine") +local Moonshine = require("libs.moonshine") Camera = require("libs.hump.camera") Windfield = require("libs.windfield") require("libs.tserial") require("core.notifications") -local zoomFactor = 2 +local zoomFactor = 3 local player = { x=0, y=0, sprite=love.graphics.newImage("assets/images/player_demo.png"), speed=100 } +local fullscreen = true local windowWidth, windowHeight = love.graphics.getDimensions() local _w = windowWidth/zoomFactor @@ -29,10 +30,11 @@ Map = Class { .chain(Moonshine.effects.vignette) .chain(Moonshine.effects.scanlines) .chain(Moonshine.effects.chromasep) + effect.scanlines.thickness = .2 effect.scanlines.opacity = .5 effect.chromasep.angle = 1 - effect.chromasep.radius = 2 + effect.chromasep.radius = 3 notifications = Notifications(zoomFactor) camera = Camera() @@ -74,23 +76,22 @@ Map = Class { } function Map:update(dt) - local vx = 0 local vy = 0 - if love.keyboard.isDown("up") then + if love.keyboard.isDown("w") then vy = player.speed * -1 end - - if love.keyboard.isDown("down") then - vy = player.speed - end - - if love.keyboard.isDown("left") then + + if love.keyboard.isDown("a") then vx = player.speed * -1 end + + if love.keyboard.isDown("s") then + vy = player.speed + end - if love.keyboard.isDown("right") then + if love.keyboard.isDown("d") then vx = player.speed end @@ -149,9 +150,16 @@ function Map:draw() camera:detach() notifications:draw() end) + end function Map:keypressed(key, scancode) + if(scancode=="f4") then + fullscreen = not fullscreen + love.window.setFullscreen(fullscreen) + print("Fullscreen Toggle") + resize() + end end function drawMapLayer(layerName) @@ -160,4 +168,14 @@ function drawMapLayer(layerName) end end +function resize() + _width, _height = love.graphics.getDimensions() + if not(fullscreen) then + _width = 1280 + _height = 720 + end + effect.resize(_width,_height) + notifications.calculateWindowDimensions() +end + return Map
\ No newline at end of file |