Skip to content

Master #2

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2016 Code on Canvas Pty Ltd, http://CodeOnCanvas.cc

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

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.
29 changes: 18 additions & 11 deletions ci-samples/ScrollViewSample/src/Grid.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
//
// ┌─┐╔═╗┌┬┐┌─┐
// │ ║ ║ ││├┤
// └─┘╚═╝─┴┘└─┘
// ┌─┐┌─┐╔╗╔┬ ┬┌─┐┌─┐
// │ ├─┤║║║└┐┌┘├─┤└─┐
// └─┘┴ ┴╝╚╝ └┘ ┴ ┴└─┘
// http://CodeOnCanvas.cc
//
// Created by Rene Christen on 28/01/2016.
// Copyright (c) 2016, Code on Canvas Pty Ltd//
/**
*
* ┌─┐╔═╗┌┬┐┌─┐
* │ ║ ║ ││├┤
* └─┘╚═╝─┴┘└─┘
* ┌─┐┌─┐╔╗╔┬ ┬┌─┐┌─┐
* │ ├─┤║║║└┐┌┘├─┤└─┐
* └─┘┴ ┴╝╚╝ └┘ ┴ ┴└─┘
*
* Copyright (c) 2016 Code on Canvas Pty Ltd, http://CodeOnCanvas.cc
*
* This software is distributed under the MIT license
* https://tldrlegal.com/license/mit-license
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code
*
**/

#include "Grid.h"

Expand Down
30 changes: 18 additions & 12 deletions ci-samples/ScrollViewSample/src/Grid.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
//
// ┌─┐╔═╗┌┬┐┌─┐
// │ ║ ║ ││├┤
// └─┘╚═╝─┴┘└─┘
// ┌─┐┌─┐╔╗╔┬ ┬┌─┐┌─┐
// │ ├─┤║║║└┐┌┘├─┤└─┐
// └─┘┴ ┴╝╚╝ └┘ ┴ ┴└─┘
// http://CodeOnCanvas.cc
//
// Created by Rene Christen on 28/01/2016.
// Copyright (c) 2016, Code on Canvas Pty Ltd//
/**
*
* ┌─┐╔═╗┌┬┐┌─┐
* │ ║ ║ ││├┤
* └─┘╚═╝─┴┘└─┘
* ┌─┐┌─┐╔╗╔┬ ┬┌─┐┌─┐
* │ ├─┤║║║└┐┌┘├─┤└─┐
* └─┘┴ ┴╝╚╝ └┘ ┴ ┴└─┘
*
* Copyright (c) 2016 Code on Canvas Pty Ltd, http://CodeOnCanvas.cc
*
* This software is distributed under the MIT license
* https://tldrlegal.com/license/mit-license
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code
*
**/

#pragma once

Expand All @@ -28,4 +35,3 @@ class Grid {
ci::vec2 size;

};//class Grid

27 changes: 23 additions & 4 deletions ci-samples/ScrollViewSample/src/ScrollViewSampleApp.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/**
*
* ┌─┐╔═╗┌┬┐┌─┐
* │ ║ ║ ││├┤
* └─┘╚═╝─┴┘└─┘
* ┌─┐┌─┐╔╗╔┬ ┬┌─┐┌─┐
* │ ├─┤║║║└┐┌┘├─┤└─┐
* └─┘┴ ┴╝╚╝ └┘ ┴ ┴└─┘
*
* Copyright (c) 2016 Code on Canvas Pty Ltd, http://CodeOnCanvas.cc
*
* This software is distributed under the MIT license
* https://tldrlegal.com/license/mit-license
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code
*
**/

#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
Expand All @@ -24,7 +43,7 @@ class ScrollViewSampleApp : public App {
coc::ciScrollView scrollView;

Grid grid;

bool bUserInteractionManual;
};

Expand All @@ -35,12 +54,12 @@ static void prepareSettings( App::Settings *settings ) {
void ScrollViewSampleApp::setup() {

grid.setup(2048, 2048);

windowRect = Rectf(getWindowBounds()) * .9;
windowRect.offsetCenterTo(getWindowBounds().getCenter());

contentRect = Rectf(0,0,grid.getWidth(),grid.getHeight());

bUserInteractionManual = true;

//----------------------------------------------------------
Expand Down Expand Up @@ -76,7 +95,7 @@ void ScrollViewSampleApp::draw() {

gl::color( Color( .5,.5,.5 ) );
gl::drawSolidRect(windowRect);

scrollView.begin();
grid.draw();
scrollView.end();
Expand Down
31 changes: 19 additions & 12 deletions ci-samples/ScrollViewSample/xcode/cocMath.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
// ┌─┐╔═╗┌┬┐┌─┐
// │ ║ ║ ││├┤
// └─┘╚═╝─┴┘└─┘
// ┌─┐┌─┐╔╗╔┬ ┬┌─┐┌─┐
// │ ├─┤║║║└┐┌┘├─┤└─┐
// └─┘┴ ┴╝╚╝ └┘ ┴ ┴└─┘
// http://codeoncanvas.cc
//
// Created by Rene Christen on 28/01/2016.
// Copyright (c) 2016, Code on Canvas Pty Ltd
//
/**
*
* ┌─┐╔═╗┌┬┐┌─┐
* │ ║ ║ ││├┤
* └─┘╚═╝─┴┘└─┘
* ┌─┐┌─┐╔╗╔┬ ┬┌─┐┌─┐
* │ ├─┤║║║└┐┌┘├─┤└─┐
* └─┘┴ ┴╝╚╝ └┘ ┴ ┴└─┘
*
* Copyright (c) 2016 Code on Canvas Pty Ltd, http://CodeOnCanvas.cc
*
* This software is distributed under the MIT license
* https://tldrlegal.com/license/mit-license
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code
*
**/

#include "cocMath.h"

Expand Down Expand Up @@ -119,4 +126,4 @@ float lerp(float a, float b, float amount) {

#endif

}
}
33 changes: 23 additions & 10 deletions of-ios-ScrollViewExample/src/Grid.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
//
// Grid.cpp
// Created by Lukasz Karluk on 15/07/2014.
// http://julapy.com/
//
/**
*
* ┌─┐╔═╗┌┬┐┌─┐
* │ ║ ║ ││├┤
* └─┘╚═╝─┴┘└─┘
* ┌─┐┌─┐╔╗╔┬ ┬┌─┐┌─┐
* │ ├─┤║║║└┐┌┘├─┤└─┐
* └─┘┴ ┴╝╚╝ └┘ ┴ ┴└─┘
*
* Copyright (c) 2014-2016 Code on Canvas Pty Ltd, http://CodeOnCanvas.cc
*
* This software is distributed under the MIT license
* https://tldrlegal.com/license/mit-license
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code
*
**/

#include "Grid.h"

Expand All @@ -28,30 +41,30 @@ void Grid::draw() {
int numOfCols = 20;
float rowSize = height / numOfRows;
float colSize = width / numOfCols;

ofSetColor(0);

ofNoFill();
ofSetColor(ofColor::red);
ofSetLineWidth(2.0);
ofDrawRectangle(0, 0, width, height);

for(int yi=1; yi<numOfRows; yi++) {
int x0 = 0;
int x1 = width;
int y0 = yi * rowSize;
int y1 = y0;
ofDrawLine(x0, y0, x1, y1);
}

for(int xi=1; xi<numOfCols; xi++) {
int x0 = xi * colSize;
int x1 = x0;
int y0 = 0;
int y1 = height;
ofDrawLine(x0, y0, x1, y1);
}

ofFill();
ofSetColor(255);
ofSetLineWidth(1.0);
Expand Down
29 changes: 21 additions & 8 deletions of-ios-ScrollViewExample/src/Grid.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
//
// Grid.h
// Created by Lukasz Karluk on 15/07/2014.
// http://julapy.com/
//
/**
*
* ┌─┐╔═╗┌┬┐┌─┐
* │ ║ ║ ││├┤
* └─┘╚═╝─┴┘└─┘
* ┌─┐┌─┐╔╗╔┬ ┬┌─┐┌─┐
* │ ├─┤║║║└┐┌┘├─┤└─┐
* └─┘┴ ┴╝╚╝ └┘ ┴ ┴└─┘
*
* Copyright (c) 2014-2016 Code on Canvas Pty Ltd, http://CodeOnCanvas.cc
*
* This software is distributed under the MIT license
* https://tldrlegal.com/license/mit-license
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code
*
**/

#pragma once

#include "ofMain.h"

class Grid {

public:

Grid();
~Grid();

float getWidth();
float getHeight();
void draw();

float width;
float height;
};
33 changes: 25 additions & 8 deletions of-ios-ScrollViewExample/src/ofApp.h
Original file line number Diff line number Diff line change
@@ -1,39 +1,56 @@
/**
*
* ┌─┐╔═╗┌┬┐┌─┐
* │ ║ ║ ││├┤
* └─┘╚═╝─┴┘└─┘
* ┌─┐┌─┐╔╗╔┬ ┬┌─┐┌─┐
* │ ├─┤║║║└┐┌┘├─┤└─┐
* └─┘┴ ┴╝╚╝ └┘ ┴ ┴└─┘
*
* Copyright (c) 2016 Code on Canvas Pty Ltd, http://CodeOnCanvas.cc
*
* This software is distributed under the MIT license
* https://tldrlegal.com/license/mit-license
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code
*
**/

#pragma once

#include "ofxiOS.h"
#include "ofxScrollView.h"
#include "Grid.h"

class ofApp : public ofxiOSApp {

public:

void setup();
void update();
void draw();
void exit();

void touchDown(ofTouchEventArgs & touch);
void touchMoved(ofTouchEventArgs & touch);
void touchUp(ofTouchEventArgs & touch);
void touchDoubleTap(ofTouchEventArgs & touch);
void touchCancelled(ofTouchEventArgs & touch);

void lostFocus();
void gotFocus();
void gotMemoryWarning();
void deviceOrientationChanged(int newOrientation);

coc::Rect windowRect;
coc::Rect contentRect;
ofxScrollView scrollView;

Grid grid;
ofTexture image;

ofVec2f touchPoint;
float touchTime = 0.0;

};


Loading