I'm using the android version of cocos2d located here:
https://github.com/ZhouWeikuan/cocos2d
I'm an iPhone guy checking out android who already has familiarity with cocos2d iPhone. Ideally i would be able to create the particle from a plist file in the package/bundle. I can't seem to even get the "premade" default style particles working ie CCParticleFireworks (I've only tried in the simulator though). I was disappointed that there is very little sample code out there for cocos2d android so if anyone has a good resource on this I would be interested as well. I'm just learning java as well so it may be something simple just looking for some code snippet I can use basically.
The behavior im seeing with all my attempts is just a crash as soon as i try to instantiate and add the particle to the scene. I'm not too great at debugging in eclise either so i can't say exactly when the app is dying. sorry. I'm trying to suck less. I'd put my code in but ive tried it a bunch of different ways and I don't want to look like an ass. but here goes anyway, so here's how i think it should work:
public boolean ccTouchesBegan(MotionEvent event)
{
CGPoint location = CCDirector.sharedDirector().convertToGL(CGPoint.ccp(event.getX(), event.getY()));
CCParticleSystem part = CCParticleSystem.particleWithFile("0.plist");
part.setPosition(location.x, location.y);
addChild(part);
return true;
}
0.plist is in my assets folder, i feel like i need to turn this into a hash or something. also i feel there might be a problem with the ccparticlesystem vs ccpointparticlesystem vs ccquadParticleSystem.
You should try WiEngine . It is the Best Cocos2d java android port. Cocos2d-android don't even have 3d implemented. The classes are there but empty. Also check Wiengine's api Demo from the android market
Last time I checked with the author he mentioned that scene transition, grid actions, and particle systems on cocos2d-android-1's 3D are flawed.
I would recommend trying cocos2d-x if you have cocos2d-iphone code to port or coding your own thing extending View.
Related
I'm currently building a small game for Android using LibGdx in Android Studio. In the game the player uses the on-screen keyboard to enter different letters one by one.
My problem is that the autocomplete is one (since I use it when I'm texting) and this forces the player to click the "suggestion box" after every typed letter to actually make sure that the keyboard press and character input is registered. Since the input in my game should be one letter at a time I don't want autocomplete to try to "guess"/create a word.
I'm using the InputProcessor class with the "keyTyped(char character)" function. If I turn of the auto complete in phone settings (manually before starting the game) the input is registered and the correct character is passed in.
So, my question is if there is any way to turn off/toggle autocomplete programmatically?
Thanks in advance!
I realise this is old but if you or anyone else is looking for a way to do this then I have a solution. I built a completely new method for Android soft keyboard input to tackle the issues involved with the current libgdx methods. I am surprised to read auto-complete was actually working for you, because on all my testing devices it does not, and this is one of the problems I have attempted to solve.
I have built a sample project for people to work with that allows for much more reliable input using the Android soft keyboard, this includes swype, auto-correct, dictionary, etc. What you may be interested in is I have also included some customisation for the keyboard, such as the ability to disable auto-complete and suggestions. You would simply customise your TextFieldStyle with;
textFieldStyle.androidKeyboardAutoCorrect = false;
textFieldStyle.androidKeyboardTextSuggestions = false;
As of posting, no one has used this sample project and I have only tested on a few devices, so it may be a little erroneous. I will carry on maintaining it when/if feedback is received.
You can find it on Github here (source and executable apk)
If you have any comments/feedback please refer to Github or the badlogic forum topic
Hope this helps!
I'm looking to create an interface similar to that of the iPhone's SMS screen. More specifically I'm looking to replicate the "bubbles" coming from each side of the page which contain the messages, as shown here http://www.bidslammer.com/images/iphone_shot1.png .
I do also want to recreate the date and time above the bubbles like you can see in that image. I need to be able to do this by code because its use will be to display the messages that it receives over my socket connection, and show the messages I send over the socket.
I'm really new to Java, and even newer to Swing, so I'm looking for some pointers on how I should go about this.
Can anyone offer my any suggestions about how I would go about doing this? I'm not looking for someone to do the work for me, just a few pointers, perhaps some things I should learn how to use/do and perhaps a helpful tutorial or two.
Google for "swing tutorial" gives a lot of tutorial links, so just pick one. When I was learning Swing I used original Java Swing tutorial.
As for some pointers, I think good idea is to use images to represent the bubbles - that will be the easiest. Inherit some basic component like JLabel or JPanel and override a drawing method - do a custom drawing. First draw the bubble image and then the text over it. This may help with image drawing.
Generally with custom component drawing you use Graphics class, which provides a lot of useful drawing methods.
The sticky notes demo might get you started in the right direction.
Even though that demo is a NetBeans platform module, the sticky note itself is a pure Swing component and should be usable without the platform.
In swing(GUI) application I used JButtons.
Now I need the same application in MIDP and I'm conuse...
I need Idea for what to use with and an example of how to use it and what kind of listener might possible fits.(Because I need to refresh the shown screen after every click on a button)
And one more question: I use Netbins with the simulator of cell-phone.The screen is very tiny,
so is there any way to make this screen larger,In case I need to show something too width?
Lets say,something like 11-15 buttons...
I don't think there's anything that's exactly equivalent to a JButton, but I think you could solve your problem by implementing a Command though. I found a lot of examples:
MIDP Programming with J2ME (This one is a bit long. It's actually an entire chapter from a book and the Command example starts on page 4.)
Enterprise J2ME: developing mobile Java applications (Also a book, but I linked to the relevant section.)
J2ME Programming (Part I) (I like the CommandProcessor.java code example in this one.)
Visual Mobile Designer Custom Components: Creating Login Screens
Add Command to MIDlet (This one has the shortest and clearest example code, but it unfortunately doesn't have a screen shot of the final result.)
And one more question: I use Netbins with the simulator of cell-phone.The screen is very tiny, so is there any way to make this screen larger,In case I need to show something too width? Lets say,something like 11-15 buttons...
There is a way to choose an emulator with larger size screen. Last time I checked, Netbeans documentation had instructions on how to do that.
Though, before doing so, I would recommend you to find out whether the real device you're targeting will have such a screen. Because if its screen will be as tiny as the default emulator then your UI might look totally different from what you designed with large size emulator.
Take for example 11-15 buttons you mention - do you expect real device to have screen large enough to display these conveniently for user?
I want to get some examples about the GUI of an slot machine written in java, I know that it's kind of specific thing, but i want to know if it's possible to do some animations with java swing, or something like that, greetings
It isn't a slot machine simulation, but you may find related features in this example.
Addendum: The example cited uses Unicode glyphs for variety, but another trick is to implement the Icon interface, which works nicely with some components. This example decorates a JButton for use in a game, while this example extends a child of JLabel to render a table.
This won't answer your question exactly (because I don't have a direct example), but I hope it at least tells you that it's certainly possible.
I've done some games using Java and Swing and such. None of them have been too heavy on the animations. Most of the animations I did happened through the Java 2D Graphics libraries, while more UI stuff happened through Swing.
For example, you can take all of the functionality of a JButton, but override the paintComponent(Graphics g) method to make it look however you want. This was really useful in past projects for me.
The most graphics-intensive Swing-related game I ever built was a "Who Wants to Be a Millionaire?" game. I used animations and graphics and sounds and everything, so I can assure you that it is possible, but it certainly isn't as easy as some other libraries might be.
If you decide to pursue this, I've found that Swing Hacks has some great tips on doing weird things with Swing. Although it isn't focused on gaming, I've found enough interesting things that you can do (Drag and Drop, a bunch of weird things) to make it a worthwhile purchase.
i wonder how you can make an advanced Android User interface where you can add for example a drag drop and more graphics options? is that by using OpenGl ?!
this is example of UI in iPhone Apps.
example 1
example 2
Thanks
Your examples just seem to be composed of a lot of nice images. Your first example looks pretty static and could probably be made from buttons with custom images and setting lots of backgrounds on your layout items. The second looks like you would need to make a custom Gallery and do a little more manipulation and composition of images so it might be worth your time to go a little lower level for performance.
Basically, you're looking at using a lot of images. You can make them work with existing widgets and components and get the functionality more easily, or you can use OpenGL ect. To get some more flexibility and performance at the cost of having to code all the functionality in yourself.
If you're looking at drag and drop this post points to the source for a ListView with some rudimentary drag and drop functionality.