Porting to Mac

Monkey Forums/Monkey Programming/Porting to Mac

cgrossi(Posted 2016) [#1]
Hi.

I'm porting my game to Mac and I got an error when loading an image. It simple doesn't load the image. It's a simple PNG, transparent background, small image. I have plenty of images loaded before, all png, and one isn't being loaded. What can it be? In Windows, the game runs perfectly.

The MacOS, I think, is Mountain Lion, I'm not sure, it's a borrowed one... And I'm not that familiar with Mac...

Edit: Mac OS X, version 10.7.5, Intel Core 2 Duo, 2GB RAM.

Thanks
Cristiano


Shinkiro1(Posted 2016) [#2]
Double check your filename for case sensitivity.
Then check for file permissions (right click -> get info).


cgrossi(Posted 2016) [#3]
Hi, Shinkiro1.

No problems with the name or permissions...


cgrossi(Posted 2016) [#4]
Hello, guys!! Anyone???

Regards!
Cristiano


Goodlookinguy(Posted 2016) [#5]
Your image is encoded with an encoding not supported by the OS or system running it on the OS. For images like these, I take them into Windows Picture (Image?) Gallery and rotate the image and close it. Open the image in Windows Picture Gallery again and rotate it back, then close. That will set its encoding to a more universally accepted encoding. I had this issue with every OS in one way or another because of some of the PNG encodings I was using.


cgrossi(Posted 2016) [#6]
I did what you said, but the error remains, Goodlookinguy... :(


cgrossi(Posted 2016) [#7]
And, Goodlookinguy, I've created others images based on the one with problem, and nothing... If you want I can send you the image to you see... I believe the problem will happens to others...

Regards
Cristiano


Goodlookinguy(Posted 2016) [#8]
I'm afraid I'm on vacation away from my Mac so I can't test from here. Another recommendation would be to simply copy the image contents into a new image you create in photoshop, graphics gale, or whatever you use, and see if it works. I've also had that work for me before. Other than that, I'm not entirely sure.


cgrossi(Posted 2016) [#9]
Ok. Yes, as I told, I did that and didn't work.. Don't know what else to do...


Goodlookinguy(Posted 2016) [#10]
Post the image if you wish. I can take a look at it and see if there's anything strange that would cause it to fail. Other than that, bringing this up to Mark in the bugs section is the next step.


cgrossi(Posted 2016) [#11]
Hi, Goodlookinguy....

Here is a link to download the image.

pancada.png

Thanks.


Jesse(Posted 2016) [#12]
it works on my macbook with the latest operating system.
I tried it it like this:
Import mojo2

Function Main()
	New Game()
End Function


Class Game Extends App
	Field image:Image
	Field canvas:Canvas
	
	Method OnCreate()
		canvas = New Canvas
		image = Image.Load("pancake.png")
		SetUpdateRate 30
		
	End Method
	
	Method OnRender()
		canvas.Clear(0,0,0,1)
		canvas.DrawImage(image,100,100)
		canvas.Flush()
	End Method
	
End class

also works with mojo 1.
I put the image in a folder with the name pancake.data and named the code file pancake.monkey.
my question is, Are you doing a canvas flush after you are done with all of the drawings?


cgrossi(Posted 2016) [#13]
Hi, Jesse. I'm using mojo1. And the error occurs when I load the image. Monkey simply doens't load it. That's my system: MacOS X 10.7.5

Regards


Jesse(Posted 2016) [#14]
it works the same in mojo1
Import mojo

Function Main()
	New Game()
End Function


Class Game Extends App
	Field image:Image
	
	
	Method OnCreate()
		image = LoadImage("pancake.png")
		SetUpdateRate 30
		
	End Method
	
	Method OnRender()
		Cls
		DrawImage(image,100,100)
	End Method
	
End class



cgrossi(Posted 2016) [#15]
Putz, now I don't know what to do... Did you edit the image? What's your Monley version? 84f?


Jesse(Posted 2016) [#16]
monkey 85d, used the image as downloaded.
only looking at the source code we'll be able to help.


Jesse(Posted 2016) [#17]
check for null on your image download section after download is complete
If image = Null Print "unable to load image"



cgrossi(Posted 2016) [#18]
Hey, Jesse. Thank you! You open my mind for one thing. My images are under a subfolder of data folder. To load them on PC you use "\". On Mac it's different. So I changed all the load images and sound and now the game is running.. I'll see if everything is ok now.

Than you a lot!
Regards
Cristiano


Goodlookinguy(Posted 2016) [#19]
Monkey should really report, "image not found".

Also, regardless of platform, Monkey fixes the data path. So always use "/" for directory changes even if it feels odd.


cgrossi(Posted 2016) [#20]
Yes, good idea. Thank you all!!

Regards
Cristiano