From 3d52856cf207b0fcf1015079bfa691881c5636c4 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Sun, 9 Jul 2017 19:51:07 -0400 Subject: [PATCH] Reorganize the gui --- main.lua | 2 +- menu.lua | 48 +++++++++++++++++++++++++----------------------- player.lua | 2 +- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/main.lua b/main.lua index f750c7c..b0a7226 100644 --- a/main.lua +++ b/main.lua @@ -52,7 +52,7 @@ function love.load() playertexture = love.graphics.newImage("textures/player.png") - menu_music:play() + --menu_music:play() end function love.quit( ) diff --git a/menu.lua b/menu.lua index ea3a3e1..7132274 100644 --- a/menu.lua +++ b/menu.lua @@ -4,10 +4,10 @@ menu = {} mx,my = 1,1 menutitle = {} -menutitle.g = 50 -menutitle.a = 50 -menutitle.m = 50 -menutitle.e = 50 +menutitle.g = 35 +menutitle.a = 35 +menutitle.m = 35 +menutitle.e = 35 menutimer = 0 pause = false @@ -55,47 +55,49 @@ selected_chunkx,selected_chunky = 0,0 function menu.draw() menu.cursor() - - love.graphics.setFont(fontbig) - love.graphics.setColor(255,0,0,255) - love.graphics.print("D", 400, menutitle.g) - love.graphics.print("I", 440, menutitle.a) - love.graphics.print("G", 480, menutitle.m) - love.graphics.print("!", 520, menutitle.e) - + --redo this as a table + --love.graphics.setFont(fontbig) + --love.graphics.setColor(255,0,0,255) + --love.graphics.print("D", 400, menutitle.g) + --love.graphics.print("I", 440, menutitle.a) + --love.graphics.print("G", 480, menutitle.m) + --love.graphics.print("!", 520, menutitle.e) + local xxer = 600 --score debug - love.graphics.setFont(fontmed) + love.graphics.setFont(font) love.graphics.setColor(255,255,255,255) - love.graphics.print("Score:"..tostring(score), 400,110) + love.graphics.print("Score:"..tostring(score),xxer,12) --debug mining if player.mining == true then love.graphics.setColor(255,0,0,255) - love.graphics.print("Mining", 400,180) + love.graphics.print("Mining", xxer,24) love.graphics.setColor(128,128,128,255) - love.graphics.print("Placing", 560,180) + love.graphics.print("Placing", xxer+80,24) elseif player.mining == false then love.graphics.setColor(128,128,128,255) - love.graphics.print("Mining", 400,180) + love.graphics.print("Mining", xxer,24) love.graphics.setColor(255,0,0,255) - love.graphics.print("Placing", 560,180)love.graphics.print("PosX:"..player.playerx.." PosY:"..player.playery, 400,150) + love.graphics.print("Placing", xxer+80,24) + + --love.graphics.print("PosX:"..player.playerx.." PosY:"..player.playery, 400,150) end --debug player's pos love.graphics.setColor(255,255,255,255) love.graphics.print("PosX:"..(player.playerx+(chunkx*map_max)).." PosY:"..((map_max-player.playery)+(chunky*map_max)), 0,20) --debug mouse's pos love.graphics.setColor(255,255,255,255) - love.graphics.print("MX:"..mx.." MY:"..my, 400,220) + love.graphics.print("MX:"..mx.." MY:"..my, xxer,36) --debug selected item love.graphics.setColor(255,255,255,255) - love.graphics.print("ITEM:", 400,250) love.graphics.draw(texture_table[player.selected],515,242,0,1.75,1.75) + love.graphics.print("ITEM:", xxer,48) love.graphics.draw(texture_table[player.selected],xxer+60,45,0,0.8,0.8) - love.graphics.print("Chunkx:"..chunkx, 400,280) - love.graphics.print("Chunky:"..chunky, 400,320) + love.graphics.print("Chunkx:"..chunkx, xxer,60) + love.graphics.print("Chunky:"..chunky, xxer,72) - love.graphics.print("Current FPS:"..tostring(love.timer.getFPS( )), 400, 360) + love.graphics.print("Current FPS:"..tostring(love.timer.getFPS( )), xxer, 84) end function menu.cursor() diff --git a/player.lua b/player.lua index 57c1d38..3deda61 100644 --- a/player.lua +++ b/player.lua @@ -174,7 +174,7 @@ player_drawnx,player_drawny = 0,0 function player.draw() love.graphics.setFont(font) --love.graphics.setColor(255,0,0,255) - player_drawnx,player_drawny = ((scale*map_max)/2)+offsetx,((scale*map_max)/2)+offsety + player_drawnx,player_drawny = screenwidth/2-(scale/32),screenheight/2-(scale/32)--((scale*map_max)/2)+offsetx,((scale*map_max)/2)+offsety --love.graphics.print("8", player_drawnx,player_drawny ) love.graphics.draw(playertexture, player_drawnx+(scale/4), player_drawny-4,0, scale/32, scale/32) end