| ¸ÞŸ :: À§Á¬ :: GTK :: Sprite. ¸ÞŸ :: À§Á¬ :: GTK :: Sprite´Â C64 ½ºÅ¸ÀÏ ½ºÇÁ¶óÀÌÆ®¸¦ ¼öÇàÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. |
Áö±Ý ´Ù¿î·Îµå |
¸ÞŸ :: À§Á¬ :: GTK :: Sprite. ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- Perl Artistic License
- °Ô½ÃÀÚ À̸§:
- Jeremy Price
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~jeprice/Meta-Widget-Gtk-Sprite-0.01/Sprite.pm
¸ÞŸ :: À§Á¬ :: GTK :: Sprite. ű×
¸ÞŸ :: À§Á¬ :: GTK :: Sprite. ¼³¸í
META :: À§Á¬ :: GTK :: Sprite´Â C64 ½ºÅ¸ÀÏ ½ºÇÁ¶óÀÌÆ®¸¦ ¼öÇàÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. META :: WIDGET :: GTK :: Sprite´Â C64 ½ºÅ¸ÀÏ Sprites¸¦ ¼öÇàÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù .Synopsis »ç¿ë GTK; ±×³ðÀ» »ç¿ëÇϽʽÿÀ; init gnome "test.pl"; meta :: À§Á¬ :: GTK :: Sprite; MY $ MW = NEW GTK :: Window ( "Toplevel"); My ($ ĵ¹ö½º) = ±×³ð :: ĵ¹ö½º -> new (); $ MW-> Ãß°¡ ($ ĵ¹ö½º); $ ĵ¹ö½º -> ¼î; ³» $ croot = $ canvas-> root; MY $ SPRITES = NEW META :: À§Á¬ :: GTK :: Sprite ($ Croot); MY $ P1 = $ SPRITES-> CREATE ( "./ player1.xpm", 100, 0); $ sprites-> slide_to_time ($ p1,5000, 100, 100); MY $ P2 = $ SPRITES-> create ( "./ player2.xpm", 0, 0); $ sprites-> slide_to_speed ($ p2,10, 100, 100); $ sprites-> set_collision_handler (bang); $ mw-> ¼î; GTK-> ÁÖ¿ä; Sub Bang {Print "Bang! N"; Ãⱸ; } Sprite´Â C64ÀÇ °£´ÜÇÑ ±×·¡ÇÈ ÇÁ·Î±×·¡¹ÖÀ» °¡Á® ¿À´Â ¸ðµâÀÔ´Ï´Ù (LookyLikearse ±¸¼º ¿ä¼Ò°¡¾ø´Â Èñ¸ÁÀ¸·Î). ĵ¹ö½º¿¡¼ '½ºÇÁ¶óÀÌÆ®'·Î »çÁøÀ» ¼±¾ð ÇÑ ´ÙÀ½ ÇØ´ç ÁÖÀ§¸¦ À̵¿ÇÏ°í ¼·Î Ãæµ¹½Ãŵ´Ï´Ù. ĵ¹ö½º´Â ±×³ð :: ĵ¹ö½º °´Ã¼ÀÔ´Ï´Ù. sprite.methodsnew meta :: widget :: gtk :: sprite ($ canvas_root)¸¦ ½ÃÀÛÇϱâ Àü¿¡ gtk :: ĵ¹ö½º °´Ã¼¸¦ °¡Á®¾ßÇÕ´Ï´Ù. »õ ¸Þ¼µå´Â ĵ¹ö½º¿¡ ´ëÇÑ Äµ¹ö½º ·çÆ® ¿ÀºêÁ§Æ®¸¦ ÇϳªÀÇ Àμö·Î ÃëÇÕ´Ï´Ù. ´ÙÀ½°ú °°ÀÌ Äµ¹ö½º¿¡¼ ĵ¹ö½º ·çÆ®¸¦ ¾òÀ» ¼ö ÀÖ½À´Ï´Ù : My $ croot = $ canvas-> root; $ sprite_number = $ sprites-> create ( "/ path / to / filename", 10, 20); ¸¸µé±â À̹ÌÁö¸¦·ÎµåÇÕ´Ï´Ù µð½ºÅ©¿¡¼ ÆÄÀÏ (¹Ù·Î Áö±Ý, XPM Çü½Ä ¸¸)À» ¸¸µé°í ½ºÇÁ¶óÀÌÆ®¸¦ ¸¸µå½Ê½Ã¿À. µÎ ¼ýÀڴ ĵ¹ö½ºÀÇ x ¹× y À§Ä¡ÀÔ´Ï´Ù. $ sprites-> show ($ sprite_number); ĵ¹ö½º $ sprites-> ¼û±â±â ($ sprite_number)¿¡ sprite°¡ ³ªÅ¸³³´Ï´Ù. ½ºÇÁ¶óÀÌÆ® ±×¸²À» ĵ¹ö½º¿¡¼ »ç¶óÁö°ÔÇϽʽÿÀ. ±×°ÍÀº ¿©ÀüÈ÷ ´Ù¸¥ ½ºÇÁ¶óÀÌÆ®¿Í Ãæµ¹ ÇÒ ¼ö ÀÖ½À´Ï´Ù. ¾Æ¹«°Íµµ ´©¸£Áö ¾ÊÀ¸·Á¸é ¹æÇØ°¡µÇÁö ¾Ê°Å³ª ÀÚ½ÅÀÇ Ãæµ¹ Çڵ鷯¿¡¼ ±×°ÍÀ» ¹«½ÃÇϰųª ¹«½ÃÇϽʽÿÀ. $ sprites-> Æı« ($ sprite_number); ½ºÇÁ¶óÀÌÆ®¸¦ ¿ÏÀüÈ÷ Æı«ÇÕ´Ï´Ù. $ sprites-> move_to ($ sprite_number, 10, 20); Áï½Ã ÁÖ¾îÁø À§Ä¡·Î $ sprite_number·Î ¸í¸í µÈ sprite¸¦ ÅÚ·¹Æ÷Æ®ÇÕ´Ï´Ù. ´ëºñ slide_to_xxx ÇÔ¼ö. $ sprites-> slile_to_time ($ sprite_number, $ time, 10, 20); ĵ¹ö½º¸¦ ÅëÇØ ½ºÇÁ¶óÀÌÆ® $ sprite_number '½½¶óÀ̵å'¸¦ 10, 20À¸·Î ¸¸µì´Ï´Ù. ±×·¸°ÔÇÏ·Á¸é ½Ã°£ ÃÊ°¡ °É¸± °ÍÀÔ´Ï´Ù. ´À¸®°Ô ¼Óµµ°¡ ³ª°¡´Â °Íó·³ º¸ÀÔ´Ï´Ù. $ sprites -> slile_to_speed ($ sprite_number, $ speed, 10, 20); Sprite $ sprite_number¸¦ 10, 20À¸·Î sprite $ sprite_number·Î '½½¶óÀ̵å'ÇÕ´Ï´Ù. ÃÊ´ç $ ¼Óµµ Çȼ¿ÀÇ ¼Óµµ·Î À̵¿ÇÕ´Ï´Ù. . $ SPRITES-> POS ($ sprite_number); $ sprite_number $ Sprites-> Velocity ($ sprite_number, 5, 6)ÀÇ X ¹× Y ÁÂÇ¥¸¦ ¹ÝȯÇÕ´Ï´Ù. $ sprite_numberÀÇ ¼Óµµ¸¦ ¼³Á¤ÇÕ´Ï´Ù. ¼ýÀÚ´Â x ¹× y ¼ÓµµÀÔ´Ï´Ù. À½¼ö´Â ½ºÇÁ¶óÀÌÆ®°¡ °Å²Ù·Î À̵¿ÇÒ °ÍÀÔ´Ï´Ù. $ sprites-> set_collision_handler (Collision_Handler); µÎ °³ÀÇ ½ºÇÁ¶óÀÌÆ®°¡ Ãæµ¹ ÇÒ ¶§ È£Ãâ µÉ ÇÔ¼ö¸¦ À̸§À¸·Î ÁöÁ¤ÇÕ´Ï´Ù. Ãæµ¹ ŽÁö ½Ã½ºÅÛÀº Áö±Ý ¸Å¿ì ±âÀýÇÕ´Ï´Ù. Ãæµ¹À» È¿À²ÀûÀ¸·Î ŽÁöÇÏ´Â °ÍÀÌ ¸Å¿ì ¾î·Á¿î °ÍÀ¸·Î ¹àÇôÁ³½À´Ï´Ù.ÀÌ ±â´ÉÀº ´ÙÀ½°ú °°ÀÌ È£ÃâµË´Ï´Ù : Collision_Handler ($ sprite_number, $ sprite_number); µÎ °³ÀÇ ½ºÇÁ¶óÀÌÆ® ¼ýÀÚ°¡ Ãæµ¹ ÇÑ µÎ °³ÀÇ ½ºÇÁ¶óÀÌÆ®ÀÔ´Ï´Ù. ¿©·¯ °³ÀÇ ½ºÇÁ¶óÀÌÆ® Ãæµ¹ÇÏ¸é ¸¹Àº Ãæµ¹ 󸮱â ÄݹéÀÌ ¹ß»ýÇÒ ¼ö ÀÖ½À´Ï´Ù. À½»ö Çڵ鷯 Sprite.pmÀ» ¼³Á¤ÇÏ¸é ¸ðµç ¾Ö´Ï¸ÞÀÌ¼Ç ·çÇÁ¸¦ Ãæµ¹Çϱâ À§ÇØ ¸ðµç ½ºÇÁ¶óÀÌÆ®¸¦ È®ÀÎÇÕ´Ï´Ù. ³ª´Â ÀÌ°ÍÀ» ÃÖÀûÈÇÏÁö ¾Ê¾ÒÀ¸¹Ç·Î ´õ ¸¹Àº ½ºÇÁ¶óÀÌÆ®¸¦ Ãß°¡ ÇÒ ¶§ °ÅÀÇ ¾öû³ ¼Óµµ·Î ´À·ÁÁý´Ï´Ù. Ãæµ¹À» ½ºÀ§Ä¡ ²ô±â À§ÇØ Çڵ鷯¸¦ Undef·Î ¼³Á¤ÇÏ·Á¸é Çڵ鷯¸¦ ¼³Á¤ÇϽʽÿÀ. ¿ä±¸ »çÇ× : ¡¤ Perl.
¸ÞŸ :: À§Á¬ :: GTK :: Sprite. °ü·Ã ¼ÒÇÁÆ®¿þ¾î