Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Failed to load image

Author
Message
Willie Mundermuffin
18
Years of Service
User Offline
Joined: 5th Jan 2006
Location:
Posted: 18th Dec 2012 09:54 Edited at: 18th Dec 2012 10:02
hmmm... can't load images. I've tried relative paths, default, etc. I looked at example code and even tried loading an image from an example project, but debug output keeps saying failed to load uiimage. I have the image placed in the root folder of the project, just like in the example. All I get is a big white square. Here's my code:


*Edit: I've been using VC++ for years and am not used to Xcode. Maybe I need to add the image as a resource?

*FIXED*
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th Dec 2012 17:05
Yes, in Xcode you need to manually add all your media to the project in the Resources folder in the folder view in the Xcode interface. Right click on the Resources folder and select 'add resources to...'.

If you want to use specific paths in your code, make sure the 'Create folder references for any added folders' is selected. This also means that you only need to add a directory once (assuming you put your media in a sub directory in the project directory) and any files added to that folder will automagically be included in the builds.

Then select the folder with your media (assuming a sub directory) and click on the 'Add' button.

I keep all my media and data files in a sub directory named 'media' and specifically add '/media/' to all load commands.

Also, it doesn't hurt to make sure you use the same cases in the actual file names as in the load commands you use. Xcode is case sensitive.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 18th Dec 2012 18:35
AL what about the same name ? i got some problem when i have some files called with the same name but in different folders. XCode seem to have some problem, do you know how to fix it ?

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th Dec 2012 19:25
If you include the entire folder with complete path in the Resources, it is fine.

Then just use the full path in the file load. Like loadimage('/media/dir1/abc.png') and loadimage('/media/dir2/abc.png'). (Assumes using a directory named 'media' in the project directory and then two sub directories, 'dir1' and 'dir2', under that.)

Then you just include the 'media' folder in Resources, making sure that the 'Create folder references for any added folders' radio button is selected. If you do that correctly, the 'media' folder appears in blue under Resources.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-05-06 23:08:52
Your offset time is: 2024-05-06 23:08:52