找回密码
 加入
搜索
楼主: afan

[效率算法] 心跳的感觉[控件移动]

 火... [复制链接]
发表于 2010-4-22 13:03:03 | 显示全部楼层
呵呵呵呵呵呵呵呵呵呵呵额呵呵

评分

参与人数 1金钱 -30 收起 理由
pusofalse -30 恶意灌水,扣分警告!

查看全部评分

发表于 2010-4-22 13:03:07 | 显示全部楼层
呵呵呵呵呵呵呵呵呵呵呵额呵呵

评分

参与人数 1金钱 -30 收起 理由
pusofalse -30 恶意灌水,扣分警告!

查看全部评分

发表于 2010-4-22 13:03:12 | 显示全部楼层
呵呵呵呵呵呵呵呵呵呵呵额呵呵

评分

参与人数 1金钱 -30 收起 理由
pusofalse -30 恶意灌水,扣分警告!

查看全部评分

发表于 2010-4-22 13:03:16 | 显示全部楼层
呵呵呵呵呵呵呵呵呵呵呵额呵呵

评分

参与人数 1金钱 -30 收起 理由
pusofalse -30 恶意灌水,扣分警告!

查看全部评分

发表于 2010-4-22 13:03:20 | 显示全部楼层
呵呵呵呵呵呵呵呵呵呵呵额呵呵

评分

参与人数 1金钱 -30 收起 理由
pusofalse -30 恶意灌水,扣分警告!

查看全部评分

发表于 2010-4-22 13:36:21 | 显示全部楼层
来看看....学习
发表于 2010-4-22 13:53:13 | 显示全部楼层
回复 50# dddwd
敢在太岁头上动土,你惨啦!你!
发表于 2010-4-22 15:16:34 | 显示全部楼层
回复 50# dddwd

恶意灌水,来找罚的
发表于 2010-4-22 18:09:06 | 显示全部楼层
我也看看..
发表于 2010-4-22 20:04:54 | 显示全部楼层
我是来围观dddwd同学的。
发表于 2010-4-22 21:37:27 | 显示全部楼层
看看是什么。。。。。。。。。。。
发表于 2010-4-22 23:30:08 | 显示全部楼层
回复 1# afan

看看
发表于 2010-4-22 23:46:33 | 显示全部楼层
看看这个心跳
#include <GUIConstantsEx.au3>
Dim $P = RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir')
Dim $Ico = $P & '\Aut2Exe\Icons\strawberry.ico'
$formh = GUICreate('test', 350, 130)
$cIco = GUICtrlCreateIcon($Ico, -1, 200, 50, 32, 32)
GUICtrlCreateLabel("心跳速率  (次/分钟)", 8, 70, 60, 30)
GUICtrlCreateLabel("心跳变率  (次/分钟)", 8, 100, 60, 30)
GUICtrlCreateLabel("心跳最高值(次/分钟)", 8, 40, 60, 30)
GUICtrlCreateLabel("心跳最低值(次/分钟)", 8, 10, 60, 30)
$edit0 = GUICtrlCreateEdit("", 75, 10, 40, 18, 0x2000)
$edit1 = GUICtrlCreateEdit("", 75, 40, 40, 18, 0x2000)
$edit2 = GUICtrlCreateEdit("", 75, 70, 40, 18, 0x2000)
$edit3 = GUICtrlCreateEdit("", 75, 100, 40, 18, 0x2000)
$bu_chang = GUICtrlCreateButton("输入初始参数", 140, 40, 50, 50, 0x3300)
GUICtrlSetState($edit0, $GUI_DISABLE)
GUICtrlSetState($edit1, $GUI_DISABLE)
GUICtrlSetState($edit2, $GUI_DISABLE)
GUICtrlSetState($edit3, $GUI_DISABLE)
GUISetState()
Global $hartdata[5] = [60, 100, 80, 0, 1]
Global $icorect[2] = [30, 60]
$input = 0
AdlibRegister('pengpeng', 50)
$jstime = TimerInit()
$lastetime = TimerDiff($jstime)
$runt = 0
While 1
        $runt += 1
        If $runt > 500 Then 
        If $hartdata[3] > 0 Then
                $hartdata[3] -= Random(0,5,1)
        Else
                $hartdata[3] += Random(0,5,1)
        EndIf        
        $runt = 0
        EndIf
        If $hartdata[4] = 3 Then
                If Not IsDeclared("scl") Then $scl = 0
                If $scl <> 11 Then
                        $scl = MsgBox(86, "     ~@^@~", " 心跳超出承受范围!!" & @CRLF & "  你玩完啦!!")
                        Switch $scl
                                Case 2
                                        ;$hartdata[0] = 60
                                        ;$hartdata[1] = 100
                                        $hartdata[2] = $hartdata[1] 
                                        $hartdata[3] = 0
                                        $hartdata[4] = 1
                                Case 10
                                        $hartdata[0] = 60
                                        $hartdata[1] = 100
                                        $hartdata[2] = 80
                                        $hartdata[3] = 0
                                        $hartdata[4] = 1
                                Case 11
                                        ;$hartdata[0] =
                                        ;$hartdata[1] =
                                        ;$hartdata[2] =
                                        ;$hartdata[3] =
                                        ;$hartdata[4] =
                                Case Else
                                        $scl = 11
                        EndSwitch
                EndIf
        EndIf
        $nMsg = GUIGetMsg(1)
        If $input = 0 Then
                GUICtrlSetData($edit0, $hartdata[0])
                GUICtrlSetData($edit1, $hartdata[1])
                GUICtrlSetData($edit2, $hartdata[2])
                GUICtrlSetData($edit3, $hartdata[3])
        EndIf
        Switch $nMsg[0]
                Case -3
                        Exit
                Case $cIco
                Case $GUI_EVENT_PRIMARYDOWN
                        If Not IsDeclared("clickt") Then
                                $clickt = TimerInit()
                                $mdbclick = False
                        Else
                                $ctds = TimerDiff($clickt)
                                If $ctds < 1000 Then
                                        $mdbclick = True
                                Else
                                        $mdbclick = False
                                EndIf
                                $clickt = TimerInit()
                        EndIf
                        $msinfo = GUIGetCursorInfo($formh)
                        If $msinfo[4] = $cIco Then
                                If $mdbclick Then
                                        $hartdata[3] = 0
                                Else
                                        $hartdata[3] += 1
                                EndIf
                        EndIf
                Case $GUI_EVENT_SECONDARYDOWN
                        $msinfo = GUIGetCursorInfo($formh)
                        If $msinfo[4] = $cIco Then
                                $hartdata[3] -= 1
                        EndIf
                Case $bu_chang
                        If $input Then
                                GUICtrlSetData($bu_chang, "输入初始参数")
                                $input = 0
                                GUICtrlSetState($edit0, $GUI_DISABLE)
                                GUICtrlSetState($edit1, $GUI_DISABLE)
                                GUICtrlSetState($edit2, $GUI_DISABLE)
                                GUICtrlSetState($edit3, $GUI_DISABLE)
                                $hartdata[0] = GUICtrlRead($edit0)
                                $hartdata[1] = GUICtrlRead($edit1)
                                $hartdata[2] = GUICtrlRead($edit2)
                                $hartdata[3] = GUICtrlRead($edit3)
                                $hartdata[4] = 1
                                $scl = 0
                        Else
                                GUICtrlSetData($bu_chang, "确定")
                                $input = 1
                                GUICtrlSetState($edit0, $GUI_ENABLE)
                                GUICtrlSetState($edit1, $GUI_ENABLE)
                                GUICtrlSetState($edit2, $GUI_ENABLE)
                                GUICtrlSetState($edit3, $GUI_ENABLE)
                        EndIf
                EndSwitch
WEnd

Func pengpeng()
        Local $hartpos[4] = [250, 60, 0, 0]
        If $hartdata[4] = 3 Then Return SetError(1, 0, 0)
        $hartodpos = ControlGetPos($formh, "", $cIco)
        $distance = TimerDiff($jstime) - $lastetime
        $addtimes = $hartdata[3] * $distance / 6000
        $hartdata[2] += $addtimes
        If $hartdata[2] > $hartdata[1] Then
                $hartdata[4] = 3
        EndIf
        If $hartdata[2] < $hartdata[0] Then
                $hartdata[4] = 3
        EndIf
        $hicomax = $icorect[1]
        $hicomin = $icorect[0]
        $hicocrmax = 0.5 * ($icorect[1] - $icorect[0]) * ($hartdata[2] - $hartdata[0]) / ($hartdata[1] - $hartdata[0]) + $icorect[0] + (0.5 * ($icorect[1] - $icorect[0]))
        $hicocrn = $hartodpos[3]
        $icoadd = ($hicocrmax - $hicomin) * 2 * $distance / (1000 * 60 / $hartdata[2])* Random(0.8,1.2)
        Switch $hartdata[4]
                Case 1
                        $hicocrn += $icoadd
                        If $hicocrn >= $hicocrmax Then
                                $hartdata[4] = 0
                                $hicocrn = $hicocrmax
                        EndIf
                Case 0
                        $hicocrn -= $icoadd
                        If $hicocrn <= $hicomin Then
                                $hartdata[4] = 1
                                $hicocrn = $hicomin
                        EndIf
                Case 3
                Case Else
                        MsgBox(0, "", "不知道你心在干什么!!")
                        Exit
        EndSwitch
        $hartpos[2] = $hartpos[0] - Round($hicocrn / 2)
        $hartpos[3] = $hartpos[1] - Round($hicocrn / 2)
        GUICtrlSetPos($cIco, $hartpos[2], $hartpos[3], $hicocrn, $hicocrn)
        $lastetime = TimerDiff($jstime)
EndFunc   ;==>pengpeng

评分

参与人数 2金钱 +72 贡献 +5 收起 理由
lynfr8 + 22 + 5 很棒的见解
afan + 50 学习了

查看全部评分

发表于 2010-4-23 06:37:00 | 显示全部楼层
LS的代码精彩.....
发表于 2010-4-23 07:32:43 | 显示全部楼层
回复 59# doshowyam

很形象啊,非常不错!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-26 11:41 , Processed in 0.076530 second(s), 18 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表