Example #1
0
 function LevelLoad(&$con)
 {
     // сервак прислал нам параметры левела
     //$LVL=TRLevelConstructor::Generate($con);
     //if(!is_array($LVL)) return false;
     // $A=array(
     // array(	'',	1,	'',	0,	'',	0,	'',	0,	''),
     // array(	0,	1,	0,	1,	0,	1,	1,	1,	0),
     // array(	'',	1,	'',	1,	'',	1,	'',	0,	''),
     // array(	0,	1,	1,	1,	0,	1,	0,	1,	0),
     // array(	'',	0,	'',	0,	'',	1,	'',	1,	''),
     // array(	1,	1,	1,	1,	1,	1,	1,	1,	0),
     // array(	'',	1,	'',	0,	'',	1,	'',	0,	''),
     // array(	0,	1,	0,	1,	0,	1,	0,	1,	1),
     // array(	'',	0,	'',	1,	'',	0,	'',	0,	''),
     // );
     $A = TRLevelConstructor::Generate($con);
     $w = $con['size'][0];
     $h = $con['size'][1];
     $r = 20;
     //рамка
     $s = $con['steep_size'];
     $img = TRLevelConstructor::Draw($A, $w, $h, $s, $r);
     TRGUI::SetLevelImage($img);
     TRGUI::SetLevelImageVisible(true);
     //imagedestroy($img);
     $this->SteepSize = $s - 1;
     if (isset($con['bgimage'])) {
         $this->LevelBGImage_SV($con['bgimage']);
     }
 }
Example #2
0
 function SetBackgroundImage($imgStr = null, $file = false)
 {
     if (is_null($imgStr)) {
         $imgStr = file_get_contents(DOC_ROOT . '/files/images/DefaultImage.jpg');
     }
     $w = self::$Interface['BGImage']->w;
     $h = self::$Interface['BGImage']->h;
     $img = TRLevelConstructor::ImageToSize($imgStr, $w, $h, $file);
     if (false === $img) {
         return false;
     }
     self::$Interface['BGImage']->picture->loadFromStr(TRLevelConstructor::ImageToStr($img), 'png');
     imagedestroy($img);
 }