I'm using ARToolkit in my Android project. I used this to help me create a new marker and everything worked fine. The file created was called marker64.pat. However, the standard pattern files that ARToolkit uses are .patt files (with the extra t). Why did it create a .pat file for me?
This .pat file doesn't seem to work, as it crashes my application just as it starts.
This is the original line of code that was already there (which works fine):
markerID = ARToolKit.getInstance().addMarker("single;Data/hiro.patt;80");
This is my changed version:
markerID = ARToolKit.getInstance().addMarker("single;Data/marker64.pat;80");
This is my marker image whilst I'm creating the marker:
Can you please let me know why, firstly, my file was created as .pat file and not a .patt file. And secondly, why this file doesn't work if it's correct.
Thanks
Related
I would like to know, how to change the osmdroid default path to an extSdCard path?
according to the documentation, it is possible using:
Configuration.getInstance().SetOsmdroidBasePath();
I believe when running my project it automatically starts on the way:
StorageUtils.getStorage().GetAbsolutePath() , "osmdroid"
I tried to use the command below, but my map does not display the tiles
Configuration.getInstance().setOsmdroidBasePath(new File("/mnt/extSdCard/osmdroid"));
And when I debug my code using this: Configuration.getInstance().GetOsmdroidBasePath().GetPath()
It presents the correct path.
It is necessary to perform some reload of my map?
If the user has granted runtime permissions for storage before the map view is created, then it should work just fine. You may want to check to make sure you can write to that path. Android is strange and often times just because a path is available does not mean you can write to it. The StorageUtils class can help you find the available paths and it should be able to determine which path is writable. It is, however, imperfect. Paths can vary from device to device and results can be unpredictable.looking at this link might help you.
For OSM version 6.x you can use the following code
#Override
public void onCreate() {
...
org.osmdroid.config.IConfigurationProvider osmConf = org.osmdroid.config.Configuration.getInstance();
File basePath = new File(getCacheDir().getAbsolutePath(), "osmdroid");
osmConf.setOsmdroidBasePath(basePath);
File tileCache = new File(osmConf.getOsmdroidBasePath().getAbsolutePath(), "tile");
osmConf.setOsmdroidTileCache(tileCache);
...
}
I'm new to Xamarin and I'm facing strange issue that whenever i try to add new image to Resources/drawable folder of Android and referring it to shared code,all other images are getting change and starts referring random images.
Steps which I'm following :
Add a new Image to Resources/drawable folder.
Change Build Action to "AndroidResources".
And referring the new image in Source attribute.
thanks in advance.
Looks like your Android resource generated file was not re-generated or broken. Try Clean-Build Android project. If that doesn't help, delete bin and obj folders and try building again.
I am working on some app that loads external swfs from the application directory
the problem is that some swf files get loaded correctly and others give ioerror url not found
i put the paths in an array and use a loader to load the path
var arr:Array = ["Games/1.swf", "Games/2.swf"];
var loader:Loader = new Loader();
loader.load(new URLRequest(arr[0]));
this is just example and it is the same in loading all the files but does not work on all files.
what would be the problem?
Firstly, whenever you load something, listen for the appropriate error events so you know what's going on:
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
When using mobile, you should use the app:// shorthand as a reference to the application directory (which I assume is where your Game folder is. Relative paths do not usually work.
So it should look like this:
var arr:Array = ["app://Games/1.swf", "app://Games/2.swf"];
For more information/options, you can look at my answer to this question
I am using offline version of osmdroid, maps are placed in sdcard/osmdroid. Do you know, how to change the file path? I have been searching through their code for handling ZIP files but I haven't found any solution. Anyone faced this issue before?
Thx
If you download the package of code about osmdroid: osmdroid-android-3.0.8-sources, you can open the class OpenStreetMapTileProviderConstants.java and modify the variable in this way:
modify
public static final File OSMDROID_PATH = new File("/mnt/sdcard/osmdroid");
to*
public static final File OSMDROID_PATH = new File("/mnt/ext_sdcard/yourfile");
Then put your map tiles into yourfile.
Here you can check out the code to build your own version of OSMdroid. Changing ZIP and local folder is totally possbile, had to do it myself a few months ago.
Responsible for the Zips are this classes:
org/osmdroid/tileprovider/modules/ZipFileArchive.java
org/osmdroid/tileprovider/modules/MapTileFileArchiveProvider.java
I am trying to draw one sprite from atlas.. I created with Zwoptex the atlas and the plist file.
put the two files in the assest folder..
In the code I create new GameScene class
and try to load it..
//Return the ShareFrameCache object.
CCSpriteFrameCache frameCache = CCSpriteFrameCache.sharedSpriteFrameCache();
//Loading the list of frames from the list file.
frameCache.addSpriteFrames("level1.plist");
//Testing and see if I can load one frame to a sprite
CCSprite sprite = CCSprite.sprite("Screen_01_0029_BG_01-0.png");
//Set the position of the frame to the middle of the screen
sprite.setPosition(CGPoint.ccp(winSize.width/2,winSize.height/2));
//add the sprite as child so it can be seen on the phone.
addChild(sprite,0);
In the debugger I am getting these errors:
04-28 12:45:31.662: WARN/System.err(1147): java.io.FileNotFoundException: level1.png
04-28 12:45:32.642: WARN/System.err(1147): java.io.FileNotFoundException: Screen_01_0029_BG_01-0.png
04-28 12:45:32.622: ERROR/CCSpriteFrameCache(1147): Unsupported Zwoptex plist file format.
Screen_01_0029_BG_01-0.png refers to one of the frames in the level1.png atlas...
Thoughts ?
ER
first of all you need to pass the "true" statement as second parameter in the "CCSprite.sprite" constructor. This way you instruct cocos2d that you intent to use a sprite image which is part of a resource plist file instead as a stand alone image in the \res folder of your project. If that won't help you may need to remove the cocos2d JAR file from the \libs directory and download the source code from github. If you do this please comment out the "draw" methods at the CCMenuItemSpite.java class since it produces double images. The default behavior of the class works just fine. You may also need to remove some "#Override" directives, especially if you have a latest version of Eclipse as I do before you get the source files to be properly built and linked with your project. I hope that helps a bit...