Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jashmenn/shapes-panels
paged uiscrollview with cocos2d used in Jacob's Shapes
https://github.com/jashmenn/shapes-panels
Last synced: 3 months ago
JSON representation
paged uiscrollview with cocos2d used in Jacob's Shapes
- Host: GitHub
- URL: https://github.com/jashmenn/shapes-panels
- Owner: jashmenn
- License: other
- Created: 2010-09-07T16:00:00.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-04-07T04:32:10.000Z (almost 14 years ago)
- Last Synced: 2024-10-12T10:26:30.096Z (4 months ago)
- Language: Objective-C
- Homepage: http://www.littlehiccup.com
- Size: 1.07 MB
- Stars: 67
- Watchers: 5
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.mkd
- License: LICENSE.cocos2d
Awesome Lists containing this project
- awesome - shapes-panels - paged uiscrollview with cocos2d used in Jacob's Shapes (etc)
- awesome - shapes-panels - paged uiscrollview with cocos2d used in Jacob's Shapes (etc)
README
# Paging UIScrollView with Previews in Cocos2D
This project shows how to create a paged UIScrollView with Previews
in Cocos2D. It looks like this ([video](http://www.youtube.com/watch?v=2IgbRzGfBHk&fmt=22))
![iPhone Preview](https://github.com/jashmenn/shapes-panels/raw/master/Resources/iphone-preview.jpg)[Watch the video!](http://www.youtube.com/watch?v=2IgbRzGfBHk&fmt=22)
# The Problem
Apple's UIScrollView paging doesn't support an arbitrary width argument. If you
make a UIScrollView with a width smaller than the whole screen, then that view
won't capture touches outside of that area.Additionally, we are mixing Cocoa views and Cocos2d/OpenGL, and how they interact is
not always obvious.# Basic Idea
We create a subclass of `CCMenu` and add panels as items. The `CCMenu` is scrolled
as the `UIScrollView` is scrolled. The `UIScrollView` is set to be smaller than
the whole screen: this gives us previews on either side of the current page.
We create a full-screen `TouchDelegatingView` under the `UIScrollView` and use
that to delegate touches that lie outside the `UIScrollView`.There are a few custom classes mixed in, but that is the basic idea.
![Panels Layers](https://github.com/jashmenn/shapes-panels/raw/master/Resources/shapes-panels-post.jpg)
# Setup
This project uses cocos2d as a referenced project. You can see that in
Project > Edit Project Settings > User Header Search Paths
we have the environment variable `$(COCOS2D_SRC)`. You set up this variable in:
Xcode > Preferences > Source Trees
Then hit the plus '+' and add a variable `COCOS2D_SRC` to point to your cocos2d installation.
# Credits
Written by Nate Murray for [Jacob's Shapes](http://www.littlehiccup.com), an
iPhone game for toddlers.It uses ideas and code from the following sites:
* [http://getsetgames.com/2009/08/21/cocos2d-and-uiscrollview/](http://getsetgames.com/2009/08/21/cocos2d-and-uiscrollview/)
* [http://blog.proculo.de/archives/180-Paging-enabled-UIScrollView-With-Previews.html](http://blog.proculo.de/archives/180-Paging-enabled-UIScrollView-With-Previews.html)
# CHANGELOG
2010-09-17 - fixed how ios 4.1 deals with canceling touches