PX_OBJECT_EVENT_FUNCTION(MyClick)
{
PX_Object_Firework03Create(mp, root, PX_Object_Event_GetCursorX(e), PX_Object_Event_GetCursorY(e));
}
塞入一个printf("%d", (PX_rand() % 3));
则每次点击都会摆动烟花粒子的尾巴,这是什么原理。。随机数共用了么。。
全代码
#include "PainterEngine.h"
PX_OBJECT_EVENT_FUNCTION(MyClick)
{
PX_Object_Firework03Create(mp, root, PX_Object_Event_GetCursorX(e), PX_Object_Event_GetCursorY(e));
printf("%d", (PX_rand() % 3));
}
int main()
{
PX_Object* pObject;
PainterEngine_Initialize(800, 800);
pObject = PX_ObjectCreateFunction(mp, root, 0, 0, 0);
PX_ObjectRegisterEvent(pObject, PX_OBJECT_EVENT_CURSORDOWN, MyClick, PX_NULL);
return 0;
}