com.badlogic.gdx.utils.GdxNativesLoader Java Examples

The following examples show how to use com.badlogic.gdx.utils.GdxNativesLoader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AndroidContextTest.java    From gdx-fireapp with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
    PowerMockito.mockStatic(GdxNativesLoader.class);
    AndroidApplication application = PowerMockito.mock(AndroidApplication.class);
    Mockito.when(application.getType()).thenReturn(Application.ApplicationType.Android);
    Gdx.app = application;
    PowerMockito.mockStatic(Timer.class);
    PowerMockito.when(Timer.post(any(Timer.Task.class))).then(new Answer() {
        @Override
        public Object answer(InvocationOnMock invocation) {
            ((Timer.Task) invocation.getArgument(0)).run();
            return null;
        }
    });
    GdxFIRApp.setThrowFailureByDefault(false);
}
 
Example #2
Source File: AndroidLauncher.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
@SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	try {
		GdxNativesLoader.load();
		FreeType.initFreeType();
		
		Intent intent = new Intent(this, AndroidGame.class);
		startActivity(intent);
		finish();
	} catch (Exception e){
		TextView text = new TextView(this);
		text.setText("Shattered Pixel Dungeon cannot start because some of its code is missing!\n\n" +
				"This usually happens when the Google Play version of the game is installed from somewhere outside of Google Play.\n\n" +
				"If you're unsure of how to fix this, please email the developer ([email protected]), and include this error message:\n\n" +
				e.getMessage());
		text.setTextSize(16);
		text.setTextColor(0xFFFFFFFF);
		text.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/pixel_font.ttf"));
		text.setGravity(Gravity.CENTER_VERTICAL);
		text.setPadding(10, 10, 10, 10);
		setContentView(text);
	}
}
 
Example #3
Source File: TmxObjectsLoader.java    From RuinsOfRevenge with MIT License 5 votes vote down vote up
public static void main(String... args) throws IOException {
	GdxNativesLoader.load();
	Physics physics = new Physics(Vector2.Zero, true);
	File mapfile = new File("data/maps/newmap/map005.tmx");
	Element mapXML = new XmlReader().parse(new FileInputStream(mapfile));
	System.out.println(mapXML);

	new TmxObjectsLoader(mapXML)
		.loadToPhysics(physics, 32, 32, 50, 50);
}