-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add buttons example and module #58
Open
PebbleKat
wants to merge
5
commits into
master
Choose a base branch
from
PBL-32265/buttons-example
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"input": { | ||
"memoryFormat": "smallest", | ||
"original": "some.url", | ||
"storageFormat": "png" | ||
}, | ||
"output": { | ||
"data": "iVBORw0KGgoAAAANSUhEUgAAABcAAAAZBAMAAAAoDqjjAAAAFVBMVEX///9VVQD/qlWqqlUAAAD//6qqVQCmRoadAAAAm0lEQVR42m3PwRECMQgFUOggkAr40QIIHexYgc4WYP9NGMh6Uk68TJIPREQi0ugqAWCXGFm2oQW0HzBm9tP+QA/guDDqUd8IxeNA94IzbjAuUCMJb/QdYURYnVbqvTJl43wmesugcb7WoByNWGbChWdbl3y9sYmeGA5VC3QkQlV7QC3/cjXILKytFxRW6+mGVCa/w8Pf12hSle0Hnx4abYUujacAAAAASUVORK5CYII=", | ||
"gbitmapFormat": 4, | ||
"outputFormat": "png" | ||
}, | ||
"success": true | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | ||
<title>Buttons Example</title> | ||
|
||
<!-- build:template | ||
<script src="../../<%= rockyjs_path %>"></script> | ||
/build --> | ||
<!-- build:remove --> | ||
<!-- this template/remove construct is a workaround as processhtml doesn't support variables for values --> | ||
<script src="../../src/html-binding.js"></script> | ||
<script src="../../src/symbols-manual.js"></script> | ||
<script src="../../src/symbols-generated.js"></script> | ||
<script src="../../src/transpiled.js"></script> | ||
<!-- /build --> | ||
|
||
<!-- build:css ../../css/bootstrap.min.css --> | ||
<link href="../../html/css/bootstrap.min.css" rel="stylesheet"> | ||
<!-- /build --> | ||
<!-- build:css ../../css/style.css --> | ||
<link href="../../html/css/style.css" rel="stylesheet"> | ||
<!-- /build --> | ||
|
||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | ||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> | ||
<!--[if lt IE 9]> | ||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> | ||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | ||
<![endif]--> | ||
|
||
<link rel="stylesheet" href="../common/css/style.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="page-header"> | ||
<h1>Buttons Example</h1> | ||
<p class="lead"> | ||
This is a simple example of how to implement Pebble button clicks in RockyJS using a keyboard's directional arrow keys. | ||
</p> | ||
</div> | ||
|
||
<div class="col-md-6"> | ||
<canvas id="pebble" class="rocky" width="432" height="504"></canvas> | ||
</div> | ||
|
||
<div class="col-md-6"> | ||
<h2>What's going on?</h2> | ||
<p> | ||
This example demonstrates how to interact with RockyJS bound to a canvas. Using the left, right, up, and down arrows on your keyboard you can simulate the back, select, up, and down buttons of the Pebble respectively. | ||
</p> | ||
|
||
<code>rocky.onPress(type, callback)</code> | ||
<p> | ||
Options for <code>type</code> are 'back', 'select', 'up', or 'down'. | ||
</p> | ||
<p> | ||
Source for this example can be found at [link TBD]. | ||
</div> | ||
<!-- build:template | ||
<%= github_banner %> | ||
/build --> | ||
</div> | ||
</body> | ||
<script> | ||
var rocky = Rocky.bindCanvas(document.getElementById("pebble")); | ||
rocky.export_global_c_symbols(); | ||
|
||
/**** App ****/ | ||
|
||
var currentText = "Press an arrow key"; | ||
|
||
rocky.update_proc = function (ctx, bounds) { | ||
graphics_context_set_text_color(ctx, GColorBlack); | ||
graphics_draw_text(ctx, currentText, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD), | ||
bounds, GTextOverflowModeWordWrap, GTextAlignmentLeft, null); | ||
}; | ||
|
||
(function() { | ||
rocky.onPress("back", function() { | ||
console.log("Back Button Pressed"); | ||
currentText = "Back lets us run away."; | ||
this.mark_dirty(); | ||
}); | ||
rocky.onPress("up", function() { | ||
console.log("Up Button Pressed"); | ||
currentText = "Up and away we go!"; | ||
this.mark_dirty(); | ||
}); | ||
rocky.onPress("select", function() { | ||
console.log("Select Button Pressed"); | ||
currentText = "Select is the best button."; | ||
this.mark_dirty(); | ||
}); | ||
rocky.onPress("down", function() { | ||
console.log("Down Button Pressed"); | ||
currentText = "Down into the depths we go."; | ||
this.mark_dirty(); | ||
}); | ||
})(); | ||
|
||
</script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignore everything except Up, Down, Left, and Right