SDL & Object Pascal (Delphi) [3] ÖÆ×÷Ò»¸öÑ¡µ¥
Ò»¸öÑ¡µ¥´óÖÂÊÇÕâÑù£º
1.¿ÉÒÔ±»ÒÔijÖÖÐÎʽºô½Ð³öÀ´£¬Èç°´ÏÂesc£»
2.ÔÚÕâ¸öÑ¡µ¥Öй¦ÄܼüÓв»Í¬µÄ¶¨Ò壬ÈçÔ±¾·½Ïò¼ü¿ØÖÆ×ß·£¬µ«ÏÖÔÚ¸ÄΪ¿ØÖƹâ±êµÄλÖã»
3.°´ÏÂÈ·¶¨¼üºóÓжÔÓ¦¹¦Äܱ»Ö´ÐУ»
4.¿ÉÒÔ±»¹Ø±Õ¡£
ÄÇôÎҵİ취ÊDZàдÁ½¸ö×ӳ̣¬ÆäÖÐÒ»¸ö´¦ÀíÑ¡µ¥ÖеÄʼþ£¬ÁíÍâÒ»¸öרߺÔð»Ñ¡µ¥¡£
ÔÚ´Ó²½ÐÐÇл»µ½Ñ¡µ¥µÄʱºò£¬¿ÉÄÜÐèÒªÇå³ýµ±Ç°µÄ¼üÖµ¡£Èç¹û²½ÐÐÖÐʹÓÃÁËSDL_EnableKeyRepeat·½·¨°Ñ¼üÅ̵ÄƵÂʱä¸ß£¬¶ÔÓÚÑ¡µ¥À´Ëµ¾ÍÌ«¿ìÁË¡£ËùÒÔ¿ÉÄÜÒªÔÚµ÷ÓÃÑ¡µ¥Ö®Ç°Ð´ÉÏ£º
SDL_EnableKeyRepeat(0, 0);
event.key.keysym.sym := 0;
ÕâÑù½µµÍÁ˼üÅ̵ķ´Ó¦£¬Í¬Ê±Çå³ýµ±Ç°µÄ¼üÖµ£¬Òª²»È»ºô³öÑ¡µ¥Ö®ºóËü¿ÉÄÜ»¹»á×Ô¼º×ªÒ»»á£¨Èç¹û֮ǰÓÃÁËPollEvent·½Ê½£¬ÎÒ»¹Ã»¸ãÇå³þÔÒò£©¡£²»¹ýÈç¹ûÔÚÐÐ×ßÖÐʹÓõÄÊÇWaitEvent·½Ê½£¬ÊÂÇé¾Í»á¼òµ¥ºÜ¶à¡£PollEvent·½Ê½¿´À´ÊÇÌ«¿ìÁË£¬ÔÚÑ¡µ¥Öв»ºÏÊÊ¡£
´¦ÀíÑ¡µ¥Ê¼þµÄ×ӳ̣º
procedure MenuSystem;
var
menu: integer;
begin
while (SDL_WaitEvent(@event) >= 0) do
begin
case event.type_ of
SDL_QUITEV: //ÕâÀï´¦Àí´°¿ÚÍ˳öʼþ
if messagebox(0, 'Are you sure to quit?', 'KYS Windows', MB_OKCANCEL) = IDOK then Quit;
SDL_KEYUP:
begin
if (event.key.keysym.sym = sdlk_down) then
begin
menu := menu+1;
if menu > 3 then menu := 0; //°´ÏÂϼüµÄÒç³ö
showMenusystem(menu); //ÿ´Îµ±Ç°Ñ¡Öз¢Éú±ä»¯Ê±, ¾ùÖػѡµ¥
end;
if (event.key.keysym.sym = sdlk_up) then
begin
Ïà¹ØÎĵµ£º
Delphi¼üÅÌ°´¼üαÂë
Ó÷¨£ºif key = chr(VK_RETURN) then...
³£ÊýÃû³Æ Ê®Áù½øÖÆÖµ Ê®½øÖÆÖµ ¶ÔÓ¦°´¼ü
VK_LBUTTON 01 1 Êó±êµÄ×ó¼ü
VK_RBUTTON 02 2 Êó±êµÄÓÒ¼ü
VK-CANCEL 03 3 Contol-break Ö´ÐÐ
VK_MBUTTON 04 4 Êó±êµÄÖмü£¨Èý°´¼üÊó±ê)
VK_BACK 08 8 Backspace¼ü
VK_TAB 09 9 Tab¼ü
VK_CLEAR 0C 12 Clear¼ü
VK ......
DelphiÕýÔò±í´ïʽʹÓ÷½·¨£¨TPerlRegEx£©
Õý ÎÄ£º
ʹÓÃDelphi¿ª·¢Èí¼þÎÞÒÉÊÇÒ»ÖֱȽϸßЧÂʵķ½Ê½£¬ÍêÈ«¶ÔÏóµÄÓïÑÔ£¬Ñϸñ¿ØÖƵÄÓï·¨£¬¿ÉÊÓ»¯¿ª·¢»·¾³µÄÐÔÄÜ£¬±àÒëÆ÷µÄËٶȺÍÒѱàÒë´úÂëµÄЧÂÊ£¬±à³ÌÓïÑԵŦÄܼ°Æ临ÔÓÐÔ£¬Êý¾Ý¿â½á¹¹µÄÁé»îÐԺͿÉÀ©Õ¹ÐÔ£¬¿ò¼Ü¶ÔÉè¼ÆºÍʹÓÃģʽµÄÀ©³äÎÞÒɶ¼ÊÇdelph ......
ÔÚ±àÖÆÁËÒ»¸öÓ¦ÓóÌÐòºóµÄά»¤½×¶Î£¬ÎÒÃÇ»áÃæÁÙ¸øÓ¦ÓóÌÐòÉý¼¶µÄ¹¤×÷.ÎÞÒÉ£¬ÊÖ¹¤Éý¼¶µÄ¹¤×÷ÊÇÊ®·Ö·±ËöµÄ£¬Äã¿ÉÄÜ»áÐèÒªµ½Óû§µÄ»úÆ÷ÉÏÈ¥¸üÐÂÎļþ.¿ÉÊÇ£¬Èç¹ûÄܱàÒ»¸ö×Ô¶¯Éý¼¶³ÌÐò£¬·ÅÔÚÍøÂçÉÏ£¬ÈÃÓû§ÏÂÔØ£¬Ö»ÐèÖ´ÐÐһϾÍÍê³ÉÉý¼¶¹¤×÷£¬²»ÊǺܷ½±ãÂð£¿Æäʵ£¬ÓÃDelphi¿ÉÒԺܷ½±ãµØ±àÖƳöÕâÑùÒ»¸öµÄ³ÌÐò.
ÒÔÏÂÊÇÎÒÃǵÄÀý×Ó£ ......
ʵ¼ÊÉÏÕâ¸öÃû×Ö½Ð[SDL & Delphi]Ò²²»³ÉÎÊÌ⣬ ÒòΪ³ýÁËDelphiËƺõҲûÓÐÄĸöÁ÷ÐеĿª·¢¹¤¾ßÓõÄÊÇPascalÓïÑÔ¡£
SDLÆäʵÎÒҲֻѧÁ˲»µ½Á½ÐÇÆÚ¶øÒÑ¡£¸Õ¿ªÊ¼ÎÒÏëÊÔͼÓÃVC£¬ÒòΪÕâÑù×ÊÁÏ×îÈ«£¬Ò²ºÜºÃÕÒ£¬µ«Ì«¾ÃûÓÃVCÏÖÔÚ¿´CµÄ´úÂëÓеãÀ§ÄÑ£¨->Õâ¸öËã·ûÊǸÉÂðµÄÀ´×Å……£©¡£Æäʵ×÷Ϊһ¸öרҵ²»ÊǼÆËã»úµÄÈË ......
һЩ»ù´¡µÄÎÊÌâÎÒ²»ÔÙ׸ÊöÁË£¬²éÔÄ°ïÖúÎĵµ£¨Object Pascal SDL Doc.chm£©ÏÔÈ»±ÈÔÚÕâ¿´ÎÒºú³¶ºÏÊʵöࡣÄÇЩ»ÏñËØ£¬»ñÈ¡ÏñËØÐÅÏ¢£¬ÏÔʾBMPÎļþ¶àÊýʱºòÖ»Òª°ÑÄÇЩ´úÂ븴ÖƹýÀ´»ù±¾¾ÍÄܹ¤×÷¡£ÏÂÃæ˵µÄÊÇÔõÑùÏÔʾÖÐÎÄ¡£
ÆäʵSDL¼ÓÉÏttfÖ§³Öʱ£¨ÐèÒª½«¶ÔÓ¦µÄdllÎļþÌí¼Óµ½¹¤³ÌĿ¼ÀÊÇÍêÈ«¿ÉÒÔÏÔʾÖÐÎĵģ¬¼òÌåºÍ·±Ì嶼ûΠ......