forked from iolevel/peachpie-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.php
52 lines (43 loc) · 1.65 KB
/
main.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
<?php
Urho\Desktop\DesktopUrhoInitializer::$AssetsDirectory = '.\Assets';
(new class (new Urho\ApplicationOptions("Data")) extends Urho\Application {
function __construct(Urho\ApplicationOptions $options)
{
}
function CreateLogo() : void
{
$cache = $this->ResourceCache;
$logoTexture = $cache->GetTexture2D("Textures/LogoLarge.png");
if (empty($logoTexture))
return;
$ui = $this->UI;
$logoSprite = $ui->Root->CreateSprite();
$logoSprite->Texture = $logoTexture;
$w = $logoTexture->Width;
$h = $logoTexture->Height;
$logoSprite->SetScale(256.0 / $w);
$logoSprite->SetSize($w, $h);
$logoSprite->SetHotSpot(0, $h);
$logoSprite->SetAlignment(Urho\Gui\HorizontalAlignment::Left, Urho\Gui\VerticalAlignment::Bottom);
$logoSprite->Opacity = 0.75;
$logoSprite->Priority = -100;
}
function Start() : void
{
$cache = $this->ResourceCache;
$helloText = new Urho\Gui\Text();
$helloText->Value = "Hello from Peachpie & Xamarin";
$helloText->HorizontalAlignment = Urho\Gui\HorizontalAlignment::Center;
$helloText->VerticalAlignment = Urho\Gui\VerticalAlignment::Center;
$helloText->SetColor(new Urho\Color(0.0, 1.0, 0.0));
$helloText->SetFont($cache->GetFont("Fonts/Anonymous Pro.ttf"), 30);
$this->UI->Root->AddChild($helloText);
$this->Graphics->WindowTitle = "Peachpie & Urho Sample";
$this->CreateLogo();
}
function OnUpdate(float $timeStep)
{
//MoveCameraByTouches(timeStep);
parent::OnUpdate($timeStep);
}
})->Run();