| @@ -8,8 +8,16 @@ function buttonClutter() | |||||
| table.insert(buttons, menu:addButton("Levels", | table.insert(buttons, menu:addButton("Levels", | ||||
| function() | function() | ||||
| gameState = "selectlv" | gameState = "selectlv" | ||||
| end)) | |||||
| --[[table.insert(buttons, menu:addButton("Toggle Fullscreen", | |||||
| function() | |||||
| myscreen:toggle(WINDOW_HEIGHT, WINDOW_WIDTH) | |||||
| DIFFERENCE_X = myscreen.c | |||||
| DIFFERENCE_Y = myscreen.d | |||||
| OFFSET_X = myscreen.e | |||||
| OFFSET_Y = myscreen.f | |||||
| end | end | ||||
| )) | |||||
| ))]]-- | |||||
| end | end | ||||
| local t=0 | local t=0 | ||||
| function explode(x, y) | function explode(x, y) | ||||
| @@ -107,6 +107,7 @@ function levelgeneral.draw() | |||||
| love.graphics.rectangle("fill",0, WINDOW_HEIGHT-50, firstShip.fuel/2, n) | love.graphics.rectangle("fill",0, WINDOW_HEIGHT-50, firstShip.fuel/2, n) | ||||
| love.graphics.setColor(1,1,1,1) | love.graphics.setColor(1,1,1,1) | ||||
| guimenu:butt(playbutts, WINDOW_WIDTH, WINDOW_HEIGHT, 1100, WINDOW_HEIGHT-50, 40, WINDOW_WIDTH/3) | guimenu:butt(playbutts, WINDOW_WIDTH, WINDOW_HEIGHT, 1100, WINDOW_HEIGHT-50, 40, WINDOW_WIDTH/3) | ||||
| love.keyboard.mouseisReleased = false | |||||
| end | end | ||||
| end | end | ||||
| @@ -36,6 +36,7 @@ function menu.draw(dt) | |||||
| love.graphics.setFont(titlefont) | love.graphics.setFont(titlefont) | ||||
| love.graphics.printf("NuclearGravity", 0, 20, WINDOW_WIDTH, "center") | love.graphics.printf("NuclearGravity", 0, 20, WINDOW_WIDTH, "center") | ||||
| menu:butt(buttons, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH/2, WINDOW_HEIGHT/2, 40, WINDOW_WIDTH/3) | menu:butt(buttons, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH/2, WINDOW_HEIGHT/2, 40, WINDOW_WIDTH/3) | ||||
| love.keyboard.mouseisReleased = false | |||||
| end | end | ||||
| end | end | ||||
| @@ -83,6 +83,7 @@ function practice.draw() | |||||
| GUIDraw("anywhere") | GUIDraw("anywhere") | ||||
| elseif gameStatus == "play" then | elseif gameStatus == "play" then | ||||
| guimenu:butt(playbutts, WINDOW_WIDTH, WINDOW_HEIGHT, 1100, WINDOW_HEIGHT-50, 40, WINDOW_WIDTH/3) | guimenu:butt(playbutts, WINDOW_WIDTH, WINDOW_HEIGHT, 1100, WINDOW_HEIGHT-50, 40, WINDOW_WIDTH/3) | ||||
| love.keyboard.mouseisReleased = false | |||||
| end | end | ||||
| @@ -63,6 +63,7 @@ function selectlv.draw(dt) | |||||
| planets[i]:draw(dt) | planets[i]:draw(dt) | ||||
| end | end | ||||
| menu:butt(levels, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH/2, WINDOW_HEIGHT/2, 40, WINDOW_WIDTH/3, "beatenGreen") | menu:butt(levels, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH/2, WINDOW_HEIGHT/2, 40, WINDOW_WIDTH/3, "beatenGreen") | ||||
| love.keyboard.mouseisReleased = false | |||||
| end | end | ||||
| return selectlv | return selectlv | ||||
| @@ -39,6 +39,7 @@ function love.load() | |||||
| VCAM = VCAM(WINDOW_WIDTH/2, WINDOW_HEIGHT/2) | VCAM = VCAM(WINDOW_WIDTH/2, WINDOW_HEIGHT/2) | ||||
| smallfont = love.graphics.newFont("font.ttf", 25) | smallfont = love.graphics.newFont("font.ttf", 25) | ||||
| titlefont = love.graphics.newFont("font.ttf", 50) | titlefont = love.graphics.newFont("font.ttf", 50) | ||||
| myscreen = fullScreener(RESOLUTION_SET, isFullscreen, DIFFERENCE_X, DIFFERENCE_Y, OFFSET_X, OFFSET_Y) | |||||
| --table.insert(planets, planet(100, WINDOW_HEIGHT/2-100, 1010000000, 1)) | --table.insert(planets, planet(100, WINDOW_HEIGHT/2-100, 1010000000, 1)) | ||||
| buttonClutter() | buttonClutter() | ||||
| --planet2 = planet(1000, 300, 1000000000, 20) | --planet2 = planet(1000, 300, 1000000000, 20) | ||||
| @@ -46,7 +47,7 @@ end | |||||
| function love.update(dt) | function love.update(dt) | ||||
| stateUpdate(dt) | stateUpdate(dt) | ||||
| love.window.setTitle("Nuclear Gravity") | |||||
| end | end | ||||
| function love.draw() | function love.draw() | ||||
| @@ -66,4 +67,4 @@ end | |||||
| function objReset() | function objReset() | ||||
| firstShip:reset() | firstShip:reset() | ||||
| planets = {} | planets = {} | ||||
| end | |||||
| end | |||||
| @@ -30,6 +30,8 @@ function GUIDraw(mode) | |||||
| --PLACING | --PLACING | ||||
| local mx, my = love.mouse.getPosition() | local mx, my = love.mouse.getPosition() | ||||
| local vmx, vmy = camera:getMousePosition() | local vmx, vmy = camera:getMousePosition() | ||||
| local vmx = vmx * DIFFERENCE_X | |||||
| local vmy = vmy * DIFFERENCE_Y | |||||
| local mx = mx * DIFFERENCE_X | local mx = mx * DIFFERENCE_X | ||||
| local my = my * DIFFERENCE_Y | local my = my * DIFFERENCE_Y | ||||
| if mode == "anywhere" then | if mode == "anywhere" then | ||||
| @@ -197,6 +199,7 @@ function GUIDraw(mode) | |||||
| --START BUTTON | --START BUTTON | ||||
| guimenu:butt(guibutts, WINDOW_WIDTH, WINDOW_HEIGHT, menuX + 200, WINDOW_HEIGHT-100, 40, WINDOW_WIDTH/3.7) | guimenu:butt(guibutts, WINDOW_WIDTH, WINDOW_HEIGHT, menuX + 200, WINDOW_HEIGHT-100, 40, WINDOW_WIDTH/3.7) | ||||
| love.keyboard.mouseisReleased = false | |||||
| --START BUTTON | --START BUTTON | ||||
| love.window.setTitle(selectedItem) | love.window.setTitle(selectedItem) | ||||
| end | end | ||||
| @@ -209,6 +212,8 @@ function GUIButton(num, shipImage, x, y, fn, sx, sy, color, r) | |||||
| local mx, my = love.mouse.getPosition() | local mx, my = love.mouse.getPosition() | ||||
| local vmx, vmy = camera:getMousePosition() | local vmx, vmy = camera:getMousePosition() | ||||
| local vmx = vmx * DIFFERENCE_X | |||||
| local vmy = vmy * DIFFERENCE_Y | |||||
| local mx = mx * DIFFERENCE_X | local mx = mx * DIFFERENCE_X | ||||
| local my = my * DIFFERENCE_Y | local my = my * DIFFERENCE_Y | ||||
| local hot = (mx > x-shipW/2*sx and mx < x-shipW/2*sx + shipW*sx and my > y-shipH/2*sy and my < y -shipH/2*sy + shipH*sy) | local hot = (mx > x-shipW/2*sx and mx < x-shipW/2*sx + shipW*sx and my > y-shipH/2*sy and my < y -shipH/2*sy + shipH*sy) | ||||
| @@ -28,10 +28,10 @@ function fullScreener:toggle(vh, vw) | |||||
| simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, {fullscreen = true}) | simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, {fullscreen = true}) | ||||
| local newWidth = love.graphics.getWidth() | local newWidth = love.graphics.getWidth() | ||||
| local newHeight = love.graphics.getHeight() | local newHeight = love.graphics.getHeight() | ||||
| self.c = VIRTUAL_WIDTH / newWidth | |||||
| self.d = VIRTUAL_HEIGHT / newHeight | |||||
| self.e = math.fmod(newWidth * self.d, VIRTUAL_WIDTH) / 2 | |||||
| self.f = math.fmod(newHeight * self.d, VIRTUAL_HEIGHT) / 2 | |||||
| self.c = WINDOW_WIDTH / newWidth | |||||
| self.d = WINDOW_HEIGHT / newHeight | |||||
| self.e = math.fmod(newWidth * self.d, WINDOW_WIDTH) / 2 | |||||
| self.f = math.fmod(newHeight * self.d, WINDOW_HEIGHT) / 2 | |||||
| self.b = 1 | self.b = 1 | ||||
| end | end | ||||
| @@ -3,6 +3,9 @@ print("levels/"..gameState) | |||||
| function stateUpdate(dt) | function stateUpdate(dt) | ||||
| state = require("levels/"..gameState) | state = require("levels/"..gameState) | ||||
| state.update(dt) | state.update(dt) | ||||
| if love.keyboard.isDown('escape') then | |||||
| love.event.quit() | |||||
| end | |||||
| end | end | ||||