Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Auto-Generated Libgdx Code And One Other Thing  (Read 2305 times)
0 Members and 1 Guest are viewing this topic.
Offline tyeeeee1
« Posted 2013-06-16 02:53:11 »

I just installed lbgdx or however the abbreviation goes and I have two questions. The first is, does lbgdx work like lwjgl and stuff like that where I just add them to the project and start using the classes right away? The second is, do I need to keep the code below that was auto-generated when I ran gdx-setup-ui.jar?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
/*******************************************************************************
 * 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.
 ******************************************************************************/


package com.badlogic.gdx.utils;

import com.badlogic.gdx.jnigen.AntScriptGenerator;
import com.badlogic.gdx.jnigen.BuildConfig;
import com.badlogic.gdx.jnigen.BuildExecutor;
import com.badlogic.gdx.jnigen.BuildTarget;
import com.badlogic.gdx.jnigen.BuildTarget.TargetOs;
import com.badlogic.gdx.jnigen.NativeCodeGenerator;

/** Builds the JNI wrappers via gdx-jnigen.
 * @author mzechner */

public class GdxBuild {
   public static void main (String[] args) throws Exception {
      String JNI_DIR = "jni";
      String LIBS_DIR = "libs";

      // generate C/C++ code
     new NativeCodeGenerator().generate("src", "bin", JNI_DIR, new String[] {"**/*"}, null);

      // generate build scripts, for win32 only
     // custom target for testing purposes
     BuildTarget win32home = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
      win32home.compilerPrefix = "";
      win32home.buildFileName = "build-windows32home.xml";
      win32home.excludeFromMasterBuildFile = true;
      BuildTarget win32 = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
      BuildTarget win64 = BuildTarget.newDefaultTarget(TargetOs.Windows, true);
      BuildTarget lin32 = BuildTarget.newDefaultTarget(TargetOs.Linux, false);
      BuildTarget lin64 = BuildTarget.newDefaultTarget(TargetOs.Linux, true);
      BuildTarget android = BuildTarget.newDefaultTarget(TargetOs.Android, false);
      BuildTarget mac = BuildTarget.newDefaultTarget(TargetOs.MacOsX, false);
      new AntScriptGenerator().generate(new BuildConfig("gdx", "../target/native", LIBS_DIR, JNI_DIR), mac, win32home, win32,
         win64, lin32, lin64, android);

      // build natives
     // BuildExecutor.executeAnt("jni/build-windows32home.xml", "-v");
     // BuildExecutor.executeAnt("jni/build.xml", "pack-natives -v");
  }
}


It gave me a compile error right off the bat so I was just about to get rid of it but then I thought to ask first. The error it gave is below if anyone was wondering.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
Exception in thread "main" java.lang.NoClassDefFoundError: com/badlogic/gdx/jnigen/NativeCodeGenerator
   at com.badlogic.gdx.utils.GdxBuild.main(GdxBuild.java:34)
Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.jnigen.NativeCodeGenerator
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 1 more


PS: What's with these topic title restrictions? I had to change my topic title three different times just to post this, the title looks ridiculous now.
Offline badlogicgames
« Reply #1 - Posted 2013-06-16 10:37:58 »

Erm, the setup ui doesnot generate this file at all.

http://www.badlogicgames.com - musings on Android and Java game development
Offline tyeeeee1
« Reply #2 - Posted 2013-06-16 14:38:30 »

Erm, the setup ui doesnot generate this file at all.

Yep, it did. I created a new project following the steps on the libgdx site and this is what was inside of the main class that it generated.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline badlogicgames
« Reply #3 - Posted 2013-06-16 15:11:57 »

I wrote that stuff, i'm pretty sure i know what it generates. You must have introduced an error somewhere along the steps.

http://www.badlogicgames.com - musings on Android and Java game development
Offline davedes
« Reply #4 - Posted 2013-06-16 15:20:23 »

You are probably trying to run the GdxBuild class, which is likely somewhere in your class path.

If you want to run the desktop project, you should right click it (i.e. "myproject-desktop") and click "Run" -- you might need to specify the target in "Run Configurations." Your target should be the Main class in your desktop project.

If you only plan on targeting desktop (i.e. no desire to use Android/iOS), you can just follow these steps:
http://www.java-gaming.org/topics/libgdx-how-do-i-load-local-assets-without-an-android-project/29148/msg/266799/view.html#msg266799

Offline tyeeeee1
« Reply #5 - Posted 2013-06-16 16:27:29 »

If you only plan on targeting desktop (i.e. no desire to use Android/iOS), you can just follow these steps:
http://www.java-gaming.org/topics/libgdx-how-do-i-load-local-assets-without-an-android-project/29148/msg/266799/view.html#msg266799

Thanks, that worked. ^.^ Time to go figure out how to use libgdx now!
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (16 views)
2014-08-28 18:26:30

CopyableCougar4 (25 views)
2014-08-22 19:31:30

atombrot (38 views)
2014-08-19 09:29:53

Tekkerue (34 views)
2014-08-16 06:45:27

Tekkerue (32 views)
2014-08-16 06:22:17

Tekkerue (20 views)
2014-08-16 06:20:21

Tekkerue (31 views)
2014-08-16 06:12:11

Rayexar (66 views)
2014-08-11 02:49:23

BurntPizza (44 views)
2014-08-09 21:09:32

BurntPizza (34 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!