diff --git a/android/assets/icon.png b/android/assets/icon.png new file mode 100644 index 0000000..19c63a8 Binary files /dev/null and b/android/assets/icon.png differ diff --git a/android/assets/lilicon.png b/android/assets/lilicon.png new file mode 100644 index 0000000..db93954 Binary files /dev/null and b/android/assets/lilicon.png differ diff --git a/android/assets/logo.png b/android/assets/logo.png new file mode 100644 index 0000000..7b913ed Binary files /dev/null and b/android/assets/logo.png differ diff --git a/build.gradle b/build.gradle index 61c8cb5..fe5971c 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,7 @@ allprojects { box2DLightsVersion = '1.4' ashleyVersion = '1.7.0' aiVersion = '1.6.0' + visuiVersion = '0.9.5' } repositories { @@ -73,6 +74,7 @@ project(":html") { compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources" compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion:sources" compile "com.badlogicgames.gdx:gdx-box2d-gwt:$gdxVersion:sources" + compile "com.kotcrab.vis:vis-ui:$visuiVersion:sources" } } @@ -84,7 +86,7 @@ project(":core") { compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" compile "com.google.code.gson:gson:1.7.2" - + compile "com.kotcrab.vis:vis-ui:$visuiVersion" } } diff --git a/core/bitmonerod.bat b/core/bitmonerod.bat new file mode 100644 index 0000000..24f7e03 --- /dev/null +++ b/core/bitmonerod.bat @@ -0,0 +1 @@ +bitmonerod.exe --data-dir=D:\wallets\monero\data \ No newline at end of file diff --git a/core/bitmonerod.exe b/core/bitmonerod.exe new file mode 100644 index 0000000..d76baa2 Binary files /dev/null and b/core/bitmonerod.exe differ diff --git a/core/simplewallet.exe b/core/simplewallet.exe new file mode 100644 index 0000000..7f69a2b Binary files /dev/null and b/core/simplewallet.exe differ diff --git a/core/src/com/jw/lightwallet/daemon/BlockHeader.java b/core/src/com/jw/lightwallet/daemon/BlockHeader.java new file mode 100644 index 0000000..f6c8cfc --- /dev/null +++ b/core/src/com/jw/lightwallet/daemon/BlockHeader.java @@ -0,0 +1,87 @@ +package com.jw.lightwallet.daemon; + +public class BlockHeader { + + int depth; + int difficulty; + String hash; + int height; + int major_version; + int minor_version; + int nonce; + boolean orphan_status; + String prev_hash; + int reward; + int timestamp; + + + public int getDepth() { + return depth; + } + public void setDepth(int depth) { + this.depth = depth; + } + public int getDifficulty() { + return difficulty; + } + public void setDifficulty(int difficulty) { + this.difficulty = difficulty; + } + public String getHash() { + return hash; + } + public void setHash(String hash) { + this.hash = hash; + } + public int getHeight() { + return height; + } + public void setHeight(int height) { + this.height = height; + } + public int getMajor_version() { + return major_version; + } + public void setMajor_version(int major_version) { + this.major_version = major_version; + } + public int getMinor_version() { + return minor_version; + } + public void setMinor_version(int minor_version) { + this.minor_version = minor_version; + } + public int getNonce() { + return nonce; + } + public void setNonce(int nonce) { + this.nonce = nonce; + } + public boolean isOrphan_status() { + return orphan_status; + } + public void setOrphan_status(boolean orphan_status) { + this.orphan_status = orphan_status; + } + public String getPrev_hash() { + return prev_hash; + } + public void setPrev_hash(String prev_hash) { + this.prev_hash = prev_hash; + } + public int getReward() { + return reward; + } + public void setReward(int reward) { + this.reward = reward; + } + public int getTimestamp() { + return timestamp; + } + public void setTimestamp(int timestamp) { + this.timestamp = timestamp; + } + + + +} diff --git a/core/src/com/jw/lightwallet/daemon/DaemonRPC.java b/core/src/com/jw/lightwallet/daemon/DaemonRPC.java new file mode 100644 index 0000000..2de744a --- /dev/null +++ b/core/src/com/jw/lightwallet/daemon/DaemonRPC.java @@ -0,0 +1,52 @@ +package com.jw.lightwallet.daemon; + +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.google.gson.Gson; +import com.jw.lightwallet.daemon.DaemonResponse; +import com.jw.lightwallet.utils.DaemonValues; + +public class DaemonRPC { + public String address; + String response; + String getlastblock; + + public DaemonRPC () { + address = "http://node.moneroclub.com:8880/json_rpc"; + getlastblock = "{\"jsonrpc\":\"2.0\",\"id\":\"test\",\"method\":\"getlastblockheader\",\"params\":[]}"; + } + + public void getinfo (final DaemonValues daemonvalues) { + HttpRequest httpGet = new HttpRequest(HttpMethods.POST); + httpGet.setUrl(address); + httpGet.setContent(getlastblock); + + Gdx.net.sendHttpRequest (httpGet, new HttpResponseListener() { + public void handleHttpResponse(HttpResponse httpResponse) { + response = httpResponse.getResultAsString(); + System.out.print("1st time response" + response); + DaemonResponse daemonresponse = new Gson().fromJson(response, DaemonResponse.class); + System.out.print("GSON response is" + daemonresponse.getId()); + daemonvalues.setBlockheight(daemonresponse.getResult().getBlock_header().getHeight()); + daemonvalues.setDiff(daemonresponse.getResult().getBlock_header().getDifficulty()); + daemonvalues.setLastblocktime(daemonresponse.getResult().getBlock_header().getTimestamp()); + daemonvalues.setLastblockreward(daemonresponse.getResult().getBlock_header().getReward()); + daemonvalues.setStatus(daemonresponse.getResult().getStatus()); + } + + public void failed(Throwable t) { + response = "failed"; + System.out.print("Failed response status is: " + response); + //do stuff here based on the failed attempt + } + + @Override + public void cancelled() { + // TODO Auto-generated method stub + } + }); + } +} diff --git a/core/src/com/jw/lightwallet/daemon/DaemonResponse.java b/core/src/com/jw/lightwallet/daemon/DaemonResponse.java new file mode 100644 index 0000000..e7884e3 --- /dev/null +++ b/core/src/com/jw/lightwallet/daemon/DaemonResponse.java @@ -0,0 +1,28 @@ +package com.jw.lightwallet.daemon; + +public class DaemonResponse { + + String id; + String jsonrpc; + Result result; + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getJsonrpc() { + return jsonrpc; + } + public void setJsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + } + public Result getResult() { + return result; + } + public void setResult(Result result) { + this.result = result; + } + +} \ No newline at end of file diff --git a/core/src/com/jw/lightwallet/daemon/Result.java b/core/src/com/jw/lightwallet/daemon/Result.java new file mode 100644 index 0000000..c5e7493 --- /dev/null +++ b/core/src/com/jw/lightwallet/daemon/Result.java @@ -0,0 +1,24 @@ +package com.jw.lightwallet.daemon; + +public class Result { + + BlockHeader block_header; + String status; + + + public BlockHeader getBlock_header() { + return block_header; + } + public void setBlock_header(BlockHeader block_header) { + this.block_header = block_header; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + + + +} diff --git a/core/src/com/jw/lightwallet/screens/AbstractScreen.java b/core/src/com/jw/lightwallet/screens/AbstractScreen.java index 005ed64..ca4740e 100644 --- a/core/src/com/jw/lightwallet/screens/AbstractScreen.java +++ b/core/src/com/jw/lightwallet/screens/AbstractScreen.java @@ -12,7 +12,7 @@ public class AbstractScreen implements Screen { protected float w; protected float h; protected float aspect; - protected long screenShowTime; + protected float accumulator; public AbstractScreen (LightWallet game) { this.game = game; @@ -20,6 +20,7 @@ public class AbstractScreen implements Screen { this.w = Gdx.graphics.getWidth(); this.h = Gdx.graphics.getHeight(); this.aspect = w/h; + this.accumulator = 0; } @Override @@ -31,7 +32,8 @@ public class AbstractScreen implements Screen { @Override public void render(float delta) { Gdx.gl.glClearColor(1, 0, 0, 1); - Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + accumulator = accumulator + delta; } @Override diff --git a/core/src/com/jw/lightwallet/screens/MainScreen.java b/core/src/com/jw/lightwallet/screens/MainScreen.java index 158e95f..4cd71d5 100644 --- a/core/src/com/jw/lightwallet/screens/MainScreen.java +++ b/core/src/com/jw/lightwallet/screens/MainScreen.java @@ -1,32 +1,62 @@ package com.jw.lightwallet.screens; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.utils.Timer; import com.jw.lightwallet.LightWallet; -import com.jw.lightwallet.utils.DaemonRPC; +import com.jw.lightwallet.daemon.DaemonRPC; +import com.jw.lightwallet.utils.DaemonValues; public class MainScreen extends AbstractScreen { // Interface classes DaemonRPC daemonrpc; - + DaemonValues daemonvalues; // Layout stuff Table screenlayout; TextButton daemonbutton; TextButton walletbutton; // Daemon layout Table daemonlayout; + Image logo; + Label statuslabel; + Label statusvalue; + Label blockheightlabel; + Label blockheightvalue; + Label difflabel; + Label diffvalue; + Label hashratelabel; + Label hashratevalue; + Label lastblocktimelabel; + Label lastblocktimevalue; + Label rewardlabel; + Label rewardvalue; + // Wallet layout + // Transfer layout + // Tx history layout + // Timer + Timer timer; public MainScreen(LightWallet game) { super(game); - + timer = new Timer(); daemonrpc = new DaemonRPC(); - daemonrpc.getinfo(); + daemonvalues = new DaemonValues(); + daemonrpc.getinfo(daemonvalues); } public void show() { super.show(); + timer.scheduleTask(new Timer.Task() { + @Override + public void run() { + System.out.print(daemonvalues.getBlockheight()); + } + }, 5f, 5f); + } public void render(float delta) { @@ -37,5 +67,6 @@ public class MainScreen extends AbstractScreen { public void dispose() { } + } diff --git a/core/src/com/jw/lightwallet/utils/DaemonRPC.java b/core/src/com/jw/lightwallet/utils/DaemonRPC.java deleted file mode 100644 index 9bdc119..0000000 --- a/core/src/com/jw/lightwallet/utils/DaemonRPC.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.jw.lightwallet.utils; - -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.google.gson.Gson; -import com.google.gson.JsonObject; - -public class DaemonRPC { - public String address; - String response; - String getlastblock; - DaemonResponse daemonresponse; - - public DaemonRPC () { - address = "http://node.moneroclub.com:8880/json_rpc"; - getlastblock = "{\"jsonrpc\":\"2.0\",\"id\":\"test\",\"method\":\"getlastblockheader\",\"params\":[]}"; - } - - public DaemonResponse getinfo () { - HttpRequest httpGet = new HttpRequest(HttpMethods.POST); - httpGet.setUrl(address); - httpGet.setContent(getlastblock); - - Gdx.net.sendHttpRequest (httpGet, new HttpResponseListener() { - public void handleHttpResponse(HttpResponse httpResponse) { - response = httpResponse.getResultAsString(); - System.out.print(response); - JsonObject gsonresponse = new Gson().fromJson(response, JsonObject.class); - // Bitmonerod info variables - String status = gsonresponse.getAsJsonObject("response").getAsJsonObject("status").getAsString(); - int blockheight = gsonresponse.getAsJsonObject("response").getAsJsonObject("block_header").get("height").getAsInt(); - int diff = gsonresponse.getAsJsonObject("response").getAsJsonObject("block_header").get("difficulty").getAsInt(); - float blockreward = gsonresponse.getAsJsonObject("response").getAsJsonObject("block_header").get("reward").getAsFloat(); - int timestamp = gsonresponse.getAsJsonObject("response").getAsJsonObject("block_header").get("timestamp").getAsInt(); - daemonresponse = new DaemonResponse(status, blockheight, diff, timestamp, blockreward); - } - - public void failed(Throwable t) { - response = "failed"; - //do stuff here based on the failed attempt - } - - @Override - public void cancelled() { - // TODO Auto-generated method stub - } - }); - if (daemonresponse.status == "OK") {return daemonresponse;} - else {return null;} - } -} diff --git a/core/src/com/jw/lightwallet/utils/DaemonResponse.java b/core/src/com/jw/lightwallet/utils/DaemonResponse.java deleted file mode 100644 index 91d1412..0000000 --- a/core/src/com/jw/lightwallet/utils/DaemonResponse.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.jw.lightwallet.utils; - -public class DaemonResponse { - String status; - int blockheight; - int diff; - int hashrate; - int lastblocktime; - float blockreward; - - DaemonResponse (String status, int blockheight, int diff, int lastblocktime, float blockreward) { - this.status = status; - this.blockheight = blockheight; - this.diff = diff; - this.hashrate = diff/60; - this.lastblocktime = lastblocktime; - this.blockreward = blockreward; - } - -} diff --git a/core/src/com/jw/lightwallet/utils/DaemonValues.java b/core/src/com/jw/lightwallet/utils/DaemonValues.java new file mode 100644 index 0000000..0b1d92b --- /dev/null +++ b/core/src/com/jw/lightwallet/utils/DaemonValues.java @@ -0,0 +1,52 @@ +package com.jw.lightwallet.utils; + +public class DaemonValues { + + int blockheight; + int diff; + int hashrate; + int lastblocktime; + int lastblockreward; + String status; + + + public int getBlockheight() { + return blockheight; + } + public void setBlockheight(int blockheight) { + this.blockheight = blockheight; + } + + public int getDiff() { + return diff; + } + public void setDiff(int diff) { + this.diff = diff; + this.hashrate = diff/60; + } + public int getHashrate() { + return hashrate; + } + + public int getLastblocktime() { + return lastblocktime; + } + public void setLastblocktime(int lastblocktime) { + this.lastblocktime = lastblocktime; + } + + public int getLastblockreward() { + return lastblockreward; + } + public void setLastblockreward(int lastblockreward) { + this.lastblockreward = lastblockreward; + } + + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + +} diff --git a/html/src/com/jw/lightwallet/GdxDefinition.gwt.xml b/html/src/com/jw/lightwallet/GdxDefinition.gwt.xml index f9e18b9..5c22da5 100644 --- a/html/src/com/jw/lightwallet/GdxDefinition.gwt.xml +++ b/html/src/com/jw/lightwallet/GdxDefinition.gwt.xml @@ -3,7 +3,7 @@ - + diff --git a/html/src/com/jw/lightwallet/GdxDefinitionSuperdev.gwt.xml b/html/src/com/jw/lightwallet/GdxDefinitionSuperdev.gwt.xml index 36ae2d1..a44d54e 100644 --- a/html/src/com/jw/lightwallet/GdxDefinitionSuperdev.gwt.xml +++ b/html/src/com/jw/lightwallet/GdxDefinitionSuperdev.gwt.xml @@ -5,7 +5,7 @@ - +