manialib question

Open source, lightweight PHP framework for Manialink and Web development.

Moderator: NADEO

Post Reply
User avatar
danodude
Posts: 176
Joined: 01 Dec 2011, 12:25
Location: Western Australia

manialib question

Post 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:
User avatar
w1lla
Posts: 2396
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

Re: manialib question

Post 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.
TM² Info
SM Info
QM Info

OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs
User avatar
danodude
Posts: 176
Joined: 01 Dec 2011, 12:25
Location: Western Australia

Re: manialib question

Post by danodude »

Ah, thanks w1lla. The example I was going off didn't say I needed that :x
Post Reply

Return to “ManiaLib”

Who is online

Users browsing this forum: No registered users and 1 guest