Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tutorials

Reply
 
LinkBack Thread Tools Display Modes
Old 04-25-2011, 09:02 PM   #1 (permalink)
SuperSuRaccoon
 
Join Date: Apr 2011
Location: china
Age: 25
Posts: 31
SuperSuRaccoon is on a distinguished road
Send a message via Yahoo to SuperSuRaccoon
Default [cocos2d-x-win32] Solution of using the keyboard to simulate accelerometer

This post is a continue of this one:cocos2d-x-Win32_Install_Deploy_Tutorial

It is easy to use the cocos2d-win32+VS2008 to write some codes to learn the cocos2d
but the current dose not support the keyboard input response so that we can not
use the keyboard to simulate the accelermetor.

The whole cocos2d-win32 framework is base on win32 so I tried to make some modification
to the soruce code to make the cclayer response to the keyboard in order to simulate the
accelermetor(like moveing the sprites).

And I finally made it work so I'd like to share it here.

The main point is to redirect the keyboard messages to the taget CCLayer.

Important:
1.The sample codes and tutorial uses the version:cocos2d-0.99.4-x-0.7.1
2.The latest is cocos2d-0.99.5-x-0.8.2, there's been some modification here so we need to do some changes correspondingly:

1)The CCLayer.cpp file has been rename as CCLayer_mobile.cpp
2)In the CCXEGLView_win32.h,do not add the "include "CClayer"", just make a pre-declare: "class CCLayer;"
(or you'll get lots of errors, but I do not know the reseaon yet)
3)Add the include "CClayer" in the CCXEGLView_win32.cpp file

About solution:
1.It just make the CCLayer able to response to the keyboard input, there's not granty the solution is safe and sound
(like the use of the pointer or global stuff), the goal is just to "make it work".
2.The whole solution with images are in the attachment.

Abou Attchment:
1.cocos2d-x-win32_Use_keyboard_to_simulate_accelerometer.xls, the tutorial
2.KeyResponserDemo.rar, Multi CClayers response to the keyboard input
3.DoodleDrop_win32.rar, DoodleDrop win32 version,use keyboard to simulate accelermeter
4.DoodleDrop_iPhone.rar, DoodleDrop iphone version,just for comparison with win32 version
5.The sample project souce dose not contain the cocos2dx foler(it's way too big)

If you have any question or advice feel free to contact me ^_^

You can download all the attachments from the post in my site:
[cocos2d-x-win32] Solution of using the keyboard to simulate accelerometer | SuperSuRaccoon's World
__________________

SuperSuRaccoon is offline   Reply With Quote
Reply

Bookmarks

Tags
cocos2d

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 477
14 members and 463 guests
alexeir, David-T, Dj_kades, foslock, iAppDeveloper, jeroenkeij, LunarMoon, Mijator, Pauluz85, pipposanta, QuantumDoja, robsmy, sacha1996, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,129
Posts: 402,928
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:24 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0