Upload
satoshi-takami
View
10.351
Download
0
Embed Size (px)
Citation preview
Biographi
•@tikemin
•えすあいあー
• JJUGとは今年の4月から
•本格的にJava始めたのもそのぐらい
•Bio:Web/Embedded/Robo
もの作りが趣味13年11月9日土曜日
What is RoboVM
•Compiler translates Java bytecode into native ARM or x86 code
•RoboVM 0.0.6
•Niklas Therning(@robovm)
•Apache License v2.0•Alpha software
Java Translator13年11月9日土曜日
iOS app development according to java
J2ObjC
• An open-source command-line tool from Google• Translator tool Java code to Objective-C for the iOS platform• Does not provide any sort of platform-independent UI toolkitApps that use J2ObjC
13年11月9日土曜日
What is RoboVM
•Warning! RoboVM is alpha software. It's not yet ready for production use. Expect to be bitten by bugs. If you find a bug, please report it.
• It is not enough to use for iOS applications...
But last update is 1 week ago13年11月9日土曜日
Hallo RoboVM
How to Install(Eclipse)
• install new Software http://download.robovm.org/eclipse/
13年11月9日土曜日
Hallo RoboVM
•How to Install• command line tool
http://download.robovm.org/robovm-0.0.6.tar.gz
only donwload and unpack it13年11月9日土曜日
Hello RoboVM
1 public class HelloWorld {2 public static void main(String[] args) {3 System.out.println("Hello world!");4 }5 }
mkdir classesjavac -d classes/ HelloWorld.java
robovm-0.0.6/bin/robovm -verbose -cp classes/ HelloWorld
Let’s try Build13年11月9日土曜日
You’ll wait too long time
A simple class like HelloWorld References about 1500 classes directly or indirectly.
RoboVM keeps a cache of compiled classes and only recompiles a class when it or any of its direct dependencies have changed.
HelloWorld/lib/boot/robovm-rt.jarHelloWorld/lib/classes0.jarHelloWorld/HelloWorld
Let's take a quick peek at the contents of the HelloWorld folder
13年11月9日土曜日
iOS Demo 6 public class IOSDemo extends UIApplicationDelegate.Adapter { 7 8 private UIWindow window = null; 9 private int clickCount = 0;10 11 @Override12 public boolean didFinishLaunching(UIApplication application,13 NSDictionary launchOptions) {14 15 final UIButton button = UIButton.fromType(UIButtonType.RoundedRect);16 button.setFrame(new CGRect(115.0f, 121.0f, 91.0f, 37.0f));17 button.setTitle("Click me!", UIControlState.Normal);18 19 button.addOnTouchUpInsideListener(new UIControl.OnTouchUpInsideListener() {20 @Override21 public void onTouchUpInside(UIControl control, UIEvent event) {22 button.setTitle("Click #" + (++clickCount), UIControlState.Normal);23 }24 });25 26 window = new UIWindow(UIScreen.getMainScreen().getBounds());27 window.setBackgroundColor(UIColor.lightGrayColor());28 window.addSubview(button);29 30 window.makeKeyAndVisible();31 32 return true;33 }...
13年11月9日土曜日
6 public class IOSDemo extends UIApplicationDelegate.Adapter { 7
11 @Override12 public boolean didFinishLaunching(UIApplication application,13 NSDictionary launchOptions) {14
15 final UIButton button = UIButton.fromType(UIButtonType.RoundedRect);16 button.setFrame(new CGRect(115.0f, 121.0f, 91.0f, 37.0f));17 button.setTitle("Click me!", UIControlState.Normal);18 19 button.addOnTouchUpInsideListener(new UIControl.OnTouchUpInsideListener() {20 @Override21 public void onTouchUpInside(UIControl control, UIEvent event) {22 button.setTitle("Click #" + (++clickCount), UIControlState.Normal);23 }24 });
iphone application like very...
UIButton create.
13年11月9日土曜日
Objective-c block
1 public static void main(String[] args) { 2 Dispatch.Queue queue = Dispatch.getGlobalQueue( 3 Dispatch.QUEUE_PRIORITY_DEFAULT, 0); 4 for (int i = 1; i <= 5; i++) { 5 final String msg = String.format("Block #%d", i); 6 Dispatch.async(queue, new VoidBlock() { 7 public void invoke() { 8 System.out.println(msg); 9 }10 });11 }12 }
u able to run tasks asynchronously like this
13年11月9日土曜日
RoboVM
java.util.* and java.lang.* can use.
1 final java.util.List<String> arrlist = new java.util.ArrayList<String> (); 2 arrlist.add("spring"); 3 arrlist.add("fall"); 4 5 button.addOnTouchUpInsideListener(new UIControl.OnTouchUpInsideListener() { 6 @Override 7 public void onTouchUpInside(UIControl control, UIEvent event) { 8 button.setTitle("Click #" + (++clickCount) + " " 9 + arrlist.get(1), UIControlState.Normal);10 }11 });
1 final java.util.Date date = new java.util.Date();2 //can't use SimpleDateFormat...3 String title = "JJUG 2013" + date.toString();4 final UIButton button = UIButton.fromType(UIButtonType.RoundedRect);5 button.setFrame(new CGRect(30.0f, 121.0f, 250.0f, 37.0f));6 button.setTitle(title, UIControlState.Normal);
13年11月9日土曜日
JavaFX8
Java
1 MigPane root = new MigPane("gap 10, flowy", "[fill,grow,center]", "[]");
...
4 Scene scene = new Scene(root, 320, 480);5 scene.getStylesheets().add("/com/ultramixer/ javafx4ios/javafx4ios.css");6 primaryStage.setTitle("JavaFX8 on iOS");7 primaryStage.setScene(scene);8 primaryStage.show();
13年11月9日土曜日
RoboVM+JavaFX(CSS)
26 Label headline = new Label("JavaFX8 on iOS JJUG 2013 CCC Fall");27 headline.setId("headline");
1 #headline {2 -fx-font-size: 15;3 }
CSS
Java
u can make a design with CSS13年11月9日土曜日
RoboVM+JavaFX(CSS)
40 Button b2 = new Button("JJUG!!");41 b2.setId("btn");42 b.setOnAction(new EventHandler<ActionEvent>()43 {44 @Override45 public void handle(ActionEvent actionEvent)46 {47 primaryStage.close();48 }49 });
1 #btn {2 -fx-background-radius: 10px;3 -fx-background-color: linear-gradient(to bottom,4 #BBBBCC 0%, #AAAAAA 100%);5 }
CSS
Java
13年11月9日土曜日
Birck Breaker
Splash UI is programmed by ImageView(Java) 1 package brickbreaker; 2 3 import javafx.animation.KeyFrame; 4 import javafx.animation.Timeline; 5 import javafx.event.ActionEvent; 6 import javafx.event.EventHandler; 7 import javafx.scene.Group; 8 import javafx.scene.Node; 9 import javafx.scene.Parent;10 import javafx.scene.image.ImageView;11 import javafx.scene.input.KeyEvent;12 import javafx.scene.input.MouseEvent;13 14 public class Splash extends Parent {15 16 private static final int STATE_SHOW_TITLE = 0;17 private static final int STATE_SHOW_STRIKE = 1;18 private static final int STATE_SUN = 2;19 20 private static final int SUN_AMPLITUDE_X = Config.SCREEN_WIDTH * 2 / 3;21 private static final int SUN_AMPLITUDE_Y = Config.SCREEN_WIDTH / 2;22 23 private ImageView background;24 private ImageView brick;25 private ImageView brickShadow;26 private ImageView breaker;...
need the effort..x(13年11月9日土曜日
Setting forceLinkClasses
• robovm.xml
1 <forceLinkClasses>2 <pattern>javafx.scene.web.WebView</pattern>3 </forceLinkClasses>
currently experimental...13年11月9日土曜日
RoboVM + OpenGLES39 private void update(GLKViewController controller) {40 if (increasing) {41 curRed += 1.0f * controller.getTimeSinceLastUpdate();42 } else {43 curRed -= 1.0f * controller.getTimeSinceLastUpdate();44 }45 if (curRed >= 1.0f) {46 curRed = 1.0f;47 increasing = false;48 }49 if (curRed <= 0.0f) {50 curRed = 0.0f;51 increasing = true;52 }53 }54 55 @Override56 public void draw(GLKView view, CGRect rect) {57 GL.glClearColor(curRed, 0.0f, 0.0f, 1.0f);58 GL.glClear(GL.GL_COLOR_BUFFER_BIT);59 }
13年11月9日土曜日
RoboVM + OpenGLES1 import org.robovm.rt.bro.*; 2 import org.robovm.rt.bro.annotation.*; 3 4 @Library("OpenGLES") 5 public class GL { 6 static { 7 Bro.bind(GL.class); 8 } 9 10 public static final int GL_DEPTH_BUFFER_BIT = 0x00000100;11 public static final int GL_STENCIL_BUFFER_BIT = 0x00000400;12 public static final int GL_COLOR_BUFFER_BIT = 0x00004000;13 14 @Bridge15 public static native void glClearColor(float red, 16 float green, float blue, float alpha);17 18 @Bridge19 public static native void glClear(int mask);20 }
I never thought a screen fading from black to red would look this great! It almost made me cry. :-)
13年11月9日土曜日
Warning
• iOS6 provisioning is expired...•Need to Xcode5.x(but Xcode4.x)• I can’t demo...
\(^o^)/OWATA13年11月9日土曜日
RoboVM Update v0.0.6
• The reason why it failed is that gdb has been removed from Xcode5 and the tool RoboVM used to launch on device (fruitstrap) relied on gdb
13年11月9日土曜日
new RoboVM
• libimobiledevice
• libimobiledevice is a cross-platform software library that talks the protocols to support iPhone, iPod Touch, iPad and Apple TV®devices.
switched to using libgpod13年11月9日土曜日
How to use in iOS7
•Get Java SE JDK 7 from Oracle
•Get Xcode 5.0.1 from the Mac App Store
• https://github.com/robovm/robovm/wiki/Hacking-on-RoboVM
I plan to try bonus comes out13年11月9日土曜日
Maven
git clone https://github.com/robovm/robovm-sample-ios-app.gitcd robovm-sample-ios-appmvn robovm:iphone-sim
mvn robovm:ios-device
git
To run on a device do
Your device has to be provisioned properly for this to work
u can use Intellij IDEA13年11月9日土曜日
but i recommend eclipse
•Why?
• Easy to install (only add packege..)•Offical update early
so, i recommend eclipse13年11月9日土曜日
実は...
•こんなやりとりが...
ということで英語の資料に
@tikemin @skrb It would be great to have these #JavaFX RoboVM slides translated to English http://t.co/Izvtzywzjl」
13年11月9日土曜日
実は...
•こんなやりとりが...
ということで英語の資料に
@tikemin @skrb It would be great to have these #JavaFX RoboVM slides translated to English http://t.co/Izvtzywzjl」
(Bio: Java/JavaFX/IoT developer, author and speaker)
13年11月9日土曜日
Summary
•RoboVM•Compiler translates Java bytecode into native ARM or x86 code
•RoboVM+JavaFX
•RoboVM+OpenGLES
• iOS7(Java7)Future is very fun!
13年11月9日土曜日
libGDX
•Desktop/Android/iOS/HTML5 Java game development framework• Windows• Linux• Max OS X• Android (+1.5)• iOS • Java Applet (requires JVM to be installed)• Javascript/WebGL (Chrome, Safari, Opera, Firefox, IE via Google Chrome Frame)
406 games listed in this gallery13年11月9日土曜日
git hub
• robovm-llvm(Only .md file)
• https://github.com/robovm/robovm-llvm
•ObjC2RoboVM• It is a parser that creates RoboVM bindings from CLang AST dumps
Future is very fun!13年11月9日土曜日