Page 1 of 1

manialib question

Posted: 03 Jul 2013, 06:07
by danodude
Hey :P

Got a question here...

I've just started using ManiaLib, and it looks great. But my question is, why does this show no background image?

Code: Select all

<?php


use ManiaLib\Gui\Manialink;
use ManiaLib\Gui\Elements\Bgs1InRace;
use ManiaLib\Gui\Elements\Quad;
use ManiaLib\Gui\Elements\Label;

require_once __DIR__.'/libraries/autoload.php';

Manialink::load();
{
	//Background
	Manialink::beginFrame(-160, 90, 0);
	{
		$ui = new Quad(320,180);
		$ui->setImage('ScreenShot93.jpg'); // <-- This will not load the image.
		$ui->save();
		
	
	}
	Manialink::endFrame();

	Manialink::beginFrame(-15, 0, 0);
	{
		$ui = new Label(140);
		$ui->setValign('center');
		$ui->setText('AAAAAAAAAAAAAAGRH');
		$ui->save();
	}
	Manialink::endFrame();
}	
Manialink::render();
?>
I looked at the code output in Chrome, and it looks like this

Code: Select all

<manialink version="1" background="1" navigable3d="0">
<timeout>0</timeout>
<frame posn="-160 90 0">
<quad sizen="320 180" image="media/images/ScreenShot93.jpg"/> //<-- why is the image link different?
</frame>
<frame posn="-15 0 0">
<label sizen="140 7" valign="center" style="TextStaticSmall" text="AAAAAAAAAAAAAAGRH"/>
</frame>
</manialink>
As you can see the image link is different. I've tried putting my images in that directory with no luck.

Do I need to reference another file to display background images?

Thanks for any advice :thumbsup:

Re: manialib question

Posted: 03 Jul 2013, 08:39
by w1lla
http://forum.maniaplanet.com/viewtopic. ... 84#p116634

you missed a true parameter.

Code: Select all

$ui->setImage('ScreenShot93.jpg', true); // <-- This will not load the image.

Re: manialib question

Posted: 03 Jul 2013, 10:31
by danodude
Ah, thanks w1lla. The example I was going off didn't say I needed that :x