Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #19 from mdwoolley/master
Browse files Browse the repository at this point in the history
Please commit new application
  • Loading branch information
timwindsor committed Aug 15, 2012
2 parents 861bea3 + 80cb982 commit b9d7118
Show file tree
Hide file tree
Showing 144 changed files with 3,057 additions and 0 deletions.
7 changes: 7 additions & 0 deletions NFC/TouchTicTacToe/.classpath
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="res"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/net.rim.ejde.BlackBerryVMInstallType/BlackBerry JRE 7.1.0"/>
<classpathentry kind="output" path="bin"/>
</classpath>
29 changes: 29 additions & 0 deletions NFC/TouchTicTacToe/.project
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>TouchTicTacToe</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>net.rim.ejde.internal.builder.BlackBerryPreprocessBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.rim.ejde.internal.builder.BlackBerryResourcesBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>net.rim.ejde.BlackBerryPreProcessNature</nature>
<nature>net.rim.ejde.BlackBerryProjectCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,3 @@
#Tue Jul 03 14:17:25 BST 2012
eclipse.preferences.version=1
outputfolder=build
12 changes: 12 additions & 0 deletions NFC/TouchTicTacToe/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
#Tue Jul 03 14:15:38 BST 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.4
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
org.eclipse.jdt.core.compiler.source=1.3
23 changes: 23 additions & 0 deletions NFC/TouchTicTacToe/BlackBerry_App_Descriptor.xml
@@ -0,0 +1,23 @@
<!-- This file has been generated by the BlackBerry Plugin for Eclipse v3.6.1. -->

<Properties ModelVersion="1.1.2">
<General Title="" Version="1.0.0" Vendor="BlackBerry Developer" Description=""/>
<Application Type="BlackBerry Application" MainMIDletName="" MainArgs="" HomeScreenPosition="0" StartupTier="7" IsSystemModule="false" IsAutostartup="false"/>
<Resources hasTitleResource="false" TitleResourceBundleName="" TitleResourceBundleRelativePath="" TitleResourceBundleClassName="" TitleResourceBundleKey="" DescriptionId="">
<Icons>
<Icon CanonicalFileName="res/img/icon4.png" IsFocus="false"/>
</Icons>
</Resources>
<KeywordResources KeywordResourceBundleName="" KeywordResourceBundleRelativePath="" KeywordResourceBundleClassName="" KeywordResourceBundleKey=""/>
<Compile OutputCompilerMessages="false" ConvertImages="true" CreateWarningForNoExportedRoutine="true" CompressResources="false" AliasList="">
<PreprocessorDefines/>
</Compile>
<Packaging PreBuildStep="" PostBuildStep="" CleanStep="" OutputFileName="TouchTicTacToe" OutputFolder="deliverables" GenerateALXFile="true">
<AlxFiles/>
</Packaging>
<HiddenProperties>
<ClassProtection/>
<PackageProtection/>
</HiddenProperties>
<AlternateEntryPoints/>
</Properties>
43 changes: 43 additions & 0 deletions NFC/TouchTicTacToe/README.md
@@ -0,0 +1,43 @@
# TouchTicTacToe


The purpose of this application is to demonstrate "Proximity Gaming". Proximity Gaming is a term coined by Martin Woolley of Research In Motion for the use
of Near Field Communications in multi-player games. See http://devblog.blackberry.com/ for a blog post on this subject.

The sample code for this application is Open Source under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0.html).

**Applies To**

* [BlackBerry Java SDK for Smartphones](http://us.blackberry.com/developers/javaappdev/)


**Author**

* [Martin Woolley](https://github.com/mdwoolley)


**Dependencies**

1. BlackBerry Device Software 7.1 and above.


**Known Issues**

None

**To contribute code to this repository you must be [signed up as an official contributor](http://blackberry.github.com/howToContribute.html).**


## Contributing Changes

Please see the [README](https://github.com/blackberry/BlackBerry-Java) of the BlackBerry-Java repository for instructions on how to add new Samples or make modifications to existing Samples.


## Bug Reporting and Feature Requests

If you find a bug in a Sample, or have an enhancement request, simply file an [Issue](https://github.com/blackberry/BlackBerry-Java/issues) for the Sample and send a message (via github messages) to the Sample Author(s) to let them know that you have filed an [Issue](https://github.com/blackberry/BlackBerry-Java/issues).


## Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NFC/TouchTicTacToe/bin/img/board_480x360.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NFC/TouchTicTacToe/bin/img/board_640x480.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NFC/TouchTicTacToe/bin/img/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NFC/TouchTicTacToe/bin/img/icon2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NFC/TouchTicTacToe/bin/img/icon3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NFC/TouchTicTacToe/bin/img/icon4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NFC/TouchTicTacToe/bin/img/new_game_480x360.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NFC/TouchTicTacToe/bin/img/new_game_640x480.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
52525400=RIM Runtime API
@@ -0,0 +1,5 @@
33000000=RIMAPPSA2
52424200=RIM Blackberry Apps API
52434900=RIM Crypto API - Internal
52435200=RIM Crypto API - RIM
4e464352=NFCRoutingAPI
Binary file not shown.
19 changes: 19 additions & 0 deletions NFC/TouchTicTacToe/deliverables/Standard/7.1.0/TouchTicTacToe.jad
@@ -0,0 +1,19 @@
MIDlet-Name: TouchTicTacToe
MIDlet-Version: 1.0.0
MIDlet-Vendor: BlackBerry Developer
MIDlet-Jar-URL: TouchTicTacToe.jar
MIDlet-Jar-Size: 247594
MicroEdition-Profile: MIDP-2.0
MicroEdition-Configuration: CLDC-1.1
MIDlet-1: ,img/icon4.png,
RIM-MIDlet-Flags-1: 0
Manifest-Version: 1.0
RIM-COD-URL: TouchTicTacToe.cod
RIM-COD-Size: 61640
RIM-COD-Creation-Time: 1345031668
RIM-COD-Module-Name: TouchTicTacToe
RIM-COD-Module-Dependencies: net_rim_cldc,net_rim_nfc
RIM-COD-SHA1: 45 d2 72 b1 bb 88 15 da 61 ec 96 29 3f b0 41 ea a5 a7 ab f9
RIM-COD-URL-1: TouchTicTacToe-1.cod
RIM-COD-Size-1: 23668
RIM-COD-SHA1-1: ea 05 58 83 38 07 b6 4f 85 f5 ee 48 ac 5d e6 0f 04 5f ee e9
Binary file not shown.
10 changes: 10 additions & 0 deletions NFC/TouchTicTacToe/deliverables/Standard/7.1.0/TouchTicTacToe.rapc
@@ -0,0 +1,10 @@
MIDlet-Name: TouchTicTacToe
MIDlet-Version: 1.0.0
MIDlet-Vendor: BlackBerry Developer
MIDlet-Jar-URL: TouchTicTacToe.jar
MIDlet-Jar-Size: 0
MicroEdition-Profile: MIDP-2.0
MicroEdition-Configuration: CLDC-1.1
MIDlet-1: ,img/icon4.png,
RIM-MIDlet-Flags-1: 0

31 changes: 31 additions & 0 deletions NFC/TouchTicTacToe/deliverables/Standard/TouchTicTacToe.alx
@@ -0,0 +1,31 @@
<loader version="1.0">
<application id="TouchTicTacToe">
<name >

</name>
<description >

</description>
<version >
1.0.0
</version>
<vendor >
BlackBerry Developer
</vendor>
<copyright >
Copyright (c) 2012 BlackBerry Developer
</copyright>
<fileset Java="1.54" _blackberryVersion="[7.1.0)">
<directory >
7.1.0
</directory>
<files >
TouchTicTacToe.cod

</files>

</fileset>

</application>

</loader>
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
52525400=RIM Runtime API
5 changes: 5 additions & 0 deletions NFC/TouchTicTacToe/deliverables/Web/7.1.0/TouchTicTacToe.cso
@@ -0,0 +1,5 @@
33000000=RIMAPPSA2
52424200=RIM Blackberry Apps API
52434900=RIM Crypto API - Internal
52435200=RIM Crypto API - RIM
4e464352=NFCRoutingAPI
Binary file not shown.
19 changes: 19 additions & 0 deletions NFC/TouchTicTacToe/deliverables/Web/7.1.0/TouchTicTacToe.jad
@@ -0,0 +1,19 @@
MIDlet-Name: TouchTicTacToe
MIDlet-Version: 1.0.0
MIDlet-Vendor: BlackBerry Developer
MIDlet-Jar-URL: TouchTicTacToe.jar
MIDlet-Jar-Size: 247594
MicroEdition-Profile: MIDP-2.0
MicroEdition-Configuration: CLDC-1.1
MIDlet-1: ,img/icon4.png,
RIM-MIDlet-Flags-1: 0
Manifest-Version: 1.0
RIM-COD-URL: TouchTicTacToe.cod
RIM-COD-Size: 61640
RIM-COD-Creation-Time: 1345031668
RIM-COD-Module-Name: TouchTicTacToe
RIM-COD-Module-Dependencies: net_rim_cldc,net_rim_nfc
RIM-COD-SHA1: 45 d2 72 b1 bb 88 15 da 61 ec 96 29 3f b0 41 ea a5 a7 ab f9
RIM-COD-URL-1: TouchTicTacToe-1.cod
RIM-COD-Size-1: 23668
RIM-COD-SHA1-1: ea 05 58 83 38 07 b6 4f 85 f5 ee 48 ac 5d e6 0f 04 5f ee e9
Binary file not shown.
10 changes: 10 additions & 0 deletions NFC/TouchTicTacToe/deliverables/Web/7.1.0/TouchTicTacToe.rapc
@@ -0,0 +1,10 @@
MIDlet-Name: TouchTicTacToe
MIDlet-Version: 1.0.0
MIDlet-Vendor: BlackBerry Developer
MIDlet-Jar-URL: TouchTicTacToe.jar
MIDlet-Jar-Size: 0
MicroEdition-Profile: MIDP-2.0
MicroEdition-Configuration: CLDC-1.1
MIDlet-1: ,img/icon4.png,
RIM-MIDlet-Flags-1: 0

Binary file added NFC/TouchTicTacToe/res/img/board_480x360.png
Binary file added NFC/TouchTicTacToe/res/img/board_640x480.png
Binary file added NFC/TouchTicTacToe/res/img/icon.png
Binary file added NFC/TouchTicTacToe/res/img/icon2.png
Binary file added NFC/TouchTicTacToe/res/img/icon3.png
Binary file added NFC/TouchTicTacToe/res/img/icon4.png
Binary file added NFC/TouchTicTacToe/res/img/new_game_480x360.png
Binary file added NFC/TouchTicTacToe/res/img/new_game_640x480.png
55 changes: 55 additions & 0 deletions NFC/TouchTicTacToe/src/nfc/sample/tictactoe/Constants.java
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2012 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nfc.sample.tictactoe;
import net.rim.device.api.ui.Color;

public interface Constants {

public static final String MYAPP_VERSION = "1.0.1";
public static final String MYAPP_NAME = "Touch Tic Tac Toe";

public static final String [] WINNER_MESSAGE = {"YOU HAVE WON!!","Touch devices to start new game"};
public static final String [] STALE_MATE_MESSAGE = {"Stale mate! No more moves.","Touch devices to start new game"};

public static final int BOARD_STATE_OPEN=0;
public static final int BOARD_STATE_LOCKED=1;
public static final int NO_PREV_TURN=-1;
public static final int TILE_STATE_BLANK=0;
public static final int TILE_STATE_NOUGHT=1;
public static final int TILE_STATE_CROSS=2;
public static final int SELECT_STATE_NOUGHT=0;
public static final int SELECT_STATE_CROSS=0;
public static final int STATUS_COLOUR = Color.RED;
public static final int FOCUSED_COLOUR = Color.GOLD;
public static final int CLICKED_COLOUR = Color.RED;
public static final int WIN_LINE_COLOUR = Color.DARKORANGE;
public static final int STALE_MATE_TILE_COLOUR = Color.BLUE;
public static final int TRANSPARENCY = 30;
public static final int PLAYER_1 = 1;
public static final int PLAYER_2 = 2;
public static final int PLAYER_SYMBOL_NOUGHT = 1;
public static final int PLAYER_SYMBOL_CROSS = 2;
public static final long MESSAGE_TIME = 5000;
public static final int INITIAL_TILE = 4;

// protocol
public static final int PROTOCOL_MASTER_BID=1;
public static final int PROTOCOL_TURN_OVER=2;
public static final int PROTOCOL_RESET_BID_STATE=3;
public static final String SNEP_DOMAIN = "com.blackberry.nfc.sample";
public static final String SNEP_TYPE = "G1"; // Game #1

}
35 changes: 35 additions & 0 deletions NFC/TouchTicTacToe/src/nfc/sample/tictactoe/TouchTicTacToe.java
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2012 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nfc.sample.tictactoe;

import net.rim.device.api.ui.UiApplication;
import nfc.sample.tictactoe.ui.StartGameScreen;

public class TouchTicTacToe extends UiApplication {

public static void main(String[] args) {
Utilities.initLogging();
Utilities.log("XXXX "+Constants.MYAPP_NAME+" v"+Constants.MYAPP_VERSION);
TouchTicTacToe app = new TouchTicTacToe();
app.enterEventDispatcher();
}

private TouchTicTacToe() {
StartGameScreen start_screen = new StartGameScreen();
pushScreen(start_screen);
}

}
62 changes: 62 additions & 0 deletions NFC/TouchTicTacToe/src/nfc/sample/tictactoe/Utilities.java
@@ -0,0 +1,62 @@
/*
* Copyright (c) 2012 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nfc.sample.tictactoe;
import net.rim.device.api.system.EventLogger;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.Dialog;

public class Utilities {

private static final long MYAPP_ID = 0x4c38c8a7798397d1L;

public static void log(String logMessage) {
boolean ok = EventLogger.logEvent(MYAPP_ID, logMessage.getBytes(), EventLogger.INFORMATION);
}

public static void initLogging() {
EventLogger.register(MYAPP_ID, "TouchTicTacToe", EventLogger.VIEWER_STRING);
}

public static boolean isOdd(int number) {
int remainder = number % 2;
return remainder == 1;
}

public static byte[] toBytes(int value) {
byte [] bytes = new byte[4];
bytes [0] = (byte) ((value >>> 24) & 0xFF);
bytes [1] = (byte) ((value >>> 16) & 0xFF);
bytes [2] = (byte) ((value >>> 8) & 0xFF);
bytes [3] = (byte) ( value & 0xFF);
return bytes;
}

public static int toInt(byte[] bytes, int start) {
if((bytes.length - start) < 3) {
Utilities.log("XXXX toInt method received invalid length start position; insifficient bytes:" + bytes.length + "," + start);
return 0;
}
int i = ((bytes[start] & 0xFF) << 24) + ((bytes[start + 1] & 0xFF) << 16) + ((bytes[start + 2] & 0xFF) << 8) + (bytes[start + 3] & 0xFF);
return i;
}

public static void popupMessage(String message) {
synchronized(UiApplication.getEventLock()) {
Dialog.inform(message);
}
}

}

0 comments on commit b9d7118

Please sign in to comment.