Skip to content
Browse files

update multitouch sample

  • Loading branch information...
1 parent c7cf245 commit 4b2da31c1c87e531f6a78de0fea240d0894afe3b @RandomEtc committed Aug 2, 2011
View
29 samples/MultiTouch/src/MultiTouchApp.cpp
@@ -2,7 +2,7 @@
#include "cinder/gl/TextureFont.h"
#include "Map.h"
#include "OpenStreetMapProvider.h"
-//#include "TemplatedMapProvider.h"
+#include "TemplatedMapProvider.h"
using namespace ci;
using namespace ci::gl;
@@ -21,6 +21,8 @@ class MultiTouchApp : public AppNative {
void resize( ResizeEvent event);
+ void keyUp( KeyEvent event );
+
void touchesBegan( TouchEvent event );
void touchesMoved( TouchEvent event );
void touchesEnded( TouchEvent event );
@@ -42,14 +44,29 @@ void MultiTouchApp::setup()
mMap.setup( OpenStreetMapProvider::create(), getWindowSize());
// mMap.setup( TemplatedMapProvider::create("http://localhost:8000/{Z}/{Y}-{X}.png", 0, 5), getWindowSize());
mMap.setExtent( MapExtent(61.087969, 49.250497, 3.686775, -12.353263) );
- setFullScreen( true );
+// setFullScreen( true );
}
void MultiTouchApp::update()
{
mMap.update();
}
+void MultiTouchApp::keyUp( KeyEvent event )
+{
+// mMap = Map();
+// mMap.setup( OpenStreetMapProvider::create(), getWindowSize());
+ if (event.getChar() == 'o') {
+ mMap.setMapProvider( OpenStreetMapProvider::create() );
+ }
+ else if (event.getChar() == 'l') {
+ mMap.setMapProvider( TemplatedMapProvider::create("http://localhost:8000/{Z}/{Y}-{X}.png", 0, 5) );
+ }
+// else if (event.getKey() == 'b') {
+ // TODO: Bing
+// }
+}
+
void MultiTouchApp::draw()
{
gl::clear( Color::white() );
@@ -63,10 +80,12 @@ void MultiTouchApp::draw()
gl::enableAlphaBlending();
// draw copyright notice
- gl::color( Color::white() );
string notice = "Map data CC-BY-SA OpenStreetMap.org contributors.";
Vec2f noticeSize = mTextureFont->measureString(notice);
Vec2f noticePadding(10.0f,10.0f - mTextureFont->getFont().getAscent());
+ gl::color( Color::black() );
+ mTextureFont->drawString(notice, windowSize - noticeSize - noticePadding + Vec2f(1,1));
+ gl::color( Color::white() );
mTextureFont->drawString(notice, windowSize - noticeSize - noticePadding);
// draw touch points:
@@ -126,9 +145,9 @@ void MultiTouchApp::touchesEnded( TouchEvent event )
void MultiTouchApp::resize( ResizeEvent event )
{
- MapExtent extent = mMap.getExtent();
+// MapExtent extent = mMap.getExtent();
mMap.setSize( getWindowSize() );
- mMap.setExtent( extent ); // TODO: optionally, don't snap to integer zoom
+// mMap.setExtent( extent, false ); // TODO: optionally, don't fit biggest dimension but preserve smallest instead?
}
CINDER_APP_NATIVE( MultiTouchApp, RendererGl )
View
8 samples/MultiTouch/xcode_iOS/MultiTouch.xcodeproj/project.pbxproj
@@ -272,7 +272,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = i386;
+ ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
@@ -293,15 +293,15 @@
);
PRODUCT_NAME = MultiTouch;
TARGETED_DEVICE_FAMILY = "1,2";
- VALID_ARCHS = i386;
+ VALID_ARCHS = "armv7 armv6 i386";
};
name = Debug;
};
1D6058950D05DD3E006BFB54 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = i386;
+ ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
COPY_PHASE_STRIP = YES;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -320,7 +320,7 @@
);
PRODUCT_NAME = MultiTouch;
TARGETED_DEVICE_FAMILY = "1,2";
- VALID_ARCHS = i386;
+ VALID_ARCHS = "armv7 armv6 i386";
};
name = Release;
};

0 comments on commit 4b2da31

Please sign in to comment.
Something went wrong with that request. Please try again.