Browse Source

Fixed Button things

tags/earlywindows
Madiwka3 3 years ago
parent
commit
f632735f6e
9 changed files with 28 additions and 7 deletions
  1. +9
    -1
      buttonClutter.lua
  2. +1
    -0
      levels/levelgeneral.lua
  3. +1
    -0
      levels/menu.lua
  4. +1
    -0
      levels/practice.lua
  5. +1
    -0
      levels/selectlv.lua
  6. +3
    -2
      main.lua
  7. +5
    -0
      src/GUI.lua
  8. +4
    -4
      src/fullScreener.lua
  9. +3
    -0
      stateMachine.lua

+ 9
- 1
buttonClutter.lua View File

@@ -8,8 +8,16 @@ function buttonClutter()
table.insert(buttons, menu:addButton("Levels",
function()
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
local t=0
function explode(x, y)


+ 1
- 0
levels/levelgeneral.lua View File

@@ -107,6 +107,7 @@ function levelgeneral.draw()
love.graphics.rectangle("fill",0, WINDOW_HEIGHT-50, firstShip.fuel/2, n)
love.graphics.setColor(1,1,1,1)
guimenu:butt(playbutts, WINDOW_WIDTH, WINDOW_HEIGHT, 1100, WINDOW_HEIGHT-50, 40, WINDOW_WIDTH/3)
love.keyboard.mouseisReleased = false
end
end


+ 1
- 0
levels/menu.lua View File

@@ -36,6 +36,7 @@ function menu.draw(dt)
love.graphics.setFont(titlefont)
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)
love.keyboard.mouseisReleased = false
end
end


+ 1
- 0
levels/practice.lua View File

@@ -83,6 +83,7 @@ function practice.draw()
GUIDraw("anywhere")
elseif gameStatus == "play" then
guimenu:butt(playbutts, WINDOW_WIDTH, WINDOW_HEIGHT, 1100, WINDOW_HEIGHT-50, 40, WINDOW_WIDTH/3)
love.keyboard.mouseisReleased = false
end


+ 1
- 0
levels/selectlv.lua View File

@@ -63,6 +63,7 @@ function selectlv.draw(dt)
planets[i]:draw(dt)
end
menu:butt(levels, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH/2, WINDOW_HEIGHT/2, 40, WINDOW_WIDTH/3, "beatenGreen")
love.keyboard.mouseisReleased = false
end

return selectlv

+ 3
- 2
main.lua View File

@@ -39,6 +39,7 @@ function love.load()
VCAM = VCAM(WINDOW_WIDTH/2, WINDOW_HEIGHT/2)
smallfont = love.graphics.newFont("font.ttf", 25)
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))
buttonClutter()
--planet2 = planet(1000, 300, 1000000000, 20)
@@ -46,7 +47,7 @@ end

function love.update(dt)
stateUpdate(dt)
love.window.setTitle("Nuclear Gravity")
end

function love.draw()
@@ -66,4 +67,4 @@ end
function objReset()
firstShip:reset()
planets = {}
end
end

+ 5
- 0
src/GUI.lua View File

@@ -30,6 +30,8 @@ function GUIDraw(mode)
--PLACING
local mx, my = love.mouse.getPosition()
local vmx, vmy = camera:getMousePosition()
local vmx = vmx * DIFFERENCE_X
local vmy = vmy * DIFFERENCE_Y
local mx = mx * DIFFERENCE_X
local my = my * DIFFERENCE_Y
if mode == "anywhere" then
@@ -197,6 +199,7 @@ function GUIDraw(mode)

--START BUTTON
guimenu:butt(guibutts, WINDOW_WIDTH, WINDOW_HEIGHT, menuX + 200, WINDOW_HEIGHT-100, 40, WINDOW_WIDTH/3.7)
love.keyboard.mouseisReleased = false
--START BUTTON
love.window.setTitle(selectedItem)
end
@@ -209,6 +212,8 @@ function GUIButton(num, shipImage, x, y, fn, sx, sy, color, r)

local mx, my = love.mouse.getPosition()
local vmx, vmy = camera:getMousePosition()
local vmx = vmx * DIFFERENCE_X
local vmy = vmy * DIFFERENCE_Y
local mx = mx * DIFFERENCE_X
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)


+ 4
- 4
src/fullScreener.lua View File

@@ -28,10 +28,10 @@ function fullScreener:toggle(vh, vw)
simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, {fullscreen = true})
local newWidth = love.graphics.getWidth()
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
end


+ 3
- 0
stateMachine.lua View File

@@ -3,6 +3,9 @@ print("levels/"..gameState)
function stateUpdate(dt)
state = require("levels/"..gameState)
state.update(dt)
if love.keyboard.isDown('escape') then
love.event.quit()
end
end




Loading…
Cancel
Save