Cocos2d-x: possible to use HTML (UIWebView)? - android

I'm trying out cocos2d-x and got to the point where I can build the Javascript samples for Android and run them inside a browser as well.
Now I want to create my own game, but coming from a HTML background, I'd rather use HTML tags with CSS than use Javascript to setup the user interface.
I've read about UIWebView which can display HTML-pages in an app, but I was wondering if anyone has ever done this in combination with Cocos2D-x ? And could this be transparent, to overlay a normal cocos2d-x screen in the app then?
If so, how could this be done?

You can use CCXWebview for that with Cocos2d-x. This extension is based on Cocos2d-x 2.0.4 and it seems to work also on Cocos2d-x 2.x with some modification.
However, if you want to use Cocos2d-x 3.0 for Android, you cannot use it because Cocos2d-x 3.0 uses NativeActivity, thus you cannot combine Android WebView on the Cocos2d-x screen.
EDITED
only problem is that I have little knowledge of Java or C++
... It would take me years to figure the Java and C++ things out :)
So why are you sticking to use Cocos2d-x??? Why don't you use Cocos2d-html5? It has same functionality as Cocos2d-x JavaScript binding and it uses HTML5 Canvas, so you can use DOM with it.
https://twitter.com/hyperandroid/status/311534580962295809 :
Cocoonjs can run Cocos2d-html5 games too.

Related

using loadUrl()

It's been a few years since I've tried to create an Android application and since everything has moved away from Eclipse and now onto AS my old templates no longer work. I'm looking for tutorials that allow me to use my own custom html, css and Jquery, seeing as stuff like super.loadUrl("file:///android_asset/www/index.html"); don't seem to work anymore.
Are there any links or anything anyone can provide to get me started on creating non java dependant application?
If you want to make an app without using java you can start learning ionic framework https://ionicframework.com/
You can also go through Apache Cordova. It allows you to use standard web technologies such as HTML5, CSS3, and JavaScript for cross-platform development and you can also go with Xamarin that uses C# for cross-platform development.
You can also go through this tutorial for better understanding and for start learning from fresh :
Ionic tutorial https://www.youtube.com/watch?v=0jamhGf-8ww&list=PLYxzS__5yYQljbuGjaeugpqs9U07gS5P5
Cordova Tutorial https://www.youtube.com/watch?v=kqWZuEpHoSw&list=PLReL099Y5nRd9BNsMZwXvTDeqnfRMiGJy
Hope this will be helpful!!

Is it possible to make an android app through android studio using html 5 code?

I have made a website using HTML5.
However, I'm trying to make the app using the CSS, JavaScript and HTML I used for the website. Is that somehow possible?
I must use Android Studio.
Nope, you can't do that.
Android Studio is based on Java (logic) and XML (design).
XML and CSS are a little bit similar. You have paddings and margins too.
However. Prepare yourself to put work into the project.
But why do you need an app when you can also show the same contents in a website that works on way more devices? You can also use a WebView to show your website in the app.
If it must be native and you can't use a WebView, just rebuilt the design, Check out the material design guidelines, stick to them and your app will be easy to use for the users and look awesome.
Links:
https://material.google.com/ (read through the components stuff)
https://design.google.com/icons/ (all icons)

Does Android Studio supports AngularJS for Android UI design?

I have a question about Android Studio: Does AS supports AngularJS code while designing XML files, e.g. for small animations or effects?
SUMMARY : NO
There is no way you can write Angular JS code while developing Android Native app. You can use Angular in a WebView (using js/html so), that's all.
AngularJS is a completely different technology than what is used in native Android apps. Native Android apps use Java and/or C for their code, which is compiled when you build the app. AngularJS is a framework for web development, running specifically on Javascript (a completely different technology than Java).
You can build apps without using native Java or C code, but there are tradeoffs. As noted in other answers, you can display webpage views as apps (using technologies like Cordova]), or use frameworks like React Native to write code in Javascript that then gets compiled to a native app. You could use AngluarJS in the webview instance, since it just displays a webpage, however not in something like React Native. I highly encourage you to check both of these (and other options) out, but keep in mind that they have their own limitations and tradeoffs – no one way is the "right" way to build an app.
In summary: No, AngularJS is a web technology, not a native app technology.
new answer = Yes... Sort of, you can do it with:
https://www.nativescript.org/
It translates javascript, angular and typescript code into native components!
Apparantly it's possible to use nativescript in Android Studio with:
https://docs.nativescript.org/runtimes/android/getting-started/hello-world
Android Does not support AngularJs. but still if you want to use you can use it in webview.

To code css using android native language

Actually i want to design my app through css and html and want to code that css generated elements throgh android code.
Like suppose i have created a button in css.Can i use my android native language to code that button?
Officialy, java is the development language for android. So, if we are being really strict, you should use whatever tools java and the android sdk give you to create and style your elements (you can read about it here). But of course, there's always more than one way of doing stuff, and thanks to the Adobe overlords, you might just have what you are asking for.
Phonegap is a highly powerful opensource framework that allows you to code you entire app using HTML, CSS and JavaScript. Once you are done coding, phonegap does its magic and generates the app for you, so you don't need to touch a single line of java code.
So, basically, I don't think there's a way of using CSS in pure native android code (if there is, please feel free to share). But if you really want to use it, Phonegap is the way to go (I've used it before, it's cool)

is there any high level GUI framework around for android sdk?

I am rewriting an Android project, and I am stucked and sucked at making the GUI look like the way I wanted it too. It is easily achievable using HTML and CSS, I have done it with PhoneGap, CSS, HTML, JS, but it is kind of slow, so I want to do it native using Java.
(My background is C++ and some web programming stuff)
What I have been encountered so far is that the default GUI builder is not really pretty and I feel frustated almost every the time using it. And people recommend droiddraw in few other questions in Stackoverflow, but it also not resulting in pretty GUI as well.
What I want to have is some flexibility like HTML and CSS and from that I can execute native code.
I believe I can achieve GUIs like from the Facebook or Twitter client easily with HTML and CSS, but if i m going to do native using the SDK, I think I'm gonna need something like 1 month just to do the GUI.
So the questions would be:
Is there any GUI framework for Android SDK ? (More high level then the provided one)
How to render HTML/CSS that allows executing native code on interaction with its element.
Any suggestions welcome for any workflow.
And of course, Open Source solutions are preferable.
There are some projects for some iphone like widgets in android. You can find them seperately mostly in github, so I have not even seen a complete higher level widget library yet. But you can give appcelerator a try. You are writing html,css,js and it compiles to native code. I personally did not used it. It is a free software. Some people are happy with it, and some are not. You should read some experiences before beginning development. http://www.appcelerator.com/

Categories

Resources