Browse Source

lowcpu notification

tags/earlygalaxy
Madiwka3 3 years ago
parent
commit
2671881800
2 changed files with 21 additions and 12 deletions
  1. +20
    -8
      main.lua
  2. +1
    -4
      mainMenu.lua

+ 20
- 8
main.lua View File

@@ -1,4 +1,5 @@
--CALLING OTHER LUA FILES

require "src/dependencies"
io.stdout:setvbuf("no")
--CANCELLED ATTEMPETED SHADING (NOT WORKING)
@@ -15,7 +16,7 @@ doubleclick1 = false
doubleclick2 = false
hold1 = false
hold2 = false
debug = false
debug = true
paused = false
androidButtons = {}
pauseButtons = {}
@@ -25,6 +26,9 @@ showTouchControls = false


--0.9 VARIABLES
globalMessage = "none"
globalAnimation = "none"
globalMessageTime = 0
isButtonAnimated = false
lowcpu = false
wallsLoadError = false
@@ -1025,11 +1029,18 @@ function love.update(dt)
--checking = checking + 1
--print(checking)
--print("IMPORTANT!!!!!" .. globalState .. gameState)
if globalMessage ~= "none" then
globalMessageTime = globalMessageTime + dt
if globalMessageTime > 10 then
globalMessage = "none"
end
end
if not lowcpu then
if (love.timer.getFPS() < 50 and gameState ~= "animation") then
countinglowcpu = countinglowcpu + 1
if countinglowcpu > 10 then
if countinglowcpu > 30 then
lowcpu = true
globalMessage = "[color=#00ff00][bounce]Low-end mode enabled[/bounce][/color]"
end
end
end
@@ -1059,7 +1070,6 @@ function love.update(dt)
musicController('norm', 1)
end
if globalState == "nettest" then
--print("Confcode: " .. confirmation)
if confirmation == "N" then
@@ -1867,13 +1877,9 @@ function love.draw(dt)
for i, touch in ipairs(touches) do
love.graphics.printf(touch.x, 0, VIRTUAL_HEIGHT / 2, VIRTUAL_WIDTH, "center")
end
if doubleclick1 then
TEXT = "DOUBLECLICK1"
elseif doubleclick2 then TEXT = "DOUBLECLICK2"
else TEXT = "NO"
end
end
end
showMessage()
if wallsLoadError then
love.graphics.setColor(1,0,0,1)
love.graphics.printf("Error loading map!", 0,0,VIRTUAL_WIDTH, "left")
@@ -2500,7 +2506,13 @@ end
end
return false
end
function showMessage()
print (globalMessage)
if globalMessage ~= "none" then
love.graphics.printf("Low CPU mode active", 0, VIRTUAL_WIDTH/2, VIRTUAL_HEIGHT/2, "center")
end

end
function resetButtonX(arr)
for i, buttons in ipairs(arr) do
buttons.x = 1300


+ 1
- 4
mainMenu.lua View File

@@ -1,7 +1,7 @@
mainMenu = Class{}
function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds, location)
if (gameState == 'editor')
then
then
ev_button_width = VIRTUAL_WIDTH * (1/72)
ev_BUTTON_HEIGHT = VIRTUAL_WIDTH * (1/72)
local margin = 16
@@ -89,9 +89,6 @@ function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds
ev_bx = (VIRTUAL_WIDTH*0.5) - (ev_button_width * 0.5)
ev_by = locationy - (total_height * 0.5) + cursor_y
end
elseif button.text == 'NUCLEAR MODE' and easternum < 11 then
ev_bx = -400
ev_by = -400
elseif button.x > locationx - (ev_button_width * 0.5) then
--print("moving from" .. button.x)
if lowcpu then


Loading…
Cancel
Save