Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • snorrekr/tdt4240-tank-wars
1 result
Show changes
Commits on Source (1)
...@@ -77,22 +77,6 @@ project(":android") { ...@@ -77,22 +77,6 @@ project(":android") {
} }
} }
project(":html") {
apply plugin: "java-library"
apply plugin: "gwt"
apply plugin: "war"
apply plugin: "org.gretty"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
api "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
}
}
project(":core") { project(":core") {
apply plugin: "java-library" apply plugin: "java-library"
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://www.gwtproject.org/doctype/2.8.0/gwt-module.dtd">
<module>
<source path="com/game/tankwars" />
</module>
\ No newline at end of file
gwt {
gwtVersion='2.8.2' // Should match the gwt version used for building the gwt backend
maxHeapSize="1G" // Default 256m is not enough for gwt compiler. GWT is HUNGRY
minHeapSize="1G"
src = files(file("src/")) // Needs to be in front of "modules" below.
modules 'com.game.tankwars.GdxDefinition'
devModules 'com.game.tankwars.GdxDefinitionSuperdev'
project.webAppDirName = 'webapp'
compiler {
strict = true;
disableCastChecking = true;
}
}
import org.wisepersist.gradle.plugins.gwt.GwtSuperDev
import org.akhikhl.gretty.AppBeforeIntegrationTestTask
gretty.httpPort = 8080
gretty.resourceBase = project.buildDir.path + "/gwt/draftOut"
gretty.contextPath = "/"
gretty.portPropertiesFileName = "TEMP_PORTS.properties"
task startHttpServer () {
dependsOn draftCompileGwt
doFirst {
copy {
from "webapp"
into gretty.resourceBase
}
copy {
from "war"
into gretty.resourceBase
}
}
}
task beforeRun(type: AppBeforeIntegrationTestTask, dependsOn: startHttpServer) {
// The next line allows ports to be reused instead of
// needing a process to be manually terminated.
file("build/TEMP_PORTS.properties").delete()
// Somewhat of a hack; uses Gretty's support for wrapping a task in
// a start and then stop of a Jetty server that serves files while
// also running the SuperDev code server.
integrationTestTask 'superDev'
interactive false
}
task superDev (type: GwtSuperDev) {
dependsOn startHttpServer
doFirst {
gwt.modules = gwt.devModules
}
}
task dist(dependsOn: [clean, compileGwt]) {
doLast {
file("build/dist").mkdirs()
copy {
from "build/gwt/out"
into "build/dist"
}
copy {
from "webapp"
into "build/dist"
}
copy {
from "war"
into "build/dist"
}
}
}
task addSource {
doLast {
sourceSets.main.compileClasspath += files(project(':core').sourceSets.main.allJava.srcDirs)
}
}
tasks.compileGwt.dependsOn(addSource)
tasks.draftCompileGwt.dependsOn(addSource)
tasks.checkGwt.dependsOn(addSource)
checkGwt.war = file("war")
sourceCompatibility = 1.7
sourceSets.main.java.srcDirs = [ "src/" ]
eclipse.project.name = appName + "-html"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://www.gwtproject.org/doctype/2.8.0/gwt-module.dtd">
<module rename-to="html">
<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
<inherits name='TankWarsGame' />
<entry-point class='com.game.tankwars.client.HtmlLauncher' />
<set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE'/>
<set-configuration-property name="gdx.assetpath" value="../assets" />
<set-property name="user.agent" value="gecko1_8, safari"/>
<collapse-property name="user.agent" values="*" />
</module>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://www.gwtproject.org/doctype/2.8.0/gwt-module.dtd">
<module rename-to="html">
<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
<inherits name='com.game.tankwars.GdxDefinition' />
<collapse-all-properties />
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE'/>
</module>
package com.game.tankwars.client;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
import com.game.tankwars.TankWarsGame;
public class HtmlLauncher extends GwtApplication {
@Override
public GwtApplicationConfiguration getConfig () {
// Resizable application, uses available space in browser
return new GwtApplicationConfiguration(true);
// Fixed size application:
//return new GwtApplicationConfiguration(480, 320);
}
@Override
public ApplicationListener createApplicationListener () {
return new TankWarsGame();
}
}
\ No newline at end of file
<?xml version="1.0" ?>
<web-app>
</web-app>
\ No newline at end of file
<!doctype html>
<html>
<head>
<title>Tank Wars</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta id="gameViewport" name="viewport" content="width=device-width initial-scale=1">
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<a class="superdev" href="javascript:%7B%20window.__gwt_bookmarklet_params%20%3D%20%7B'server_url'%3A'http%3A%2F%2Flocalhost%3A9876%2F'%7D%3B%20var%20s%20%3D%20document.createElement('script')%3B%20s.src%20%3D%20'http%3A%2F%2Flocalhost%3A9876%2Fdev_mode_on.js'%3B%20void(document.getElementsByTagName('head')%5B0%5D.appendChild(s))%3B%7D">&#8635;</a>
<div align="center" id="embed-html"></div>
<script type="text/javascript" src="html/html.nocache.js"></script>
</body>
<script>
function handleMouseDown(evt) {
evt.preventDefault();
evt.stopPropagation();
window.focus();
}
function handleMouseUp(evt) {
evt.preventDefault();
evt.stopPropagation();
}
document.addEventListener('contextmenu', event => event.preventDefault());
document.getElementById('embed-html').addEventListener('mousedown', handleMouseDown, false);
document.getElementById('embed-html').addEventListener('mouseup', handleMouseUp, false);
</script>
</html>
canvas {
cursor: default;
outline: none;
}
body {
background-color: #222222;
}
.superdev {
color: rgb(37,37,37);
text-shadow: 0px 1px 1px rgba(250,250,250,0.1);
font-size: 50pt;
display: block;
position: relative;
text-decoration: none;
background-color: rgb(83,87,93);
box-shadow: 0px 3px 0px 0px rgb(34,34,34),
0px 7px 10px 0px rgb(17,17,17),
inset 0px 1px 1px 0px rgba(250, 250, 250, .2),
inset 0px -12px 35px 0px rgba(0, 0, 0, .5);
width: 70px;
height: 70px;
border: 0;
border-radius: 35px;
text-align: center;
line-height: 68px;
}
.superdev:active {
box-shadow: 0px 0px 0px 0px rgb(34,34,34),
0px 3px 7px 0px rgb(17,17,17),
inset 0px 1px 1px 0px rgba(250, 250, 250, .2),
inset 0px -10px 35px 5px rgba(0, 0, 0, .5);
background-color: rgb(83,87,93);
top: 3px;
color: #fff;
text-shadow: 0px 0px 3px rgb(250,250,250);
}
.superdev:hover {
background-color: rgb(100,100,100);
}
include 'desktop', 'android', 'html', 'core' include 'desktop', 'android', 'core'
\ No newline at end of file