summaryrefslogtreecommitdiff
path: root/recipes/numptyphysics
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/numptyphysics
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/numptyphysics')
-rw-r--r--recipes/numptyphysics/numptyphysics/faster.patch22
-rw-r--r--recipes/numptyphysics/numptyphysics/gcc43.diff50
-rw-r--r--recipes/numptyphysics/numptyphysics/keyb.patch189
-rw-r--r--recipes/numptyphysics/numptyphysics/keyb.pngbin0 -> 2571 bytes
-rw-r--r--recipes/numptyphysics/numptyphysics/next.pngbin0 -> 7054 bytes
-rw-r--r--recipes/numptyphysics/numptyphysics/numptyphysics.desktop9
-rw-r--r--recipes/numptyphysics/numptyphysics/replay_off.patch166
-rw-r--r--recipes/numptyphysics/numptyphysics_svn.bb42
8 files changed, 478 insertions, 0 deletions
diff --git a/recipes/numptyphysics/numptyphysics/faster.patch b/recipes/numptyphysics/numptyphysics/faster.patch
new file mode 100644
index 0000000000..e52c11e526
--- /dev/null
+++ b/recipes/numptyphysics/numptyphysics/faster.patch
@@ -0,0 +1,22 @@
+--- old_Config.h 2008-11-05 13:45:25.000000000 +0200
++++ Config.h 2008-11-05 13:45:44.000000000 +0200
+@@ -36,14 +36,15 @@
+ # define SELECT_TOLERANCE 8.0f //PIXELS_PER_METREf)
+ # define CLICK_TOLERANCE 16 //PIXELs
+ #else
+-# define ITERATION_RATE 60 //fps
+-# define RENDER_RATE 20 //fps
+-# define SOLVER_ITERATIONS 10
++# define ITERATION_RATE 30 //fps
++# define RENDER_RATE 10 //fps
++# define SOLVER_ITERATIONS 5
+ # define JOINT_TOLERANCE 4.0f //PIXELs
+ # define SELECT_TOLERANCE 5.0f //PIXELS_PER_METREf)
+-# define CLICK_TOLERANCE 4 //PIXELs
++# define CLICK_TOLERANCE 16 //PIXELs
+ #endif
+
++
+ #define ITERATION_TIMESTEPf (1.0f / (float)ITERATION_RATE)
+ #define RENDER_INTERVAL (1000/RENDER_RATE)
+
diff --git a/recipes/numptyphysics/numptyphysics/gcc43.diff b/recipes/numptyphysics/numptyphysics/gcc43.diff
new file mode 100644
index 0000000000..2658771555
--- /dev/null
+++ b/recipes/numptyphysics/numptyphysics/gcc43.diff
@@ -0,0 +1,50 @@
+--- /tmp/Common.h 2008-08-08 15:47:57.000000000 +0200
++++ trunk/Common.h 2008-08-08 15:48:08.403198000 +0200
+@@ -14,6 +14,7 @@
+ *
+ */
+
++#include <cstring>
+ #ifndef COMMON_H
+ #define COMMON_H
+
+--- /tmp/b2Body.h 2008-08-08 15:51:13.000000000 +0200
++++ trunk/Box2D/Source/Dynamics/b2Body.h 2008-08-08 15:52:26.583198000 +0200
+@@ -24,6 +24,7 @@
+ #include "../Collision/b2Shape.h"
+
+ #include <memory>
++#include <cstring>
+
+ class b2Joint;
+ class b2Contact;
+--- /tmp/b2BroadPhase.cpp 2008-08-08 15:53:43.000000000 +0200
++++ trunk/Box2D/Source/Collision/b2BroadPhase.cpp 2008-08-08 15:54:04.913198000 +0200
+@@ -18,6 +18,7 @@
+
+ #include "b2BroadPhase.h"
+ #include <algorithm>
++#include <cstring>
+
+ // Notes:
+ // - we use bound arrays instead of linked lists for cache coherence.
+--- /tmp/b2PolyContact.cpp 2008-08-08 15:55:01.000000000 +0200
++++ trunk/Box2D/Source/Dynamics/Contacts/b2PolyContact.cpp 2008-08-08 15:56:15.553198000 +0200
+@@ -21,6 +21,7 @@
+
+ #include <memory>
+ #include <new>
++#include <cstring>
+
+ b2Contact* b2PolyContact::Create(b2Shape* shape1, b2Shape* shape2, b2BlockAllocator* allocator)
+ {
+--- /tmp/b2BlockAllocator.cpp 2008-08-08 15:57:02.000000000 +0200
++++ trunk/Box2D/Source/Common/b2BlockAllocator.cpp 2008-08-08 15:57:35.833198000 +0200
+@@ -20,6 +20,7 @@
+ #include <cstdlib>
+ #include <memory>
+ #include <climits>
++#include <cstring>
+
+ int32 b2BlockAllocator::s_blockSizes[b2_blockSizes] =
+ {
diff --git a/recipes/numptyphysics/numptyphysics/keyb.patch b/recipes/numptyphysics/numptyphysics/keyb.patch
new file mode 100644
index 0000000000..aa82e67215
--- /dev/null
+++ b/recipes/numptyphysics/numptyphysics/keyb.patch
@@ -0,0 +1,189 @@
+diff -ur oldÃ_Game.cppGame.cpp
+--- old_Game.cpp 2008-11-01 08:56:50.000000000 +0200
++++ Game.cpp 2008-11-01 10:48:33.000000000 +0200
+@@ -896,6 +896,7 @@
+ Window m_window;
+ Overlay *m_pauseOverlay;
+ Overlay *m_editOverlay;
++ Overlay *m_keyboardOverlay;
+ // DemoOverlay m_demoOverlay;
+ Os *m_os;
+ public:
+@@ -905,6 +906,7 @@
+ m_window(width,height,"Numpty Physics","NPhysics"),
+ m_pauseOverlay( NULL ),
+ m_editOverlay( NULL ),
++ m_keyboardOverlay( NULL ),
+ m_os( Os::get() )
+ //,m_demoOverlay( *this )
+ {
+@@ -1038,6 +1040,14 @@
+ && m_overlays.indexOf( m_pauseOverlay ) >= 0;
+ }
+
++ void togglePause()
++ {
++ if ( !m_pauseOverlay ) {
++ m_pauseOverlay = createIconOverlay( *this, "pause.png", 50, 50 );
++ }
++ toggleOverlay( m_pauseOverlay );
++ }
++
+ void edit( bool doEdit )
+ {
+ if ( m_edit != doEdit ) {
+@@ -1080,10 +1090,7 @@
+ case SDLK_SPACE:
+ case SDLK_KP_ENTER:
+ case SDLK_RETURN:
+- if ( !m_pauseOverlay ) {
+- m_pauseOverlay = createIconOverlay( *this, "pause.png", 50, 50 );
+- }
+- toggleOverlay( m_pauseOverlay );
++ togglePause();
+ break;
+ case SDLK_s:
+ case SDLK_F4:
+@@ -1094,6 +1191,10 @@
+ edit( !m_edit );
+ break;
+ case SDLK_d:
++ if ( !m_keyboardOverlay ) {
++ m_keyboardOverlay = createKeyboardOverlay(*this);
++ }
++ toggleOverlay( m_keyboardOverlay );
+ //toggleOverlay( m_demoOverlay );
+ break;
+ case SDLK_r:
+@@ -1154,6 +1165,19 @@
+ return false;
+ }
+
++ void undoLastStroke()
++ {
++ if ( m_createStroke ) {
++ m_scene.deleteStroke( m_createStroke );
++ m_createStroke = NULL;
++ } else {
++ m_scene.deleteStroke( m_scene.strokes().at(m_scene.strokes().size()-1) );
++ }
++ m_refresh = true;
++ }
++
++
++
+ bool handlePlayEvent( SDL_Event &ev )
+ {
+ switch( ev.type ) {
+@@ -1197,13 +1221,7 @@
+ break;
+ case SDL_KEYDOWN:
+ if ( ev.key.keysym.sym == SDLK_ESCAPE ) {
+- if ( m_createStroke ) {
+- m_scene.deleteStroke( m_createStroke );
+- m_createStroke = NULL;
+- } else {
+- m_scene.deleteStroke( m_scene.strokes().at(m_scene.strokes().size()-1) );
+- }
+- m_refresh = true;
++ undoLastStroke();
+ }
+ break;
+ default:
+@@ -1250,6 +1268,10 @@
+ {
+ Overlay *completedOverlay = createNextLevelOverlay(*this);
+
++ //toggle onScreenKeyboard ON
++ m_keyboardOverlay = createKeyboardOverlay(*this);
++ toggleOverlay( m_keyboardOverlay );
++
+ m_scene.draw( m_window, FULLSCREEN_RECT );
+ m_window.update( FULLSCREEN_RECT );
+
+diff -ur old_Game.h Game.h
+--- old_Game.h 2008-11-01 08:56:50.000000000 +0200
++++ Game.h 2008-11-01 09:27:22.000000000 +0200
+@@ -41,6 +41,9 @@
+ virtual void gotoLevel( int l, bool replay=false ) {}
+ Levels& levels() { return m_levels; }
+ virtual bool renderScene( Canvas& c, int level ) =0;
++ virtual void togglePause() {}
++ virtual void undoLastStroke() {}
++ virtual void edit( bool editting ) {}
+ bool m_quit;
+ bool m_edit;
+ bool m_refresh;
+diff -ur old_Overlay.cpp Overlay.cpp
+--- old_Overlay.cpp 2008-11-01 08:56:50.000000000 +0200
++++ Overlay.cpp 2008-11-01 09:45:57.000000000 +0200
+@@ -311,7 +311,51 @@
+ }
+ };
+
++class KeyboardOverlay : public IconOverlay
++{
++ int m_saving, m_sending;
++public:
++ KeyboardOverlay( GameControl& game )
++ : IconOverlay(game,"keyb.png",0,0,true),
++ m_saving(0),
++ m_sending(0)
++ {}
++
++ int index( int x, int y )
++ {
++ //these values correspond with keyb.png (in pixels)
++ int sizeOfElement = 20;
++
++ int colum = x/sizeOfElement;
++ int row = y/sizeOfElement;
++ return row*3+colum;
++ }
++
++ virtual void draw( Canvas& screen )
++ {
++ IconOverlay::draw( screen );
++ }
+
++ virtual bool onClick( int x, int y )
++ {
++ int i = index(x,y);
++ //printf("i= %d\n",i); return 0;
++ switch (i) {
++ case -1: return false;
++ case 0: m_game.undoLastStroke(); break;
++ case 1: m_game.togglePause(); break;
++ case 2: m_game.m_quit=true; break;
++ case 3: break;
++ case 4: m_game.edit( !m_game.m_edit ); break;
++ case 5: break;
++ case 6: m_game.gotoLevel(m_game.m_level-1); break;
++ case 7: m_game.gotoLevel(m_game.m_level); break;
++ case 8: m_game.gotoLevel(m_game.m_level+1); break;
++ default: break;
++ }
++ return true;
++ }
++};
+
+
+ Overlay* createIconOverlay( GameControl& game, const char* file,
+@@ -330,3 +383,8 @@
+ {
+ return new NextLevelOverlay( game );
+ }
++
++extern Overlay* createKeyboardOverlay( GameControl& game )
++{
++ return new KeyboardOverlay( game );
++}
+diff -ur old_Overlay.h Overlay.h
+--- old_Overlay.h 2008-11-01 08:56:50.000000000 +0200
++++ Overlay.h 2008-11-01 09:44:16.000000000 +0200
+@@ -45,4 +45,5 @@
+
+ extern Overlay* createNextLevelOverlay( GameControl& game );
+
++extern Overlay* createKeyboardOverlay( GameControl& game );
+ #endif //OVERLAY_H
diff --git a/recipes/numptyphysics/numptyphysics/keyb.png b/recipes/numptyphysics/numptyphysics/keyb.png
new file mode 100644
index 0000000000..4d77e88fd9
--- /dev/null
+++ b/recipes/numptyphysics/numptyphysics/keyb.png
Binary files differ
diff --git a/recipes/numptyphysics/numptyphysics/next.png b/recipes/numptyphysics/numptyphysics/next.png
new file mode 100644
index 0000000000..21a94ce1dc
--- /dev/null
+++ b/recipes/numptyphysics/numptyphysics/next.png
Binary files differ
diff --git a/recipes/numptyphysics/numptyphysics/numptyphysics.desktop b/recipes/numptyphysics/numptyphysics/numptyphysics.desktop
new file mode 100644
index 0000000000..5ebefb66d9
--- /dev/null
+++ b/recipes/numptyphysics/numptyphysics/numptyphysics.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=numptyphysics
+Comment=Physics Game
+Note=Simulate Objects
+Exec=numptyphysics
+Icon=star.png
+Type=Application
+Categories=Games
+
diff --git a/recipes/numptyphysics/numptyphysics/replay_off.patch b/recipes/numptyphysics/numptyphysics/replay_off.patch
new file mode 100644
index 0000000000..e2f606ea64
--- /dev/null
+++ b/recipes/numptyphysics/numptyphysics/replay_off.patch
@@ -0,0 +1,166 @@
+--- old_Game.cpp 2008-10-30 15:46:15.000000000 +0200
++++ Game.cpp 2008-10-30 15:49:14.000000000 +0200
+@@ -1197,100 +1197,9 @@
+ }
+ };
+
+-class DemoRecorder
+-{
+-public:
+-
+- void start()
+- {
+- m_running = true;
+- m_log.empty();
+- m_log.capacity(512);
+- m_lastTick = 0;
+- m_lastTickTime = SDL_GetTicks();
+- }
+
+- void stop()
+- {
+- printf("stop recording: %d events\n",m_log.size());
+- m_running = false;
+- }
+
+- void tick()
+- {
+- if ( m_running ) {
+- m_lastTick++;
+- m_lastTickTime = SDL_GetTicks();
+- }
+- }
+
+- void record( SDL_Event& ev )
+- {
+- if ( m_running ) {
+- m_log.append( m_lastTick, SDL_GetTicks()-m_lastTickTime, ev );
+- }
+- }
+-
+- DemoLog& getLog() { return m_log; }
+-
+-private:
+- bool m_running;
+- DemoLog m_log;
+- int m_lastTick;
+- int m_lastTickTime;
+-};
+-
+-
+-class DemoPlayer
+-{
+-public:
+-
+- void start( const DemoLog* log )
+- {
+- m_playing = true;
+- m_log = log;
+- m_index = 0;
+- m_lastTick = 0;
+- m_lastTickTime = SDL_GetTicks();
+- printf("start playback: %d events\n",m_log->size());
+- }
+-
+- bool isRunning() { return m_playing; }
+-
+- void stop()
+- {
+- m_playing = false;
+- m_log = NULL;
+- }
+-
+- void tick()
+- {
+- if ( m_playing ) {
+- m_lastTick++;
+- m_lastTickTime = SDL_GetTicks();
+- }
+- }
+-
+- bool fetchEvent( SDL_Event& ev )
+- {
+- if ( m_playing
+- && m_index < m_log->size()
+- && m_log->at(m_index).t <= m_lastTick
+- && m_log->at(m_index).o <= SDL_GetTicks()-m_lastTickTime ) {
+- ev = m_log->at(m_index).e;
+- m_index++;
+- return true;
+- }
+- return false;
+- }
+-
+-private:
+- bool m_playing;
+- const DemoLog* m_log;
+- int m_index;
+- int m_lastTick;
+- int m_lastTickTime;
+-};
+
+
+ class Game : public GameParams
+@@ -1303,8 +1212,6 @@
+ IconOverlay m_pauseOverlay;
+ EditOverlay m_editOverlay;
+ // DemoOverlay m_demoOverlay;
+- DemoRecorder m_recorder;
+- DemoPlayer m_player;
+ Os *m_os;
+ public:
+ Game( int width, int height )
+@@ -1328,15 +1235,11 @@
+ if ( m_edit ) {
+ m_scene.protect(0);
+ }
+- m_recorder.stop();
+- m_player.stop();
+ if ( replay ) {
+ // for ( int i=0; i<m_recorder.getLog().size(); i++ ) {
+ // printf("DEMO: %s\n",m_recorder.getLog().asString(i).c_str());
+ // }
+- m_player.start( &m_recorder.getLog() );
+ } else {
+- m_recorder.start();
+ }
+ return true;
+ }
+@@ -1659,26 +1562,23 @@
+ while ( iterateCounter < ITERATION_RATE ) {
+ if ( !isPaused() ) {
+ m_scene.step();
+- m_recorder.tick();
+- m_player.tick();
+ }
+
+ SDL_Event ev;
+ bool more = true;
+ while ( more ) {
+ more = SDL_PollEvent(&ev);
+- if ( m_player.isRunning()
++ if ( 0
+ && ( ev.type==SDL_MOUSEMOTION ||
+ ev.type==SDL_MOUSEBUTTONDOWN ||
+ ev.type==SDL_MOUSEBUTTONUP ) ) {
+ more = false; //discard
+ }
+ if (!more) {
+- more = m_player.fetchEvent(ev);
++ more = 0;
+ }
+ if ( more ) {
+ bool handled = false;
+- m_recorder.record( ev );
+ for ( int i=m_overlays.size()-1; i>=0 && !handled; i-- ) {
+ handled = m_overlays[i]->handleEvent(ev);
+ }
+@@ -1703,8 +1603,6 @@
+ if ( m_scene.isCompleted() != isComplete && !m_edit ) {
+ isComplete = m_scene.isCompleted();
+ if ( isComplete ) {
+- m_player.stop();
+- m_recorder.stop();
+ showOverlay( completedOverlay );
+ } else {
+ hideOverlay( completedOverlay );
diff --git a/recipes/numptyphysics/numptyphysics_svn.bb b/recipes/numptyphysics/numptyphysics_svn.bb
new file mode 100644
index 0000000000..d8247b588a
--- /dev/null
+++ b/recipes/numptyphysics/numptyphysics_svn.bb
@@ -0,0 +1,42 @@
+DESCRIPTION = "Numpty Physics is a drawing puzzle game in the spirit (and style?) \
+of Crayon Physics using the same excellent Box2D engine."
+DEPENDS = "virtual/libsdl libsdl-image libpng"
+RDEPENDS += "libpng"
+LICENSE = "GPL"
+HOMEPAGE = "http://numptyphysics.garage.maemo.org/"
+SECTION = "x11/games"
+PV = "0.2+svnr${SRCREV}"
+PR = "r1"
+
+inherit autotools
+
+SRC_URI = "\
+# Maemo garage is sadly only available with https. Can make you trouble while fetching without accepting the certificate.
+ svn://garage.maemo.org/svn/${PN};module=trunk;proto=https \
+ http://wwwpub.zih.tu-dresden.de/~mkluge/numptyphysics_setup.tgz \
+ file://replay_off.patch;patch=1;pnum=0 \
+ file://next.png \
+ file://keyb.patch;patch=1;pnum=0 \
+ file://keyb.png \
+ file://faster.patch;patch=1;pnum=0 \
+ file://numptyphysics.desktop \
+"
+S = "${WORKDIR}/trunk"
+
+EXTRA_S = "${WORKDIR}/local/packages/numptyphysics"
+
+do_configure_append() {
+ mv ../next.png data
+ mv ../keyb.png data
+}
+
+do_install_append() {
+ install -d ${D}${datadir}/numptyphysics
+ install -d ${D}${datadir}/pixmaps
+ install -d ${D}${datadir}/applications
+ install -m 0644 ${EXTRA_S}/star.png ${D}${datadir}/pixmaps
+ install -m 0644 ../numptyphysics.desktop ${D}/${datadir}/applications
+ cp -a ${EXTRA_S}/data/* data/keyb.png ${D}/${datadir}/numptyphysics/
+}
+
+FILES_${PN} += "${datadir}"