start = 600
k = 0.4
args.state.game_history.reverse.each_with_index do |element, i|
y = 130 - 25 * i
ui_render << {
x: 830, y: y, text: "#{status[element.type]} at #{ticks_to_time(element.time * k, start)}"
}
end
. . .
def ticks_to_time(ticks, start = 0)
time = (ticks + start) % 1440
meridian = "PM"
if time < 720
meridian = "AM"
end
hour = (((time / 60).floor - 1) % 12 + 1).to_s
minute = (time % 60).floor
if minute < 10
minute = "0#{minute}"
else
minute = minute.to_s
end
second = ((time % 1) * 60).floor
if second < 10
second = "0#{second}"
else
second = second.to_s
end
return "#{hour}:#{minute}:#{second} #{meridian}"
end
where "time" or "ticks" is "frames since the start of the game" at 60fps
Which is to say, the game starts at 10:00AM, ends at 6:00PM, and each frame is 24 seconds (every second is 24 minutes)
and controllers SHOULD have sensitivity-based input...? I'm using DR's input helpers "left_right" and "up_down", which MAY snap to the nearest integer instead of taking the analog input of a controller stick into account. I'll see if I can't cook something up, perhaps checking controller input if there is no keyboard input.