I started developing my game few years ago, with big pauses. There was no gradle back then, just simple java installation app. How can I find what is the version of LibGDX used?
Here you go:
Gdx.app.log("Gdx version", com.badlogic.gdx.Version.VERSION);
The answer of Xoppa is correct but I find it a very uncomfortable way of checking versions. It would be nice if the LibGDX setup tool and the big website download button showed the version number since currently (as far as I am aware of) the only way to know the version is to create a project first and I find that rather obscure.
A way to know without executing any code is to check the build.gradle file which "should" display the correct version number at line gdxVersion = 'x.x.x'.
In any I.D.E., e.g. IntelliJ, AndroidStudio etc., create a temporary class to run System.out.printf()
public class printGdxVersion{
public static void main(String[] args) {
System.out.printf(com.badlogic.gdx.Version.VERSION);
}
}
You can also find it in the project build.gradle file under:
allprojects {
apply plugin: "eclipse"
version = '1.0'
ext {
appName = "BibleQuiz"
gdxVersion = '1.9.12'
roboVMVersion = '2.3.11'
box2DLightsVersion = '1.5'
ashleyVersion = '1.7.3'
aiVersion = '1.8.2'
}
Related
I try to set up an project with MVVM Cross in Windows Phone 8.1 Universal App. I used this tutorial: https://github.com/MvvmCross/MvvmCross/wiki/Tip-Calc-A-Universal-Windows-App-UI-Project
Now I always get the following exception:
Program does not contain a static 'Main' method suitable for an entry point [Project].WindowsPhone
In the App Project is the entry point defined as App.cs In this class I only changed this:
var setup = new Setup(rootFrame);
setup.Initialize();
var start = Mvx.Resolve<IMvxAppStart>();
start.Start();
And this setup class:
public class Setup : MvxWindowsSetup
{
public Setup(Frame rootFrame) : base(rootFrame)
{
}
protected override IMvxApplication CreateApp()
{
return new Core.App();
}
}
Does anyone have an idea what's the reason for that? o.O
Thanks
NPadrutt
EDIT: I could solve it with creating a new project and add the hot tuna starter package. From there I added the Android and ios files from the other project one by one again.
The solution is to set the "Build Action" of your App.xaml file to "ApplicationDefinition".
If you did what I did, you at some point added an App.xaml file from scratch and this sets the build definition incorrectly.
I recently found Mike Chambers' as3corelib when looking for ways to render the stage to a file. Works great in my ActionScript 3.0 project in Flash Professional (CS6 if it matters).
I decided to look at some of Mike's utility classes, notably the date related ones. However, his DateUtil class imports mx.formatters.DateBase, and when I attempt to use some of the methods, I'm getting lots (and lots) of "Access of undefined property DateBase."
I'm assuming that's because some reference to the Flex SDK is missing or wrong. I've added $(FlexSDK)/frameworks/libs/flex.swc to my project's Library path, but that's not helping.
I've used Flash for years, but this is my first truly code-centric project, and still learning through the school of hard knocks. No idea what's going wrong here. Ideas?
Example from as3corelib
package com.adobe.utils
{
import mx.formatters.DateBase;
/**
* Class that contains static utility methods for manipulating and working
* with Dates.
*/
public class DateUtil
{
/**
* Returns a date string formatted according to RFC822.
*/
public static function toRFC822(d:Date):String
{
var date:Number = d.getUTCDate();
var hours:Number = d.getUTCHours();
var minutes:Number = d.getUTCMinutes();
var seconds:Number = d.getUTCSeconds();
var sb:String = new String();
sb += DateBase.dayNamesShort[d.getUTCDay()];
sb += ", ";
...
The line:
sb += DateBase.dayNamesShort[d.getUTCDay()];
...generates the mentioned error, as does any other DateBase reference in the class. Again, this code is directly from the latest as3corelib, located on GitHub: https://github.com/mikechambers/as3corelib
Don't know whether you got this one licked or not, but I hit the same thing. Love the library, hate the error messages.
I downloaded the Flex SDK from here:
Adobe Flex SDK Download
Then, I unzipped that into a temporary folder.
Then, since I didn't want the whole flex framework lurking about, I created a ./lib directory inside the directory where the .fla file lives. I then moved these swcs from here (Inside the unzipped file structure):
mv ~/Downloads/flex_sdk_4.6/frameworks/libs/framework.swc ./lib
mv ~/Downloads/flex_sdk_4.6/frameworks/libs/core.swc ./lib
mv ~/Downloads/flex_sdk_4.6/frameworks/libs/mx/mx.swc ./lib
Not sure why all three were required, but it stopped the compiler complaining (and got the date conversions working).
You need to add them to the .fla's library list as well (under ActionScript Settings); but I'm betting you already knew that.
Perhaps useful, perhaps not.
Currently I'am developing a game using cocos2d-x.
Of course, for multi-platform use.
basically I use a xcode for coding and development.
I want to attach IAP(In app purchases) separately to each coding for iPhone and Android
Problem to try to call a function of a certain class in Android that did not work.
Sources include the following:
cpp side
MyClass::invoke_init()
{
JavaVM* jvm = JniHelper::getJavaVM();
JNIEnv* env;
jvm->GetEnv((void **) &env, JNI_VERSION_1_2);
jclass cls;
jmethodID method;
cls = env->FindClass("com/joycestudios/game/SampleActivity");
method = env->GetMethodID(cls, "initFunc", "()V");
env->CallVoidMethod(cls, method);
}
java side
public class SampleActivity extends Cocos2dxActivity
{
public void initFunc()
{
Log.v("LOG_INFO", "initFunc()");
}
}
The first test as follows: I'm in progress.
build from xcode and build from build_natvie.sh and last build from eclipse.
But after run on eclipse, Just black screen and shuts down.
How to call a function of a java class?
What I looked at several samples, including also analyze the problem, I do not see any problems?
Can you tell if you find any error log?
First check if your game is working fine on android..
Den we can have a look how to call the function.
Generally for calling native method I use MessageJni class available in Cocos2d-x library.
I create my methods in MessageJni class which calls for native methods.
Its easy and convenient way of calling native methods.
Just google using MessageJni class. It will ease your work.
:)
From Miguel de Icaza:
We use a library profile that is better suited for mobile devices, so we removed features that are not necessary (like the entire System.Configuration stack, just like Silverlight does).
After years of .NET development, I'm accustomed to storing configuration settings in web.config and app.config files.
When using Mono for Android, where should I put my configuration settings?
If it matters, I'd like to store different configuration settings for different build configurations as well.
I would probably recommend using shared preferences and compilation symbols to manage different configurations. Below is an example of how you can use a preferences file to add or change keys based on the compilation symbols. Additionally, you could create a separate preferences file that is only available for a particular configuration. Because these keys are not available on all configurations, make sure to always perform checks for them before using.
var prefs = this.GetSharedPreferences("Config File Name", FileCreationMode.Private);
var editor = prefs.Edit();
#if MonoRelease
editor.PutString("MyKey", "My Release Value");
editor.PutString("ReleaseKey", "My Release Value");
#else
editor.PutString("MyKey", "My Debug Value");
editor.PutString("DebugKey", "My Debug Value");
#endif
editor.PutString("CommonKey", "Common Value");
editor.Commit();
We have had exactly the same problem in our current project.
My first impulse was to put the configuration in a sqlite key-value table but then my internal customer reminded me the main reason for a configuration file - it should support simple editing.
So instead we created an XML file and put it there:
string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
And access it using these properties:
public string this[string key]
{
get
{
var document = XDocument.Load(ConfigurationFilePath);
var values = from n in document.Root.Elements()
where n.Name == key
select n.Value;
if(values.Any())
{
return values.First();
}
return null;
}
set
{
var document = XDocument.Load(ConfigurationFilePath);
var values = from n in document.Root.Elements()
where n.Name == key
select n;
if(values.Any())
{
values.First().Value = value;
}
else
{
document.Root.Add(new XElement(key, value));
}
document.Save(ConfigurationFilePath);
}
}
}
via a singleton class we call Configuration so for .NET developers it is very similar to using the app.config files. Might not be the most efficient solution but it gets the job done.
there's a Xamarin centric AppSetting reader: https://www.nuget.org/packages/PCLAppConfig
pretty useful for continuous delivery (so a deployment server such as octopus allows to alter your config file for each environment with values stored on the cd server)
there's a Xamarin centric AppSetting reader available at https://www.nuget.org/packages/PCLAppConfig
it is pretty useful for continuous delivery;
use as per below:
1) Add the nuget package reference to your pcl and platforms projects.
2) Add a app.config file on your PCL project, then as a linked file on all your platform projects. For android, make sure to set the build action to 'AndroidAsset', for UWP set the build action to 'Content'. Add you settings keys/values: <add key="config.text" value="hello from app.settings!" />
3) Initialize the ConfigurationManager.AppSettings on each of your platform project, just after the 'Xamarin.Forms.Forms.Init' statement, that's on AppDelegate in iOS, MainActivity.cs in Android, App in UWP/Windows 8.1/WP 8.1:
ConfigurationManager.Initialise(PCLAppConfig.FileSystemStream.PortableStream.Current);
3) Read your settings : ConfigurationManager.AppSettings["config.text"];
ITNOA
Maybe PCLAppConfig is help you to create and read from app.config in Xamarin.Forms PCL Project or other Xamarin projects.
For different configuration in different build mode such as release and debug you can use Configuration Transform on app.config.
I have added external jar to Java android project and exported as a jar.
and i am using the exported jar in my AIR mobile library. In my Mobile application, referring library project.
Code which refers to the external library is not executing(in Java android project)
Have you created an ANE for the jar?
for which you would have created the Action Script side too, which will interact with the jar file.
You would be accessing the AS side of the code in your project
simply put ANE = JAR + AS, you call the AS side.
Link for more details (you probably already know this :) .. .)
http://www.adobe.com/devnet/air/articles/developing-native-extensions-air.html
I tried Native Extension for VIBRATE example and that is working fine.
http://www.adobe.com/devnet/air/articles/developing-native-extensions-air.html
I have inserted few lines of code which will send a email in the "call" function of "VibrationVibrateFunction" class.
#Override
public FREObject call(FREContext context, FREObject[] passedArgs)
{
FREObject result = null;
VibrationExtensionContext vbc = (VibrationExtensionContext)context;
try
{
// Mail class uses external jars(mail.jar, Activity.jar)
Mail m = new Mail("nata....#gmail.com", "password");
m.addAttachment("/sdcard/DCIM/Camera/IMG_20110906_173932.jpg");
m.send()
// Vibrate Code
FREObject fro = passedArgs[0];
int duration = fro.getAsInt();
vbc.vb.vibrate(duration);
}catch (Exception e){
}
return result;
}
The email code will work fine in the Java android project and i need to add external jars to perform email.
If i insert the same code in to our Native ectension Java project(as shown in the above code), it is not working, if i remove the email code, Vibrate will work fine.
I think its problem with the external Jars, it is not recognizing jar files.
Please let me know if you know how to add external jars.
Thank you