Skip to content

Commit

Permalink
Merge pull request blackberry#73 from rsperanza/master
Browse files Browse the repository at this point in the history
Merge in the latest version of GoodCitizenCascades
  • Loading branch information
pelegri committed Jan 13, 2013
2 parents 74ee956 + b82465a commit 2854708
Show file tree
Hide file tree
Showing 34 changed files with 2,141 additions and 1,464 deletions.
412 changes: 206 additions & 206 deletions GoodCitizenCascades/.cproject

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions GoodCitizenCascades/.project
Expand Up @@ -73,12 +73,18 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.rim.tad.tools.qml.core.qmlFileBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>com.qnx.tools.ide.bbt.core.bbtnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>com.rim.tad.tools.qml.core.qmlNature</nature>
</natures>
</projectDescription>
5 changes: 3 additions & 2 deletions GoodCitizenCascades/GoodCitizenCascades.pro
Expand Up @@ -17,9 +17,8 @@
TEMPLATE = app
TARGET = GoodCitizenCascades

CONFIG += qt warn_on debug_and_release cascades
CONFIG += qt warn_on debug_and_release cascades10
LIBS += -lpps -lscreen -lEGL -lGLESv1_CM -lfreetype -lpng -lbb
#LIBS += -lpps -lscreen -lEGL -lGLESv1_CM -lfreetype -lpng -lbb -lQtCascades -lheimdall ${QNX_TARGET}/../target-override/armle-v7/usr/lib/libQtCascades_main.a

INCLUDEPATH += ../src
SOURCES += ../src/*.cpp
Expand All @@ -28,6 +27,8 @@ HEADERS += ../src/*.hpp ../src/*.h
device {
CONFIG(release, debug|release) {
DESTDIR = o.le-v7
TEMPLATE=lib
QMAKE_CXXFLAGS += -fvisibility=hidden
}
CONFIG(debug, debug|release) {
DESTDIR = o.le-v7-g
Expand Down
29 changes: 28 additions & 1 deletion GoodCitizenCascades/README.md
@@ -1,2 +1,29 @@
GoodCitizenCascades is a Cascades version of the NDK sample app, Good Citizen. It features best practices for how to properly structure the OpenGL code and link it in with Cascades, how to leverage Actions and the use of NavigatorPanes for multiple panels, as well as how to process touch events and use them to control a 3D scene rendered in OpenGL, using Qt objects and JavaScript.
Built initially for the Cascades + OpenGL session presented at Blackberry 10 Jam in Orlando, Florida, if you update or modify this example, please update the running version info as well.

Built initially for the Cascades + OpenGL session presented at Blackberry 10 Jam in Orlando, Florida, if you update or modify this example, please update the running version info as well.

New Features in this version of the sample app:

UI Changes:

- while the higher level interface has been streamlined to make it easier to create views with little code all panels have been modified to push them down to the bottom of the screen for easier access

Framework changes:

- OpenGLThread is now a singleton and the developer should not access it directly any more. All methods for the thread that may need to be externally accessed are masked by an equivalent method in OpenGLView
- the framework now supports adding a view that is rendered in the HDMI display. Another sample showcasing this feature is coming soon
- the API inAterface has been updated to split out certain setters for more streamlined definition of view settings
- OpenGLThread and OpenGLView no longer allow the developer to trap Navigator requests in the OpenGL layer. API changes are in progress to add signal handlers to handle the respective signals from the Cascades side.
- the new version of the framework is locked down better to be thread-safe


For more information about our other Open Source projects, visit:

BlackBerry Open Source microsite (http://blackberry.github.com)

To check the Samples Catalog, visit:
Samples Catalog (http://blackberry.github.com/samples)

For more information about Cascades development, visit:
The Cascades microsite (http://developers.blackberry.com/cascades)

Empty file modified GoodCitizenCascades/arm/README.txt 100755 → 100644
Empty file.
Empty file modified GoodCitizenCascades/arm/o.le-v7-g/README.txt 100755 → 100644
Empty file.
Empty file modified GoodCitizenCascades/arm/o.le-v7/README.txt 100755 → 100644
Empty file.
182 changes: 92 additions & 90 deletions GoodCitizenCascades/assets/Color.qml
Expand Up @@ -17,30 +17,45 @@
import bb.cascades 1.0

// Color sliders for changing object color

Page {
id: page

property alias show: panel.visible

content: Container {
id: panel
visible: false

background: Color.create("#262626")
preferredWidth: 768
horizontalAlignment: HorizontalAlignment.Fill
layout: StackLayout {
}

ForeignWindowControl {
id: viewWindow
visible: true // becomes visible once attached
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
}

Container {
leftPadding: 20
rightPadding: leftPadding
topPadding: 10
bottomPadding: topPadding
horizontalAlignment: HorizontalAlignment.Center

layout: StackLayout {
layoutDirection: LayoutDirection.LeftToRight
leftPadding: 20
rightPadding: leftPadding
topPadding: 10
bottomPadding: topPadding
}
layoutProperties: StackLayoutProperties {
horizontalAlignment: HorizontalAlignment.Center
orientation: LayoutOrientation.LeftToRight
}


// A label that presents the current Slider values (with one digit precision).
Label {
text: "R"
preferredWidth: 150
textStyle {
base: SystemDefaults.TextStyles.BigText
base: SystemDefaults.TextStyles.BodyText
fontWeight: FontWeight.Bold
color: Color.White
}
Expand All @@ -51,9 +66,9 @@ Page {
id: redSlider
fromValue: 0
toValue: 1
value: 0
preferredWidth: 450
onValueChanging: {
value: 1
horizontalAlignment: HorizontalAlignment.Fill
onValueChanged: {
// Updating the Label with value from 0 to 255
redtext.text = (value * 255.0).toFixed(0);
updateObjectColor();
Expand All @@ -62,32 +77,33 @@ Page {
Label {
id: redtext
text: "0"
preferredWidth: 120
preferredWidth: 200
textStyle {
base: SystemDefaults.TextStyles.BigText
base: SystemDefaults.TextStyles.BodyText
fontWeight: FontWeight.Normal
alignment: TextAlignment.ForceRight
color: Color.White
textAlign: TextAlign.Right
}
}
}

Container {
leftPadding: 20
rightPadding: leftPadding
topPadding: 10
bottomPadding: topPadding
horizontalAlignment: HorizontalAlignment.Center

layout: StackLayout {
layoutDirection: LayoutDirection.LeftToRight
leftPadding: 20
rightPadding: leftPadding
topPadding: 10
bottomPadding: topPadding
}
layoutProperties: StackLayoutProperties {
horizontalAlignment: HorizontalAlignment.Center
orientation: LayoutOrientation.LeftToRight
}

// A label that presents the current Slider values (with one digit precision).
Label {
text: "G"
preferredWidth: 150
textStyle {
base: SystemDefaults.TextStyles.BigText
base: SystemDefaults.TextStyles.BodyText
fontWeight: FontWeight.Bold
color: Color.White
}
Expand All @@ -99,8 +115,8 @@ Page {
fromValue: 0
toValue: 1
value: 0
preferredWidth: 450
onValueChanging: {
horizontalAlignment: HorizontalAlignment.Fill
onValueChanged: {
// Updating the Label with value from 0 to 255
greentext.text = (value * 255.0).toFixed(0);
updateObjectColor();
Expand All @@ -109,32 +125,32 @@ Page {
Label {
id: greentext
text: "0"
preferredWidth: 120
preferredWidth: 200
textStyle {
base: SystemDefaults.TextStyles.BigText
base: SystemDefaults.TextStyles.BodyText
fontWeight: FontWeight.Normal
alignment: TextAlignment.ForceRight
color: Color.White
textAlign: TextAlign.Right
}
}
}
Container {
leftPadding: 20
rightPadding: leftPadding
topPadding: 10
bottomPadding: topPadding
horizontalAlignment: HorizontalAlignment.Center

layout: StackLayout {
layoutDirection: LayoutDirection.LeftToRight
leftPadding: 20
rightPadding: leftPadding
topPadding: 10
bottomPadding: topPadding
}
layoutProperties: StackLayoutProperties {
horizontalAlignment: HorizontalAlignment.Center
orientation: LayoutOrientation.LeftToRight
}

// A label that presents the current Slider values (with one digit precision).
Label {
text: "B"
preferredWidth: 150
textStyle {
base: SystemDefaults.TextStyles.BigText
base: SystemDefaults.TextStyles.BodyText
fontWeight: FontWeight.Bold
color: Color.White
}
Expand All @@ -146,8 +162,8 @@ Page {
fromValue: 0
toValue: 1
value: 0
preferredWidth: 450
onValueChanging: {
horizontalAlignment: HorizontalAlignment.Fill
onValueChanged: {
// Updating the Label with value from 0 to 255
bluetext.text = (value * 255.0).toFixed(0);
updateObjectColor();
Expand All @@ -156,45 +172,44 @@ Page {
Label {
id: bluetext
text: "0"
preferredWidth: 120
preferredWidth: 200
textStyle {
base: SystemDefaults.TextStyles.BigText
base: SystemDefaults.TextStyles.BodyText
fontWeight: FontWeight.Normal
alignment: TextAlignment.ForceRight
color: Color.White
textAlign: TextAlign.Right
}
}
}
Container {
leftPadding: 20
rightPadding: leftPadding
topPadding: 10
bottomPadding: topPadding
horizontalAlignment: HorizontalAlignment.Center
layout: StackLayout {
layoutDirection: LayoutDirection.LeftToRight
leftPadding: 20
rightPadding: leftPadding
topPadding: 10
bottomPadding: topPadding
}
layoutProperties: StackLayoutProperties {
horizontalAlignment: HorizontalAlignment.Center
orientation: LayoutOrientation.LeftToRight
}

// A label that presents the current Slider values (with one digit precision).
Label {
text: "A"
preferredWidth: 150
textStyle {
base: SystemDefaults.TextStyles.BigText
base: SystemDefaults.TextStyles.BodyText
fontWeight: FontWeight.Bold
color: Color.White
}
}
}

// A simple Slider changing values from 0 to 1.
Slider {
id: alphaSlider
fromValue: 0
toValue: 1
value: 1
preferredWidth: 450
onValueChanging: {
horizontalAlignment: HorizontalAlignment.Fill
onValueChanged: {
// Updating the Label with value from 0 to 255
alphatext.text = (value * 255.0).toFixed(0);
updateObjectColor();
Expand All @@ -203,58 +218,45 @@ Page {
Label {
id: alphatext
text: "255"
preferredWidth: 120
preferredWidth: 200
textStyle {
base: SystemDefaults.TextStyles.BigText
base: SystemDefaults.TextStyles.BodyText
fontWeight: FontWeight.Normal
alignment: TextAlignment.ForceRight
color: Color.White
textAlign: TextAlign.Right
}
}
}
ForeignWindow {
id: viewWindow
preferredWidth: 768
preferredHeight: 650
visible: true // becomes visible once attached
layoutProperties: DockLayoutProperties {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Top
}
}

onCreationCompleted: {
var loadColor = _goodCitizen.objectColor;
console.log(loadColor + ":" + loadColor[0] + ":" + loadColor[1] + ":" + loadColor[2] + ":" + loadColor[3]);

redSlider.value = loadColor[0];
greenSlider.value = loadColor[1];
blueSlider.value = loadColor[2];
alphaSlider.value = loadColor[3];

redtext.text = (loadColor[0] * 255.0).toFixed(0);
greentext.text = (loadColor[1] * 255.0).toFixed(0);
bluetext.text = (loadColor[2] * 255.0).toFixed(0);
alphatext.text = (loadColor[3] * 255.0).toFixed(0);
}
}
/*
actions: [
ActionItem {
title: "Back"
imageAsset: "images/actions/back.png"
//imageSource: "asset:///images/actions/back.png"

onTriggered: {
// _navPane is set in code to make it available for all recipe pages.
_navPane.pop ();
}
page.show = true;
}
]
*/
}

function updateObjectColor() {
var newObjectColor = new Array();
newObjectColor[0] = redSlider.value;
newObjectColor[1] = greenSlider.value;
newObjectColor[2] = blueSlider.value;
newObjectColor[3] = alphaSlider.value;
_goodCitizen.setObjectColor(newObjectColor);
if (page.show == true) {
var newObjectColor = new Array();
newObjectColor[0] = redSlider.value;
newObjectColor[1] = greenSlider.value;
newObjectColor[2] = blueSlider.value;
newObjectColor[3] = alphaSlider.value;
_goodCitizen.setObjectColor(newObjectColor);
}
}

actionBarVisibility: ChromeVisibility.Visible
}

0 comments on commit 2854708

Please sign in to comment.