mirror of
https://github.com/jwinterm/LightWallet2.git
synced 2026-10-21 05:58:33 +02:00
First commit.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
apply plugin: "java"
|
||||
|
||||
sourceCompatibility = 1.6
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||
|
||||
|
||||
eclipse.project {
|
||||
name = appName + "-core"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
|
||||
<module>
|
||||
<source path="com/jw/lightwallet" />
|
||||
</module>
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.jw.lightwallet;
|
||||
|
||||
import com.badlogic.gdx.Game;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.jw.lightwallet.screens.MainScreen;
|
||||
|
||||
public class LightWallet extends Game {
|
||||
public static final String LOG = LightWallet.class.getSimpleName(); // Logging constant
|
||||
|
||||
|
||||
@Override
|
||||
public void create () {
|
||||
Gdx.app.log(LightWallet.LOG, "Launching application");
|
||||
setScreen(new MainScreen(this));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.jw.lightwallet.screens;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Screen;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.jw.lightwallet.LightWallet;
|
||||
|
||||
public class AbstractScreen implements Screen {
|
||||
protected LightWallet game;
|
||||
protected BitmapFont font;
|
||||
protected float w;
|
||||
protected float h;
|
||||
protected float aspect;
|
||||
protected long screenShowTime;
|
||||
|
||||
public AbstractScreen (LightWallet game) {
|
||||
this.game = game;
|
||||
this.font = new BitmapFont(Gdx.files.internal("fonts/bauchaomaicha.fnt"));
|
||||
this.w = Gdx.graphics.getWidth();
|
||||
this.h = Gdx.graphics.getHeight();
|
||||
this.aspect = w/h;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
Gdx.gl.glClearColor(1, 0, 0, 1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.jw.lightwallet.screens;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.jw.lightwallet.LightWallet;
|
||||
import com.jw.lightwallet.utils.DaemonRPC;
|
||||
|
||||
public class MainScreen extends AbstractScreen {
|
||||
DaemonRPC daemonrpc;
|
||||
|
||||
public MainScreen(LightWallet game) {
|
||||
super(game);
|
||||
daemonrpc = new DaemonRPC();
|
||||
daemonrpc.getinfo();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.jw.lightwallet.utils;
|
||||
|
||||
public class Constants {
|
||||
public static final int DESKTOP_WIDTH = 800;
|
||||
public static final int DESKTOP_HEIGHT = 600;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.jw.lightwallet.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Net.HttpMethods;
|
||||
import com.badlogic.gdx.Net.HttpRequest;
|
||||
import com.badlogic.gdx.Net.HttpResponse;
|
||||
import com.badlogic.gdx.Net.HttpResponseListener;
|
||||
import com.badlogic.gdx.net.HttpParametersUtils;
|
||||
|
||||
public class DaemonRPC {
|
||||
public String address;
|
||||
public Map params;
|
||||
String status;
|
||||
|
||||
public DaemonRPC () {
|
||||
address = "http://moneroclub.com:8880";
|
||||
}
|
||||
|
||||
public void getinfo () {
|
||||
Map params = new HashMap();
|
||||
params.put("jsonrpc", "2.0");
|
||||
params.put("id", "test");
|
||||
params.put("method", "getinfo");
|
||||
|
||||
HttpRequest httpGet = new HttpRequest(HttpMethods.POST);
|
||||
httpGet.setUrl("http://somewhere.net");
|
||||
httpGet.setContent(HttpParametersUtils.convertHttpParameters(params));
|
||||
|
||||
Gdx.net.sendHttpRequest (httpGet, new HttpResponseListener() {
|
||||
public void handleHttpResponse(HttpResponse httpResponse) {
|
||||
status = httpResponse.getResultAsString();
|
||||
System.out.print(status);
|
||||
}
|
||||
|
||||
public void failed(Throwable t) {
|
||||
status = "failed";
|
||||
//do stuff here based on the failed attempt
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelled() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user