-
Notifications
You must be signed in to change notification settings - Fork 1
/
Template.ahk
108 lines (88 loc) · 2.67 KB
/
Template.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#NoEnv
#Warn All
#Warn LocalSameAsGlobal, Off
Width := 800
Height := 600
DurationLimit := 1 / 20
global Infinity := 0xFFFFFFFFFFFFFFF
SetBatchLines, -1
s := new Canvas.Surface(Width,Height)
s.Smooth := "Best"
p := new Parasol
Gui, +LastFound
hWindow := WinExist()
hDC := DllCall("GetDC","UPtr",hWindow,"UPtr")
Gui, Show, w%Width% h%Height%, Physics Test
InitializeStart()
Activate(hDC,s,Func("StepStart"),DurationLimit)
Return
GuiClose:
ExitApp
Activate(hDC,Surface,Step,DurationLimit)
{
TickFrequency := 0, Ticks1 := 0, Ticks := 0
If !DllCall("QueryPerformanceFrequency","Int64*",TickFrequency) ;obtain ticks per second
throw Exception("Could not obtain performance counter frequency.")
If !DllCall("QueryPerformanceCounter","Int64*",Ticks1) ;obtain the performance counter value
throw Exception("Could not obtain performance counter value.")
Loop
{
If !DllCall("QueryPerformanceCounter","Int64*",Ticks) ;obtain the performance counter value
throw Exception("Could not obtain performance counter value.")
Duration := (Ticks - Ticks1) / TickFrequency, Ticks1 := Ticks
If Duration < 0
Duration := 0
If (Duration > DurationLimit)
Duration := DurationLimit
If Step.(Duration)
Break
DllCall("BitBlt","UPtr",hDC,"Int",0,"Int",0,"Int",Surface.Width,"Int",Surface.Height,"UPtr",Surface.hMemoryDC,"Int",0,"Int",0,"UInt",0xCC0020) ;SRCCOPY
Sleep, (DurationLimit - Duration) * 1000
}
}
InitializeStart()
{
global b := new Canvas.Brush(0xFFFFFFFF)
global Subtitle := new Canvas.Format("Georgia",24)
global Title := new Canvas.Format("Georgia",72)
}
StepStart(Duration)
{
global s
global b
global Subtitle, Title
static Timer := 0
Timer += Duration
s.Clear()
If Timer < 1
{
Alpha := Floor(Timer * 0xFF)
b.Color := (b.Color & 0xFFFFFF) | ((Alpha & 0xFF) << 24)
}
Else If Timer < 3
{
}
Else If Timer < 4
{
Alpha := Floor((3 - Timer) * 0xFF)
b.Color := (b.Color & 0xFFFFFF) | ((Alpha & 0xFF) << 24)
}
If Timer < 4
{
s.Text(b,Subtitle,"Uberi & Ton80 present",50,500)
}
If Timer > 5
{
If Timer < 6
{
Alpha := Floor((Timer - 5) * 0xFF)
b.Color := (b.Color & 0xFFFFFF) | ((Alpha & 0xFF) << 24)
}
s.Text(b,Title,"GAME NAME HERE",50,200)
.Text(b,Subtitle,"Made, with love, during Ludum Dare #24",50,500)
}
}
Return
#Include Parasol\Parasol.ahk
#Include Canvas-AHK\
#Include Canvas.ahk