All pastes #43184 Raw Edit

Mine

public text v1 · immutable
#43184 ·published 2006-02-26 03:45 UTC
rendered paste body
class Scene_Map
  alias clock_main main
  alias clock_update update
  def main
    @clock_window = Window_Clock.new
    clock_main
    @clock_window.dispose
  end
  def update
    @clock_window.update
    clock_update
  end
end

class Window_Clock < Window_Base
  def initialize
    super(640 - 180, 480 - 68, 180, 68)
    self.opacity = 160
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.size = 16
    @last_seconds = nil
  end
  def update
    t = Time.now
    if t.sec != @last_seconds
      self.contents.clear
      time = t.strftime("%I:%M%p")
      date = t.strftime("%A, %B %d")
      tw = contents.text_size(time).width
      th = contents.text_size(time).height
      dw = contents.text_size(date).width
      dh = contents.text_size(date).height
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, tw, th, time, 2)
      self.contents.draw_text(4, th + 4, dw, dh, date, 2)
      @last_seconds = t.sec
    end
  end
end