[CLEO-TEST] Render clickable text

  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
109
110
111
112
{$CLEO}
0000:
0662: "by legend2360"
0662: "BlastHack - cheating is art"
while not SAMP.Available()
wait 400
end
0@ = Render.CreateFont("Tahoma", 12, 0xC)
while true
wait 0
call @renderClickableText 6 font 0@ str @text posXY 500 500 color -1 callback @callback_click
end
const
ec_op_process = 1
ec_op_check = 2
end
:renderClickableText
// call @renderClickableText 6 font 0@ str 1@ posXY 2@ 3@ color 4@ callback 5@
if 1@ < 0 // @label
then 0AC6: 1@ = label 1@ offset
end
Render.DrawText(0@, 1@, 2@, 3@, 4@)
0B6B: render 20@ = font 0@ draw_text 1@ length
0B6C: render 21@ = font 0@ draw_height
if call @is_cursor_here 4 startXY 2@ 3@ offsetXY 20@ 21@
then
if call @eventClick 1 const ec_op_check
then
call 5@ 0
end
end
call @eventClick 1 const ec_op_process
ret 0
:eventClick
// call @eventClick 1 ec_operation 0@
if and
0@ >= ec_op_process
0@ <= ec_op_check
then
0AC6: 1@ = label @var_eventClick offset
0A8D: 2@ = read_memory 1@ size 1 virtual_protect 0
if 0@ == ec_op_process
then
if 2@ == true // last event - click
then
if not key 1 // current event - not click
then
0A8C: write_memory 1@ size 1 value false virtual_protect 0
end
else
if key 1 // current event - click / last event - not click
then
0A8C: write_memory 1@ size 1 value true virtual_protect 0
end
end
ret 0
end
if 0@ == ec_op_check
then
if 2@ == false
then
if key 1
then ret 0 1
end
end
end
end
ret 0
:var_eventClick
// bool
hex
00
end
:is_cursor_here
// call @is_cursor_here 4 startXY 0@ 1@ endXY 2@ 3@
0B5E: get_cursor_pos 4@ 5@
if and
001D: 4@ > 0@
001D: 5@ > 1@
then
005A: 0@ += 2@
005A: 1@ += 3@
if and
001D: 0@ > 4@
001D: 1@ > 5@
then ret 0 1
end
end
ret 0
:callback_click
chat "click" -1
ret 0
:text
hex
"This text\0"
end