-
Notifications
You must be signed in to change notification settings - Fork 0
/
go.php
103 lines (91 loc) · 2.15 KB
/
go.php
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
<?PHP
/**
* GO (Game)
*
* Hier kommt die Beschreibung zu dieser
* Datei hinein. Auch über mehrere Dateien
* wenn man will.
* GO benutzt folgende Tabellen in der DB:
* xy, xy_dwz, ...
*
* @package Zorg
* @subpackage GO
*/
/**
* @include main.inc.php
*/
include_once( __DIR__ .'/includes/main.inc.php');
/**
* GO Klasse
*
* Dies ist die Klasse zum GO Spiel.
*
* @author [z]bert, [z]domi
* @date nn.nn.nnnn
* @version 1.0
* @package Zorg
* @subpackage GO
*/
class go {
/**
* Feldgrösse Standartwert
* @var integer Variable für die Feldgrösse, Default = 40
*/
var $feld_groesse = 40;
/**
* GO Spielfeld (Goban?) der Grösse \$size anzeigen
*
* @author [z]bert, [z]domi
* @date nn.nn.nnnn
* @version 1.0
* @since 1.0
*
* @param integer $size Grösse des GO-Spielfeldes
*/
function go($size) {
$this->size = $size;
$this->img_size = $this->feld_groesse * $this->size;
$this->img = imagecreatetruecolor($this->img_size,$this->img_size);
$this->bg = imagecolorallocate($this->img,255,255,255);
imagefill($this->img,0,0,$this->bg);
$this->line = imagecolorallocate($this->img,0,0,0);
for($i = 0;$i<=$this->size;$i++) {
imageline($this->img,0,($i*$this->feld_groesse),$this->img_size,($i*$this->feld_groesse),$this->line);
imageline($this->img,($i*$this->feld_groesse),0,($i*$this->feld_groesse),$this->img_size,$this->line);
}
imagerectangle($this->img,0,0,$this->img_size-1,$this->img_size-1,$this->line);
$this->partei[0] = imagecolorallocate($this->img,23,23,23);
$this->partei[1] = imagecolorallocate($this->img,200,200,200);
}
/**
* ...
*
* @author [z]bert, [z]domi
* @date nn.nn.nnnn
* @version 1.0
* @since 1.0
*
* @param integer $x ...
* @param integer $y ...
* @param integer $partei ...
*/
function stone($x,$y,$partei) {
imagefilledellipse($this->img,$x,$y,23,23,$this->partei[$partei]);
}
/**
* ...
*
* @author [z]bert, [z]domi
* @date nn.nn.nnnn
* @version 1.0
* @since 1.0
*/
function display() {
imagepng($this->img);
}
}
header("Content-Type: Image/PNG");
$go = new go(13);
$go->stone(40,40,0);
$go->stone(40,120,1);
$go->display();