w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Setting up libgdx in IntelliJ Idea with GWT Support?
I was able to make GWT work with libgdx simply by: downloading (http://www.gwtproject.org/download.html) the GWT SDK, extracting it, then in the project structure -> project-name-html -> dependencies, just press the + and add the extracted GWT directory A dialog appears and I just unticked all the samples The "Dependencies Storage Format" needed to be "Intellij IDEA", not Eclipse for this to work for me.

Categories : Gwt

How to monitor Pipeline stages in OmniThreadLibrary?
Use Parallel.TaskConfig.OnMessage and provide a common message processing function. FPipeline := Parallel.Pipeline() .Stage(StageWorker1, Parallel.TaskConfig.OnMessage(MessageProc)) .NumTasks(MaxReadThreadCount) .Stage(StageWorker2, Parallel.TaskConfig.OnMessage(MessageProc)) .Run(); procedure MessageProc(var msg: TOmniMessage); begin ... end; MessageProc can be a normal procedure or a method.

Categories : Delphi

Hadoop - weight of reduce stages
I think one way to achieve this could be to monitor the total time taken by the task and time taken by Shuffle and Sort phases. You could use the following methods provided by TaskStatus class to find that : getStartTime() : Get start time of the task. getFinishTime() : Get task finish time. if shuffleFinishTime and sortFinishTime are not set before, these are set to finishTime. It takes care of the case when shuffle, sort and finish are completed with in the heartbeat interval and are not reported separately. if task state is TaskStatus.FAILED then finish time represents when the task failed. getShuffleFinishTime() : Get shuffle finish time for the task. If shuffle finish time was not set due to shuffle/sort/finish phases ending within same heartbeat interval, it is set to finish time

Categories : Hadoop

Action Script 3. Multiple stages are like 1
Use external libraries for your purposes, like this one. Here is described, how to use it (you can find there also other useful informations). import com.coreyoneil.collision.CollisionList; var myCollisionList:CollisionList = new CollisionList(hero); //add all stages separately myCollisionList.addItem(stage[1...n]); if(myCollisionList.checkCollisions().length > 0) { //colision detected }

Categories : Actionscript

Image mask animation in two stages – possible with jQuery?
This method will only use jQuery animations and CSS. You can simply have two divs on top of the one that has the background image. Set their initial width to zero and when the page loads, animate the width of the first one. Then use the callback function of that animation to animate the width of the second (the topmost) one. To get the blurry effect - set the transparent blur gradient as an image or as another div background with height 100% and background repeating on Y axis. Do this for each of the two layer divs. They need to have higher z-index than the layer divs. And lastly the guitars: they can be just the background images of each of the two layer divs, or even images, it's up to you. Just don't forget to make the top layer have a bigger z-index. To clear it up, here is the pse

Categories : Jquery

Does setting "idea.jars.nocopy" in idea.properites have any negative impact?
This will reduce the disk usage, but the locking can occur (you will not be able to replace the jar files in the project when the application or IntelliJ IDEA is running). If you don't plan replacing the jars and locking doesn't break your workflow, feel free to set this option to true. Mac/Linux users do not have the locking issue, it's Windows specific.

Categories : Maven

Software Testing at the Earlier Stages of Development Cycle
One point made in the first article should be expanded upon, in light of the following management adage: Management gets what management monitors. "Quality is built-in, not added on." is from the article. The same could be said for security, performance, reliability, reusability and portability, but, unlike quality, those can be tested for. If any of those attributes of a project are important for management, then they should be monitored from the get go. In terms of project management, establishing your test scaffolding early also sets expectations of your project team early -- when you add stuff, you add regression tests for that stuff. Parenthetical note about performance testing: It is important not to optimize too early. However, if you don't know what your baseline is, or even if

Categories : Testing

Stepper to Modify A Date. Bad Idea or Good Idea?
A better approach would be to use a standard UIDatePicker and then configure it with minimumDate, maximumDate, minuteInterval if you need time, datePickerMode of UIDatePickerModeDate if you don't need a time.

Categories : IOS

TestNG with IntelliJ IDEA: How to use the testng.xml file in IntelliJ IDEA 9
Follow this link - http://www.jetbrains.com/idea/webhelp/run-debug-configuration-testng.html#config There is an option just before the run icon that allows you to add the testng.xml file. In the run config dialog select the suite option. Then select the testng file. It worked for me. Hope it helps.

Categories : Java

How to use LIBGDX TexturePacker2?
Your way is outdate for tmxFiles. There is no TiledAtlas anymore. In case you use an older version just use the regular TmxMapLoader without packing your grafics. Here is a simple example how to load a Tilemap: TmxMapLoader load = new TmxMapLoader(); TiledMap map = load.load("path/to/file"); You can even combine it with an Assetmanager: assetmanager.setLoader(TiledMap.class, new TmxMapLoader( new InternalFileHandleResolver())); Please take a look to the answer i made at this question to get more information about the texture stuf where it need to be and how you can change the filepath inside of the .tmx and so on: tmxmaploader-to-use-packed-tileset

Categories : Java

LIBGDX 3D not working
Looking at you code you never construct (and dispose) the modelBatch instance. Therefor the modelBatch will be null, causing the NPE you got. Add the following line in your create method: modelBatch = new ModelBatch(); and the following line in your dispose method: modelBatch.dispose();

Categories : Java

LibGDX and Admob: I don't see the ads
You are adding the gameview after the ad view. Also for better control, better do it like this: https://code.google.com/p/libgdx/wiki/AdMobInLibgdx

Categories : Java

Drop down in Libgdx
Right...from your question (and the following comments) it's not really clear to me what your issue is. However here (because maybe it helps you) an outline of how your drop-down menus are supposed to be looking: // Set up the SelectionBox with content Object[] blob = new Object[2]; blob[0] = new Label("Some random text that", skin); blob[1] = new Label("isn't being displayed!", skin); final SelectBox<Object> sb = new SelectBox<Object>(skin); sb.setItems(blob); //For easier handling of Widgets Table table = new Table(); table.setFillParent(true); table.center(); table.add(sb); stage.addActor(table); This will display the list of OBJECTS. If you wanted the actual contents of the TextFields you would have to create a SelectionBox of Strings, then fill it with the actu

Categories : Java

3d triangle in libgdx
Found a solution here : http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=10583&p=47800#p47800 That ImmediateModeRenderer20 gives a temporary way to create 3D meshes, including triangles. It really seems that the libgdx Mesh class is only for 2D...

Categories : Java

Libgdx MainMenuScreen
MainMenuScreen is not a standard-class, if you read further in the tutorial you have linked you see that they created an additional class "MainMenuScreen", just create another class named "MainMenuScreen" and add the code from the tutorial there. If this is your first time with java you might want to google some java tutorials to the learn the fundementals of java and oop first before you use some external libraries ;)

Categories : Java

NullPointerException? Not sure why. LIBGDX
Move this to your constructor: modelBatch = new ModelBatch(); lights = new Lights(); lights.ambientLight.set(0.4f, 0.4f, 0.4f, 1f); lights.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f)); cam = new PerspectiveCamera(70, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.position.set(10f, 10f, 10f); cam.lookAt(0, 0, 0); cam.near = 0.1f; cam.far = 300f; cam.update(); ModelBuilder modelBuilder = new ModelBuilder(); model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position | Usage.Normal); instance = new ModelInstance(model); like: public Loading(boolean AP, Chemistry chemistry) { this.AP = AP; this.chemistry = chemistry; //here }

Categories : Java

Libgdx: screen managaer
I see a few things which are concerning, but first I will focus on the issue at hand: private static int time = 0; You are using a static variable in your screens and only seem to reset them to 0 when you press a button on the MainMenuScreen. This means the next time you display the screen, the value will result in a screen switch and it will flip back and forth forever (and cause a lot of lag). Other issues: You are storing a considerable amount of static state in your code, this is really frowned upon. Here is a good post (refer to section on implications) which talks about issues related to it. Most programming guides would advise against it. Consider looking into better variable names, or even using arrays instead of numbering variables. It will simplify your code and make it mor

Categories : Android

Libgdx: Save and Load
I modeled my game persistence after this tutorial, its working well for me. Check it out. It persists files in JSON format, and encodes the string into base-64 giving a bit of obscurity if anyone tries to alter your game files.

Categories : Java

Playing animated gif with libgdx
Update: There is a solution to this problem: http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=10351&p=46673#p46673 Looks like there is no direct way to play animated gifs in libgdx.

Categories : Android

Can't centralize animation (libGdx)
For x position, you have- Gdx.graphics.getWidth() / 2 - ((walkSheet.getWidth()/FRAME_COLS) / 2) If each animation image is 100px wide, why don't you use- private static final float WALK_ANIM_WIDTH = 100f; X position would be then - Gdx.graphics.getWidth() / 2f - WALK_ANIM_WIDTH / 2f UPDATE: Based from your comment, you can have something like- public static final int SCREEN_WIDTH = 800; public static final int SCREEN_HEIGHT = 520; guiCam = new OrthographicCamera(SCREEN_WIDTH, SCREEN_HEIGHT); guiCam.position.set(SCREEN_WIDTH / 2f, SCREEN_HEIGHT / 2f, 0); Now rather than using "Gdx.graphics.getWidth()", you can simply use SCREEN_WIDTH. Take a look at the SuperJumper demo in libGDX. You will see how they used the viewport in game world.

Categories : Java

Background transparency in libgdx
Think it this way - transparency is visible when you have at least two things. If you have a black background and then draw a white one on top of it with transparency say 50%, you will see black background through your white layer. Now, at the start you have the screen. It can be of any color. Under that screen, there's nothing. So, if you need transparency, draw something on top of it with alpha channel.

Categories : Android

Rotate TextButton with libgdx
The rotation methods on existing Actors should work. Probably worth asking another question to track that issue down. I see at least two problems: the default batch transorm matrix probably isn't the identity matrix. Maybe initialize rotationMatrix as a copy of oldMatrix? You're rotating around a really arbitrary vector (draw a line from the origin -- in the bottom left to the top-left corner of your button). Try Vector3(0, 1, 0).

Categories : Android

Drag And Drop LibGDX
You're setting the origin in your listener callback to a screen coordinate. That is not going to work. The origin is used to define the "center" of your object, so when you reposition it, Libgdx knows which part of the actor to put where. Generally the origin is either the bottom left corner of the object (I think this is the default) or its the center of the object. I guess you may want to reset the origin so if someone taps on the left edge of a brick and then you reposition the object you'll reposition that point on the brick (and not reposition the bottom left corner of the brick). To do that you'll need to convert the screen coordinates into coordinates in the actor's space. That's all somewhat icky though. I think you'd be better off just doing relative repositioning. Instead

Categories : Java

Split-Screen in LibGDX
After asking around a bit on the #libgdx IRC, the function Gdx.gl.glViewport( int x, int y, int width, int height ) was pointed out to me. So you only need one camera. Just set the viewport for the left side of the screen then perform your drawing commands, then set up the viewport for the right side of the screen and draw again. like so: @Override public void render( float delta ) { /*Wipe Screen to black*/ Gdx.gl.glClearColor( Color.BLACK ); Gdx.gl.glClear( GL10.GL_COLOR_BUFFER_BIT ); /*Left Half*/ Gdx.gl.glViewport( 0,0,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() ); //Set up camera with viewport in mind draw( delta ); /*Right Half*/ Gdx.gl.glViewport( Gdx.graphics.getWidth()/2,0,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() ); //Set

Categories : Java

Libgdx: how to implement a dialog?
My modal dialog worked using another stage. When I wanted to show it, I changed the InputProcessor to my dialogs internal stage so other GUI objects couldn't respond to user input outside the dialog. I found LIBGDX's dialogs overkill for my purposes. Perhaps you need a skin for your dialog? If not I'd just go with my approach. You could always use a texture atlas instead. It can function much like a skin as strings are used to reference regions of an image.

Categories : Java

How do I Integrate RevMob with LibGdx
Try to create a Interface in the main LibGDX project and implement it in your android Project like this.... import android.content.Context; import android.util.Log; import com.revmob.RevMob; import com.revmob.RevMobAdsListener; import com.revmob.ads.fullscreen.RevMobFullscreen; public class RevMobDisplay implements AdInterface{ public RevMobAdsListener listener; private RevMobFullscreen fullscreen; private MainActivity activity; private RevMob revmob; public RevMobDisplay(MainActivity mainActivity){ this.activity = mainActivity; revmob = RevMob.start(activity); //UNCOMMENT THIS CODE AFTER YOU HAVE PUBLISHED YOUR GAME LIVE //USE WHILE TESTING YOUR GAME DURING DEVELOPMENT revmob.setTestingMode(RevMobTesti

Categories : Android

Use only a Fragment Shader in libGDX?
When it comes to shaders in modern OpenGL you always have to supply at least a vertex and a fragment shader. OpenGL-2 gave you some leeway, at the drawback, that you then still have to struggle with the arcane fixed function state machine. That, according to the internet, is the simplest possible VS: it does nothing, and it really shouldn't. What makes you think it does "nothing". Of course it does something: It translates incoming, raw numbers into something sensible, namely vertices in clip space.

Categories : Opengl

UnsatisfiedLinkError Libgdx Desktop
I'd advise you to setup your projects with this GUI. It should provide you with a valid setup for all platforms. You may also use the latest nightly builds and check if the problem still occurs. The problem might be that the native libraries do not match the other jars. Another problem might be that you instantiate a SpriteBatch (or something else which internally uses a SpriteBatch) too early (looked a bit like this in the stacktrace). For example statically like this: private static SpriteBatch batch = new SpriteBatch(); This won't work, since libgdx wasn't setup correctly at this point in time. Instead, create such things in the create/show methods of your game.

Categories : Java

Can native C programs be used in LibGDX?
To be clear, I believe you have an app written in Java that uses Libgdx currently, and you would like to extend that app by including a C library and making calls out to the C library from the Java application. Libgdx does not provide any special support for third-party libraries, native or Java. You will have to use the backend platform's APIs to call out to native code (JNI, NDK, etc). You should be able to add your library to the Android and Desktop backend projects, and access it via a Platform Interface. It is probably not possible to use the GWT-backend (unless you have a C to Javascript compiler). For iOS you would need to build your library for iOS, and then figure out how to link it into the Xamarin (or robovm) build process for your app. While I'm going to assume this is po

Categories : C

GestureDetector and InputListener in libgdx
while using any of following classes (GestureDetector or InputProcessor) if you return true from its functions then it doesn't check any other processor attached to your game.. in your code you have added stage first then your gesture Detector if at a time your stage is working and processing inputs and returning true then your gesture detector won't get calls of various functions. If you want both your stage and gesture detector to work then never return true from any of the function in your gesture listener and stage InputMultiplexer multiplexer = new InputMultiplexer(); multiplexer.addProcessor(new MyUiInputProcessor()); multiplexer.addProcessor(new MyGameInputProcessor()); Gdx.input.setInputProcessor(multiplexer); The InputMultiplexer will hand any new events to the first I

Categories : Java

Using scene2d.ui with libgdx: where does the skin come from?
To load a skin, you can start with the sample skin files used in the libgdx test project. Atlaspack File Json File Atlaspack Image Font File There's a bit more detail in this question, and I found that I had to move the files into a subdirectory of assets to avoid a bug in the HTML version. (If I leave files in the assets folder, I see an error message like, "GwtApplication: exception: Error reading file data/uiskin.json.") I posted a complete example that displays a single button, and the interesting code is all in the game class. The example is so simple that you only need two member variables to hold the scene and the button. private Stage stage; private TextButton button; To create the skin, you just load the data file. Skin skin = new Skin(Gdx.files.internal("data/uiskin.json

Categories : Java

LibGDX/Box2D UnsatisfiedLinkError
You may want to try GdxNativesLoader.load();. Do it in a static manner, i.e. when JVM loads the class: static { GdxNativesLoader.load(); } Apparently, the link error happens when your code or java library invokes some native code.

Categories : Java

libgdx 0.9.8, can't run Particle Editor
It seems the jar file is missing the assets content from: https://github.com/libgdx/libgdx/tree/master/extensions/gdx-tools/assets The issue seems to be fixed in nightly build. Just in case you still need 0.9.8, you may unjar the gdx-tools.jar, download and copy all the files to right under the root folder of the jar file and re-jar it.

Categories : Java

Why does my sprite flash in LibGDX?
this goes in your render method: batch.begin(); mainMenu.draw(batch); batch.end(); Render is the method that is constantly called, show is only called once when the screen is shown.

Categories : Java

LibGDX - Color Picker
Basically you would have an Image with the texture in your question, and detect touches/drags over it. Once you know the coordinates you're on, and having the Pixmap, you can know the color code with.- public int getPixel(int x, int y) Hope it helps.

Categories : Android

Cube maps in libgdx
http://searchcode.com/codesearch/view/37311049 I have finally found some source code which uses a cube map.It has no comments though It should be pretty easy to understand if you know opengl-es.

Categories : Android

How to port Libgdx to html5
http://libgdx.badlogicgames.com/nightlies/dist/gdx-setup-ui.jar download it and fill your project details... It will create android, html and desktop project to your specified directory. Import that to your eclipse and you are good to go.

Categories : HTML

How to get bitmap of whole screen with Libgdx?
https://code.google.com/p/libgdx-users/wiki/Screenshots This is how stuff works Do not forget to get PNG.java class also as main logic is in it only Also if u are using LibGdx 0.9.8 these classes are implicitly included in the gdx.jar

Categories : Android

getDrawingCache is not working for LibGdx
SurfaceView -- and, by extension, GLSurfaceView (which LibGDX uses) -- does not support getDrawingCache() because it does not draw within the normal view system. See this thread on Google Groups for an explanation: https://groups.google.com/forum/?fromgroups#!topic/android-platform/xHIActZZ9PA

Categories : Android

libgdx rendering a spite
The object of class WorldGeneration is not made. WorldGeneration wGenerate; @Override public void create() { wGenerate=new WorldGeneration(); wGenerate.createWorld(); }

Categories : Java



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.