[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paragui-cvs] CVS: paragui/test animation.cpp,1.1,1.1.6.1
From: |
Alexander Pipelka <address@hidden> |
Subject: |
[paragui-cvs] CVS: paragui/test animation.cpp,1.1,1.1.6.1 |
Date: |
Tue, 28 May 2002 16:18:14 -0400 |
Update of /cvsroot/paragui/paragui/test
In directory subversions:/tmp/cvs-serv26030/test
Modified Files:
Tag: devel-1-0
animation.cpp
Log Message:
added PG_TimerObject class
adapted animation sample
Index: animation.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/animation.cpp,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -C2 -r1.1 -r1.1.6.1
*** animation.cpp 15 Apr 2002 13:31:31 -0000 1.1
--- animation.cpp 28 May 2002 20:18:09 -0000 1.1.6.1
***************
*** 11,19 ****
*/
! #include <pgapplication.h>
! #include <pgpopupmenu.h>
! #include <pgbutton.h>
! #include <pgmenubar.h>
! #include <pgscrollbar.h>
#define ID_APP_EXIT 1
--- 11,20 ----
*/
! #include "pgapplication.h"
! #include "pgpopupmenu.h"
! #include "pgbutton.h"
! #include "pgmenubar.h"
! #include "pgscrollbar.h"
! #include "pgtimerobject.h"
#define ID_APP_EXIT 1
***************
*** 43,47 ****
}
! class PlayField : public PG_ThemeWidget {
public:
--- 44,48 ----
}
! class PlayField : public PG_ThemeWidget, public PG_TimerObject {
public:
***************
*** 52,56 ****
~PlayField();
! void timer_callback(void);
protected:
--- 53,57 ----
~PlayField();
! Uint32 eventTimer(Uint32 interval);
protected:
***************
*** 116,137 ****
1
);
}
else if (tickstate == 1) {
DrawHLine(0, my_height/2, my_width-1, my_color.r, my_color.g,
my_color.b);
}
}
! void PlayField::timer_callback(void) {
!
! int prev_tickstate = tickstate;
!
! tickstate = (SDL_GetTicks()/1000)%3;
!
! if (tickstate != prev_tickstate) {
! Update();
! }
}
! class PlayField2 : public PG_ThemeWidget
{
public:
--- 117,134 ----
1
);
+ tickstate = 1;
}
else if (tickstate == 1) {
DrawHLine(0, my_height/2, my_width-1, my_color.r, my_color.g,
my_color.b);
+ tickstate = 0;
}
}
! Uint32 PlayField::eventTimer(Uint32 interval) {
! Update();
! PG_TimerObject::eventTimer(interval);
}
! class PlayField2 : public PG_ThemeWidget, public PG_TimerObject
{
public:
***************
*** 143,147 ****
~PlayField2();
! void timer_callback(void);
protected:
--- 140,144 ----
~PlayField2();
! Uint32 eventTimer(Uint32 interval);
protected:
***************
*** 214,236 ****
}
! void PlayField2::timer_callback(void) {
!
! int prev_tickstate = tickstate;
!
! tickstate = (SDL_GetTicks()%1000)/25;
!
! if (tickstate != prev_tickstate) {
! Update();
}
! }
!
! Uint32 timer_callback(Uint32 interval, void* parameter) {
! ((PlayField2 *)parameter)->timer_callback();
! return interval;
! }
!
! PARAGUI_CALLBACK(appidle_handler) {
! ((PlayField *)clientdata)->timer_callback();
! return true;
}
--- 211,223 ----
}
! Uint32 PlayField2::eventTimer(Uint32 interval) {
! tickstate++;
!
! if(tickstate >= 40) {
! tickstate = 0;
}
!
! Update();
! PG_TimerObject::eventTimer(interval);
}
***************
*** 313,318 ****
);
! // show me your .... lines ;-)
!
anim_test.Show();
--- 300,304 ----
);
! anim_test.AddTimer(500);
anim_test.Show();
***************
*** 321,331 ****
PG_Rect(260, 300, 120, 100)
);
anim_test2.Show();
-
- SDL_Init(SDL_INIT_TIMER);
- SDL_AddTimer(20, timer_callback, (void *)&anim_test2);
-
- app.SetEventCallback(MSG_APPIDLE, appidle_handler, (void *)&anim_test);
- app.EnableAppIdleCalls();
app.Run();
--- 307,313 ----
PG_Rect(260, 300, 120, 100)
);
+
+ anim_test2.AddTimer(50);
anim_test2.Show();
app.Run();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paragui-cvs] CVS: paragui/test animation.cpp,1.1,1.1.6.1,
Alexander Pipelka <address@hidden> <=
- Prev by Date:
[paragui-cvs] CVS: paragui/src/core pgtimerobject.cpp,NONE,1.1.2.1 Makefile.am,1.1.6.1,1.1.6.2
- Next by Date:
[paragui-cvs] CVS: paragui/include pgtimerobject.h,NONE,1.1.2.1 Makefile.am,1.1.1.1,1.1.1.1.6.1
- Previous by thread:
[paragui-cvs] CVS: paragui/src/core pgtimerobject.cpp,NONE,1.1.2.1 Makefile.am,1.1.6.1,1.1.6.2
- Next by thread:
[paragui-cvs] CVS: paragui/include pgtimerobject.h,NONE,1.1.2.1 Makefile.am,1.1.1.1,1.1.1.1.6.1
- Index(es):