2021-08-31 18:24:48 +02:00
|
|
|
|
2022-04-27 02:03:42 +02:00
|
|
|
local Dimensions = require 'common.dimensions'
|
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
local CONSOLE_W = 1352;
|
|
|
|
local CONSOLE_H = 712;
|
|
|
|
|
2022-07-19 18:02:11 +02:00
|
|
|
local function createConsoleImage(name)
|
|
|
|
return gfx.CreateSkinImage("gameplay/console/"..name..".png", 0)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function renderConsoleImage(image, alpha)
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
-CONSOLE_W/2,
|
|
|
|
-CONSOLE_H/2+350,
|
|
|
|
CONSOLE_W,
|
|
|
|
CONSOLE_H,
|
|
|
|
image,
|
|
|
|
alpha,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
end
|
|
|
|
|
|
|
|
local consoleBaseImage = createConsoleImage("base")
|
|
|
|
|
|
|
|
local buttonGlowImages = {
|
|
|
|
[0] = createConsoleImage("glow_bta"),
|
|
|
|
createConsoleImage("glow_btb"),
|
|
|
|
createConsoleImage("glow_btc"),
|
|
|
|
createConsoleImage("glow_btd"),
|
|
|
|
createConsoleImage("glow_fxl"),
|
|
|
|
createConsoleImage("glow_fxr"),
|
|
|
|
};
|
|
|
|
|
|
|
|
local knobGlowImages = {
|
|
|
|
[0] = createConsoleImage("glow_voll"),
|
|
|
|
createConsoleImage("glow_volr"),
|
|
|
|
};
|
|
|
|
|
|
|
|
local lastKnobState = {
|
|
|
|
[0] = -1,
|
|
|
|
-1
|
|
|
|
};
|
|
|
|
|
|
|
|
local doFlash = true;
|
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
local render = function (deltaTime, critLineCenterX, critLineCenterY, critLineRotation)
|
2021-11-25 18:49:50 +01:00
|
|
|
local resx, resy = game.GetResolution();
|
|
|
|
if (resx > resy) then
|
|
|
|
return
|
|
|
|
end
|
2022-04-27 02:03:42 +02:00
|
|
|
|
|
|
|
Dimensions.setUpTransforms(
|
2021-08-31 18:24:48 +02:00
|
|
|
critLineCenterX,
|
2021-10-28 17:27:26 +02:00
|
|
|
critLineCenterY,
|
2021-08-31 18:24:48 +02:00
|
|
|
critLineRotation
|
|
|
|
)
|
|
|
|
|
2022-07-19 18:02:11 +02:00
|
|
|
renderConsoleImage(consoleBaseImage, 1)
|
|
|
|
|
|
|
|
if doFlash then
|
|
|
|
for button=0,5 do
|
|
|
|
if game.GetButton(button) then
|
|
|
|
renderConsoleImage(buttonGlowImages[button], 0.75)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Knobs also work
|
|
|
|
-- commented out do to missing/incorrect textures
|
|
|
|
|
|
|
|
--[[
|
|
|
|
for knob=0,1 do
|
|
|
|
local state = game.GetKnob(knob)
|
|
|
|
|
|
|
|
if state ~= lastKnobState[knob] then
|
|
|
|
renderConsoleImage(knobGlowImages[knob], 1)
|
|
|
|
|
|
|
|
lastKnobState[knob] = state
|
|
|
|
end
|
|
|
|
end
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
doFlash = not doFlash;
|
2021-08-31 18:24:48 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
|
|
|
render=render
|
|
|
|
}
|