0
LibGDXベースのプロジェクトでは、プロジェクトをHTML用にコンパイルすると(GWTを使用)、アセットフォルダ内の隠された '.DT_Store'それでも参照されます。あなたがページを開いたときGWTを使用してHTML用にコンパイルすると、LibGDX ".DT_Store"ファイルが見つかりませんでした。
".DT_Storeファイル"
が見つかりません:これが原因となります。
LibGDXベースのプロジェクトでは、プロジェクトをHTML用にコンパイルすると(GWTを使用)、アセットフォルダ内の隠された '.DT_Store'それでも参照されます。あなたがページを開いたときGWTを使用してHTML用にコンパイルすると、LibGDX ".DT_Store"ファイルが見つかりませんでした。
".DT_Storeファイル"
が見つかりません:これが原因となります。
展開に含めたくないファイルを除外する必要があります。
このソリューションは、除外する他のファイルにも適用できます。あなたの.gwt.xmlファイル内
、以下のタグを追加:あなたのHTMLプロジェクトで
<set-configuration-property name="gdx.assetfilterclass" value="com.my.Package.DefaultAssetFilter" />
<set-configuration-property name="gdx.assetpath" value="../android/assets" />
を、クラスを追加します。
package com.my.Package;
import com.badlogic.gdx.backends.gwt.preloader.AssetFilter;
/*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
public class DefaultAssetFilter implements AssetFilter {
private String extension (String file) {
String name = file;
int dotIndex = name.lastIndexOf('.');
if (dotIndex == -1) return "";
return name.substring(dotIndex + 1);
}
@Override
public boolean accept (String file, boolean isDirectory) {
if (isDirectory && file.endsWith(".svn")) return false;
if (isDirectory && file.endsWith(".bundle")) return false;
if (file.endsWith(".DS_Store")) return false;
return true;
}
@Override
public AssetType getType (String file) {
String extension = extension(file).toLowerCase();
if (isImage(extension)) return AssetType.Image;
if (isAudio(extension)) return AssetType.Audio;
if (isText(extension)) return AssetType.Text;
return AssetType.Binary;
}
private boolean isImage (String extension) {
return extension.toLowerCase().equals("jpg") || extension.toLowerCase().equals("jpeg") || extension.toLowerCase().equals("png") || extension.toLowerCase().equals("bmp") || extension.toLowerCase().equals("gif");
}
private boolean isText (String extension) {
return extension.toLowerCase().equals("json") || extension.toLowerCase().equals("xml") || extension.equals("txt") || extension.equals("glsl")
|| extension.equals("fnt") || extension.equals("pack") || extension.equals("obj") || extension.equals("atlas")
|| extension.equals("g3dj");
}
private boolean isAudio (String extension) {
return extension.toLowerCase().equals("mp3") || extension.toLowerCase().equals("ogg") || extension.toLowerCase().equals("wav");
}
@Override
public String getBundleName (String file) {
return "assets";
}
}