#-=====================-#
# 计时器清零
#-=====================-#
def clear()
if @perf_flag
@qpCounter.call(@time_start)
else
@time_start=[@tGetTime.call(),0].pack('LL')
end
end
#-==============================-#
# 帧错...
#-==============================-#
def debug(now_time)
if @decimal>0
now_time = (now_time * (10**@decimal)).floor/(10.0**@decimal)
else
now_time = now_time.floor
end
return now_time
#以下用于debug模式
if now_time < 0
p "Timer Wrong!! Clear...",now_time, @perf_flag,@qpCounter,@tGetTime,
@time_now.unpack('LL')[0],@time_now.unpack('LL')[1],
@time_start.unpack('LL')[0],@time_start.unpack('LL')[1]
self.clear()
return 0.0
else
return now_time
end
end
#-=====================-#
# 获取时间比例因数
#-=====================-#
def scale()
return @time_scale[0]+ @time_scale[1]*0xffffffff
end
#-=====================-#
# 获取起始滴答数
#-=====================-#
def start()
return @time_start.unpack('LL')[0]+ @time_start.unpack('LL')[1]*0xffffffff
end
#-=====================-#
# 获取当前的嘀哒数
#-=====================-#
def timer()
if @perf_flag
@qpCounter.call(@time_now)
else
@time_now=[@tGetTime.call(),0].pack('LL')
end
return @time_now.unpack('LL')[0]+ @time_now.unpack('LL')[1]*0xffffffff
end
end
# 播放起始坐标
point = [x, y].pack('ll')
if $MP_ClientToScreen.call(@hWnd, point) == 0
return true
end
x, y = point.unpack('ll')
return true if (x + width) < 0 or (y+height) < 0
if fullscr
wnd = $MP_CreateWindowEX.call(WS_EX_TOPMOST,@class_name,@project_name,
WS_VISIBLE | WS_POPUP,x,y,width,height,
0,0,@hInt,0)
else
wnd = $MP_CreateWindowEX.call(WS_EX_TOOLWINDOW,@class_name,@project_name,
WS_VISIBLE | WS_POPUP,x,y,width,height,
0,0,@hInt,0)
end
# 窗体建立失败
return true if wnd == 0
# 屏蔽原窗体
$MP_EnableWindow.call(@hWnd,0)
$MP_mciSendString.call("open \"" + movie_name + "\"" +
" alias FILE style 1073741824 parent " + wnd.to_s,0,0,0)
if loop
$MP_mciSendString.call("play FILE repeat window",0,0,0)
else
$MP_mciSendString.call("play FILE window",0,0,0)
end
@sys_timer.clear()
step = 0.1
begin
loop do
# 如果在窗口模式
unless fullscr
# 变成全屏
if self.is_full?
break
else
Graphics.update
end
end
#sleep(step)
if skip
Input.update
break if Input.trigger?(Input::A)
end
if @sys_timer.now_s >= movie_length
break
end
if $MP_GetActiveWindow.call() != wnd
$MP_SetActiveWindow.call(wnd)
end
end
Graphics.update
# 关闭当前窗体
$MP_PostMessage.call(wnd,WM_CLOSE,0,0)
$MP_mciSendString.call("close FILE",0,0,0)
$MP_EnableWindow.call(@hWnd,1)
$MP_SetActiveWindow.call(@hWnd)
return true
rescue Hangup
retry
end
end
end