This repository has been archived by the owner on Oct 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.pwn
67 lines (46 loc) · 1.55 KB
/
test.pwn
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
#include <a_samp>
#include "colour-manipulation.inc"
main() {
test(0xFFFFFFCC, COLOUR_MODE_RGBA);
test(0x000000CC, COLOUR_MODE_RGBA);
test(0xFFFFFFFF, COLOUR_MODE_ARGB);
test(0xFF000000, COLOUR_MODE_ARGB);
test(0xFFFFFF, COLOUR_MODE_RGB);
test(0x000000, COLOUR_MODE_RGB);
printf("0x%06x", SetColourComponent(0x000000, COLOUR_COMPONENT_R, 1.0, COLOUR_MODE_RGB));
printf("0x%06x", SetColourComponent(0x000000, COLOUR_COMPONENT_G, 1.0, COLOUR_MODE_RGB));
printf("0x%06x", SetColourComponent(0x000000, COLOUR_COMPONENT_B, 1.0, COLOUR_MODE_RGB));
printf("0x%08x", ConvertColour(0xFF0000, COLOUR_MODE_RGB, COLOUR_MODE_RGBA));
printf("0x%08x", ConvertColour(0xFF0000CC, COLOUR_MODE_RGBA, COLOUR_MODE_ARGB));
}
test(colour, ColourMode:mode) {
new fmt[7];
if (mode == COLOUR_MODE_RGB) {
fmt = "0x%06x";
} else {
fmt = "0x%08x";
}
printf(fmt, colour);
printf(fmt, DarkenColour(colour, 0.2, mode));
printf(fmt, LightenColour(colour, 0.2, mode));
printf(fmt, GrayscaleColour(colour, mode));
printf("%f", GetColourBrightness(colour, mode));
}
new Text:ColourTD[40];
public OnGameModeInit() {
new colour;
for (new i; i < 40; i++) {
colour = InterpolateColours(0xFF0000FF, 0x0000FFFF, float(i) * 0.025);
ColourTD[i] = TextDrawCreate(106.0 + float(i * 6), 88.0, "_");
TextDrawUseBox(ColourTD[i], true);
TextDrawBoxColor(ColourTD[i], colour);
TextDrawTextSize(ColourTD[i], 111.0 + float(i * 6), 20.0);
}
return 1;
}
public OnPlayerConnect(playerid) {
for (new i; i < 40; i++) {
TextDrawShowForPlayer(playerid, ColourTD[i]);
}
return 1;
}