this
This commit is contained in:
parent
76477b5cf3
commit
7de41e16e1
|
@ -3,6 +3,9 @@ json = require "json"
|
||||||
local common = require('common.common');
|
local common = require('common.common');
|
||||||
local difbar = require("components.diff_rectangle");
|
local difbar = require("components.diff_rectangle");
|
||||||
local Background = require('components.background');
|
local Background = require('components.background');
|
||||||
|
local Dim = require("common.dimensions")
|
||||||
|
local Wallpaper = require("components.wallpaper")
|
||||||
|
|
||||||
local msg = game.GetSkinSetting("MSG");
|
local msg = game.GetSkinSetting("MSG");
|
||||||
local normname = game.GetSkinSetting("username")
|
local normname = game.GetSkinSetting("username")
|
||||||
|
|
||||||
|
@ -95,26 +98,6 @@ local missing_song = false;
|
||||||
local placeholderJacket = gfx.CreateSkinImage("song_select/loading.png", 0)
|
local placeholderJacket = gfx.CreateSkinImage("song_select/loading.png", 0)
|
||||||
local did_exit = false;
|
local did_exit = false;
|
||||||
|
|
||||||
-- Window variables
|
|
||||||
local resX, resY
|
|
||||||
|
|
||||||
-- Aspect Ratios
|
|
||||||
local landscapeWidescreenRatio = 16 / 9
|
|
||||||
local landscapeStandardRatio = 4 / 3
|
|
||||||
local portraitWidescreenRatio = 9 / 16
|
|
||||||
|
|
||||||
-- Portrait sizes
|
|
||||||
local fullX, fullY
|
|
||||||
local desw = 1080
|
|
||||||
local desh = 1920
|
|
||||||
|
|
||||||
local function resolutionChange(x, y)
|
|
||||||
resX = x
|
|
||||||
resY = y
|
|
||||||
fullX = portraitWidescreenRatio * y
|
|
||||||
fullY = y
|
|
||||||
end
|
|
||||||
|
|
||||||
local irHeartbeatRequested = false;
|
local irHeartbeatRequested = false;
|
||||||
local irText = ''
|
local irText = ''
|
||||||
|
|
||||||
|
@ -169,22 +152,17 @@ local drawIdol = function(deltaTime)
|
||||||
idolAnimTransitionScale = 1;
|
idolAnimTransitionScale = 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
gfx.ImageRect(0, 0, resX,resY, idolAnimation, 1, 0);
|
gfx.ImageRect(0, 0, resx,resy, idolAnimation, 1, 0);
|
||||||
gfx.GlobalAlpha(1);
|
gfx.GlobalAlpha(1);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
songjacket = function() -- self explanatory -- done
|
songjacket = function() -- self explanatory -- done
|
||||||
|
|
||||||
local resx, resy = game.GetResolution()
|
|
||||||
if resx ~= resX or resy ~= resY then
|
|
||||||
resolutionChange(resx, resy)
|
|
||||||
end
|
|
||||||
|
|
||||||
local jw , jh = gfx.ImageSize(m_jacket);
|
local jw , jh = gfx.ImageSize(m_jacket);
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
-- gfx.ImageRect(jacketPanelX, jacketPanelY, jw/1.18, jh/1.18, m_jacket,1,0);
|
gfx.ImageRect(jacketPanelX, jacketPanelY, jw/1.18, jh/1.18, m_jacket,1,0);
|
||||||
gfx.ImageRect(resX, resY, jw/1.18, jh/1.18, m_jacket,1,0);
|
|
||||||
|
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.ImageRect(jacketPanelX+12, jacketPanelY+19,jw/1.269,jh/1.35,jacket,1,0)
|
gfx.ImageRect(jacketPanelX+12, jacketPanelY+19,jw/1.269,jh/1.35,jacket,1,0)
|
||||||
|
@ -459,7 +437,7 @@ mouse_clipped = function(x,y,w,h)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
draw_room = function(name, x, y, selected, hoverindex)
|
draw_room = function(name, x, y, selected, hoverindex)
|
||||||
local buttonWidth = resX*(3/4);
|
local buttonWidth = resx*(3/4);
|
||||||
local rx = x - (buttonWidth / 2);
|
local rx = x - (buttonWidth / 2);
|
||||||
local ty = y - (buttonHeight / 2);
|
local ty = y - (buttonHeight / 2);
|
||||||
local roomButtonBorder = buttonBorder;
|
local roomButtonBorder = buttonBorder;
|
||||||
|
@ -584,17 +562,17 @@ function render_loading()
|
||||||
gfx.Save()
|
gfx.Save()
|
||||||
gfx.ResetTransform()
|
gfx.ResetTransform()
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.MoveTo(resX, resY)
|
gfx.MoveTo(resx, resy)
|
||||||
gfx.LineTo(resX - 350, resY)
|
gfx.LineTo(resx - 350, resy)
|
||||||
gfx.LineTo(resX - 300, resY - 50)
|
gfx.LineTo(resx - 300, resy - 50)
|
||||||
gfx.LineTo(resX, resY - 50)
|
gfx.LineTo(resx, resy - 50)
|
||||||
gfx.ClosePath()
|
gfx.ClosePath()
|
||||||
gfx.FillColor(33,33,33)
|
gfx.FillColor(33,33,33)
|
||||||
gfx.Fill()
|
gfx.Fill()
|
||||||
gfx.FillColor(255,255,255)
|
gfx.FillColor(255,255,255)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT, gfx.TEXT_ALIGN_BOTTOM)
|
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT, gfx.TEXT_ALIGN_BOTTOM)
|
||||||
gfx.FontSize(70)
|
gfx.FontSize(70)
|
||||||
gfx.Text("LOADING...", resX - 20, resY - 3)
|
gfx.Text("LOADING...", resx - 20, resy - 3)
|
||||||
gfx.Restore()
|
gfx.Restore()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -696,7 +674,7 @@ function draw_rooms(y, h)
|
||||||
if room.password then
|
if room.password then
|
||||||
status = status..' <P>'
|
status = status..' <P>'
|
||||||
end
|
end
|
||||||
draw_room(room.name .. ': '.. status, resX / 2, ypos, i == selected_room_index, function()
|
draw_room(room.name .. ': '.. status, resx / 2, ypos, i == selected_room_index, function()
|
||||||
join_room(room)
|
join_room(room)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
@ -710,7 +688,7 @@ change_selected_room = function(off)
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
local h = resY - 290;
|
local h = resy - 290;
|
||||||
|
|
||||||
local num_rooms_visible = math.floor(h / (buttonHeight + 10))
|
local num_rooms_visible = math.floor(h / (buttonHeight + 10))
|
||||||
|
|
||||||
|
@ -745,18 +723,13 @@ end
|
||||||
|
|
||||||
function render_lobby(deltaTime)
|
function render_lobby(deltaTime)
|
||||||
|
|
||||||
local resx, resy = game.GetResolution()
|
|
||||||
if resx ~= resX or resy ~= resY then
|
|
||||||
resolutionChange(resx, resy)
|
|
||||||
end
|
|
||||||
|
|
||||||
local jw , jh = gfx.ImageSize(bg);
|
local jw , jh = gfx.ImageSize(bg);
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(0, 0, resX, resY, bg,1,0);
|
gfx.ImageRect(0, 0, resx, resy, bg,1,0);
|
||||||
drawIdol(deltaTime)
|
drawIdol(deltaTime)
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(0, 0, resX, resY, bg_graid1,1,0);
|
gfx.ImageRect(0, 0, resx, resy, bg_graid1,1,0);
|
||||||
gfx.ImageRect(0, 0, resX, resY, bg_graid2,1,0);
|
gfx.ImageRect(0, 0, resx, resy, bg_graid2,1,0);
|
||||||
drawHeader()
|
drawHeader()
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
m_base_part()
|
m_base_part()
|
||||||
|
@ -788,29 +761,29 @@ end
|
||||||
|
|
||||||
function render_room_list(deltaTime)
|
function render_room_list(deltaTime)
|
||||||
|
|
||||||
draw_rooms(175, resY - 290);
|
draw_rooms(175, resy - 290);
|
||||||
|
|
||||||
-- Draw cover for rooms out of view
|
-- Draw cover for rooms out of view
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.FillColor(20, 20, 20)
|
gfx.FillColor(20, 20, 20)
|
||||||
gfx.Rect(0, 0, resX, 145)
|
gfx.Rect(0, 0, resx, 145)
|
||||||
gfx.Rect(0, resY-170, resX, 170)
|
gfx.Rect(0, resy-170, resx, 170)
|
||||||
gfx.Fill()
|
gfx.Fill()
|
||||||
|
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.FillColor(60, 60, 60)
|
gfx.FillColor(60, 60, 60)
|
||||||
gfx.Rect(0, 145, resX, 2)
|
gfx.Rect(0, 145, resx, 2)
|
||||||
gfx.Rect(0, resY-170-2, resX, 2)
|
gfx.Rect(0, resy-170-2, resx, 2)
|
||||||
gfx.Fill()
|
gfx.Fill()
|
||||||
|
|
||||||
gfx.FillColor(255,255,255)
|
gfx.FillColor(255,255,255)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
|
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
|
||||||
gfx.FontSize(70)
|
gfx.FontSize(70)
|
||||||
gfx.Text("Multiplayer Rooms", resX/2, 100)
|
gfx.Text("Multiplayer Rooms", resx/2, 100)
|
||||||
|
|
||||||
|
|
||||||
if not loading then
|
if not loading then
|
||||||
draw_button("Create new room", resX/2, resY-40-buttonHeight, resX*(3/4), new_room);
|
draw_button("Create new room", resx/2, resy-40-buttonHeight, resx*(3/4), new_room);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -820,40 +793,40 @@ function render_password_screen(deltaTime)
|
||||||
gfx.FillColor(255,255,255)
|
gfx.FillColor(255,255,255)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
|
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
|
||||||
gfx.FontSize(70)
|
gfx.FontSize(70)
|
||||||
gfx.Text("Joining "..selected_room.name.."...", resX/2, resY/4)
|
gfx.Text("Joining "..selected_room.name.."...", resx/2, resy/4)
|
||||||
|
|
||||||
gfx.FillColor(50,50,50)
|
gfx.FillColor(50,50,50)
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.Rect(0, resY/2-10, resX, 40)
|
gfx.Rect(0, resy/2-10, resx, 40)
|
||||||
gfx.Fill();
|
gfx.Fill();
|
||||||
|
|
||||||
gfx.FillColor(255,255,255)
|
gfx.FillColor(255,255,255)
|
||||||
gfx.Text("Please enter room password:", resX/2, resY/2-40)
|
gfx.Text("Please enter room password:", resx/2, resy/2-40)
|
||||||
gfx.Text(string.rep("*",#textInput.text), resX/2, resY/2+40)
|
gfx.Text(string.rep("*",#textInput.text), resx/2, resy/2+40)
|
||||||
if passwordError then
|
if passwordError then
|
||||||
|
|
||||||
gfx.FillColor(255,50,50)
|
gfx.FillColor(255,50,50)
|
||||||
gfx.FontSize(60 + math.floor(passwordErrorOffset*20))
|
gfx.FontSize(60 + math.floor(passwordErrorOffset*20))
|
||||||
gfx.Text("Invalid password", resX/2, resY/2+80)
|
gfx.Text("Invalid password", resx/2, resy/2+80)
|
||||||
end
|
end
|
||||||
draw_button("Join", resX/2, resY*3/4, resX/2, mpScreen.JoinWithPassword);
|
draw_button("Join", resx/2, resy*3/4, resx/2, mpScreen.JoinWithPassword);
|
||||||
end
|
end
|
||||||
|
|
||||||
function render_new_room_password(delta_time)
|
function render_new_room_password(delta_time)
|
||||||
gfx.FillColor(255,255,255)
|
gfx.FillColor(255,255,255)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
|
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
|
||||||
gfx.FontSize(70)
|
gfx.FontSize(70)
|
||||||
gfx.Text("Create New Room", resX/2, resY/4)
|
gfx.Text("Create New Room", resx/2, resy/4)
|
||||||
|
|
||||||
gfx.FillColor(50,50,50)
|
gfx.FillColor(50,50,50)
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.Rect(0, resY/2-10, resX, 40)
|
gfx.Rect(0, resy/2-10, resx, 40)
|
||||||
gfx.Fill();
|
gfx.Fill();
|
||||||
|
|
||||||
gfx.FillColor(255,255,255)
|
gfx.FillColor(255,255,255)
|
||||||
gfx.Text("Enter room password:", resX/2, resY/2-40)
|
gfx.Text("Enter room password:", resx/2, resy/2-40)
|
||||||
gfx.Text(string.rep("*",#textInput.text), resX/2, resY/2+40)
|
gfx.Text(string.rep("*",#textInput.text), resx/2, resy/2+40)
|
||||||
draw_button("Create Room", resX/2, resY*3/4, resX/2, mpScreen.NewRoomStep);
|
draw_button("Create Room", resx/2, resy*3/4, resx/2, mpScreen.NewRoomStep);
|
||||||
end
|
end
|
||||||
--here
|
--here
|
||||||
function render_new_room_name(deltaTime)
|
function render_new_room_name(deltaTime)
|
||||||
|
@ -862,31 +835,31 @@ function render_new_room_name(deltaTime)
|
||||||
gfx.FillColor(255,255,255)
|
gfx.FillColor(255,255,255)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
|
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
|
||||||
gfx.FontSize(70)
|
gfx.FontSize(70)
|
||||||
gfx.Text("Create New Room", resX/2, resY/4)
|
gfx.Text("Create New Room", resx/2, resy/4)
|
||||||
|
|
||||||
gfx.Rect(0, resY/2-10, resX, 60)
|
gfx.Rect(0, resy/2-10, resx, 60)
|
||||||
|
|
||||||
|
|
||||||
gfx.Text("Please enter room name:", resX/2, resY/2-40)
|
gfx.Text("Please enter room name:", resx/2, resy/2-40)
|
||||||
gfx.Text(textInput.text, resX/2, resY/2+40)
|
gfx.Text(textInput.text, resx/2, resy/2+40)
|
||||||
draw_button("Next", resX/2, resY*3/4, resX/2, mpScreen.NewRoomStep);
|
draw_button("Next", resx/2, resy*3/4, resx/2, mpScreen.NewRoomStep);
|
||||||
end
|
end
|
||||||
|
|
||||||
function render_set_username(deltaTime)
|
function render_set_username(deltaTime)
|
||||||
gfx.FillColor(255,255,255)
|
gfx.FillColor(255,255,255)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
|
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER, gfx.TEXT_ALIGN_BOTTOM)
|
||||||
gfx.FontSize(70)
|
gfx.FontSize(70)
|
||||||
gfx.Text("First things first...", resX/2, resY/4)
|
gfx.Text("First things first...", resx/2, resy/4)
|
||||||
|
|
||||||
gfx.FillColor(50,50,50)
|
gfx.FillColor(50,50,50)
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.Rect(0, resY/2-10, resX, 60)
|
gfx.Rect(0, resy/2-10, resx, 60)
|
||||||
gfx.Fill();
|
gfx.Fill();
|
||||||
|
|
||||||
gfx.FillColor(255,255,255)
|
gfx.FillColor(255,255,255)
|
||||||
gfx.Text("Enter a display name:", resX/2, resY/2-40)
|
gfx.Text("Enter a display name:", resx/2, resy/2-40)
|
||||||
gfx.Text(textInput.text, resX/2, resY/2+40)
|
gfx.Text(textInput.text, resx/2, resy/2+40)
|
||||||
draw_button("Join Multiplayer", resX/2, resY*3/4, resX/2, function()
|
draw_button("Join Multiplayer", resx/2, resy*3/4, resx/2, function()
|
||||||
loading = true;
|
loading = true;
|
||||||
mpScreen.SaveUsername()
|
mpScreen.SaveUsername()
|
||||||
end);
|
end);
|
||||||
|
@ -894,14 +867,14 @@ function render_set_username(deltaTime)
|
||||||
end
|
end
|
||||||
|
|
||||||
render = function(deltaTime)
|
render = function(deltaTime)
|
||||||
local resx, resy = game.GetResolution()
|
|
||||||
if resx ~= resX or resy ~= resY then
|
|
||||||
resolutionChange(resx, resy)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
buttonWidth = resX*(3/4);
|
Dim.updateResolution()
|
||||||
|
game.Log(Dim.view.width,game.LOGGER_ERROR)
|
||||||
|
Wallpaper.render()
|
||||||
|
|
||||||
|
Dim.transformToDesignSpace()
|
||||||
|
|
||||||
|
buttonWidth = resx*(3/4);
|
||||||
mposx,mposy = game.GetMousePos();
|
mposx,mposy = game.GetMousePos();
|
||||||
|
|
||||||
common.stopMusic();
|
common.stopMusic();
|
||||||
|
|
Loading…
Reference in New Issue