Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SDL & Object Pascal (Delphi) [2] ÏÔʾÖÐÎÄ×Ö·û

һЩ»ù´¡µÄÎÊÌâÎÒ²»ÔÙ׸ÊöÁË£¬²éÔÄ°ïÖúÎĵµ£¨Object Pascal SDL Doc.chm£©ÏÔÈ»±ÈÔÚÕâ¿´ÎÒºú³¶ºÏÊʵöࡣÄÇЩ»­ÏñËØ£¬»ñÈ¡ÏñËØÐÅÏ¢£¬ÏÔʾBMPÎļþ¶àÊýʱºòÖ»Òª°ÑÄÇЩ´úÂ븴ÖƹýÀ´»ù±¾¾ÍÄܹ¤×÷¡£ÏÂÃæ˵µÄÊÇÔõÑùÏÔʾÖÐÎÄ¡£
ÆäʵSDL¼ÓÉÏttfÖ§³Öʱ£¨ÐèÒª½«¶ÔÓ¦µÄdllÎļþÌí¼Óµ½¹¤³ÌĿ¼ÀÊÇÍêÈ«¿ÉÒÔÏÔʾÖÐÎĵģ¬¼òÌåºÍ·±Ì嶼ûÎÊÌ⣨Object Pascal°æ±¾Ò²²»È±¹¦ÄÜ£©£¬µ«ÊÇÖ»ÄÜÓÃUnicode±àÂë¡£Õâ¾ÍÊÇ˵£¬Äã±ØÐëÑ¡ÔñÒ»¸öUnicode±àÂëÍêÕûµÄ×ÖÌåÎļþ£¨»òÕß˵ÖÁÉÙÄãÐèÒªµÄÄÇЩ×Ö·ûÊÇÍêÕûµÄ£©¡£WindowsÏÂÃæÕâÑùµÄ×ÖÌåÓкܶ࣬ÎÒÍƼöµÄÓУº
¼òÌåÖÐÎÄ£ºËÎÌå´ó×Ö·û¼¯£¬Î¢ÈíÑźڣ»
·±ÌåÖÐÎÄ£ºÏ¸Ã÷Ì壬΢ÈíÕýºÚ£¬±ê¿¬Ìå¡£
ÕâЩ»ù±¾ÊÇÖÐÎĵØÇø×îÖØÒªµÄ¼¸ÖÖ×ÖÌå¡£Ò»¸öȱº¶¾ÍÊÇÓÃÓÚÏÔʾ¼òÌåÖÐÎĵĿ¬Ì壨ºÍÆäËû×ÖÌ壩ÓÅÐãµÄ²¢²»¶à¡£
Êä³öÖÐÎÄʱ£¬¿ÉÒÔÏÈдÕâÑùµÄÒ»¸ö×Ó³Ì×÷Ϊ»ù´¡£º
procedure DrawText(word: PUint16; x_pos, y_pos: integer; color: Uint32);
var
  text: PSDL_Surface; 
  dest: TSDL_Rect;
begin 
  text := TTF_RenderUNICODE_blended(font, word, TSDL_Color(Color));
  dest.x := x_pos;
  dest.y := y_pos;
  SDL_BlitSurface(text,nil, screen, @dest);
  SDL_FreeSurface(text);
end;
screen¾ÍÊÇÒѾ­¶¨ÒåºÃµÄÄǸöÖ÷ÆÁÄ»µÄ±ê¼Ç¡£fontÊÇÒ»¸öÖ¸Ïò×ÖÌåÎļþµÄÖ¸Õ룬¿ÉÒÔÕâÑù¶¨ÒåºÍ³õʼ»¯£º
È«¾Ö±äÁ¿£º
font: PTTF_Font;
ÔÚ³õʼ»¯×´Ì¬µÄ×Ó³ÌÖУº
TTF_Init;
font:=TTF_OpenFont('kaiu.ttf', 20);
µ±È»fontµÄ¶¨ÒåºÍ³õʼ»¯Ð´ÔÚDrawTextÀïÃæÒ²Ò»Ñù£¬Ö»ÊÇдÔÚÈ«¾Ö±äÁ¿ÀïÃæ¾Í¿ÉÒÔÖ»³õʼ»¯Ò»´Î£¬¿ÉÄÜ»áЧÂʸßһЩ¡£Í¬Ñù°ÑDrawTextÀïÃæÓõÄÄǸötextд³ÉÈ«¾Ö±äÁ¿Ò²ÊÇÒ»¸öÑ¡Ôñ¡£ÔÚ³ÌÐò½áÊøʱ£¬»¹ÒªÊÍ·ÅÕâЩ×ÊÔ´¡£
kaiu¾ÍÊDZ꿬ÌåµÄÎļþÃû×Ö£¬20ÊÇ×ֺţ¬ÐèÒª°Ñ×ÖÌåÎļþÒ²·ÅÔÚ¹¤³ÌĿ¼ÀïÃæ¡£
TTF_RenderUNICODE_blendedÕâ¸öº¯ÊýÊÇÒÔblendedЧ¹ûÊä³öÎÄ×Ö£¬ÒÔTTF_RenderUNICODE¿ªÍ·µÄº¯ÊýÓÐ3¸ö£¬¶ÔÓ¦µÄÊDz»Í¬µÄЧ¹û¡£
SDL_BlitSurface´óÖ¿ÉÒÔÀí½âΪÔÚ“±íÃæ”ÉÏÔÙÌùÒ»²ã¡£
µ÷ÓÃDrawTextµÄ·½·¨ÈçÏ£º
str: WideString;
......
str:=' ÕâÊÇÒ»¸öÏÔʾÖÐÎĵIJâÊÔ';
DrawText(@str[1], 100, 100, $FFFFFF);
Sdl_UpdateRect(screen, 0, 0, screen.w, screen.h);
×¢ÒâÒ»¶¨ÒªÓÃWideString£¨»òPWideChar£©ÀàÐÍ£¡
strÇ°ÃæÎÒÌí¼ÓÁËÒ»¸ö¿Õ¸ñ¡£ÕâÊÇÒòΪÎÒ·¢ÏÖÓÐЩ×ÖÌåÖе


Ïà¹ØÎĵµ£º

java µ÷Óà delphi±àдµÄdll


ÓÐЩʱºò,ҪдһЩ³ÌÐò,ÔÚ JAVA ÀïÃæºÃÄÑʵÏÖ, µ«Èç¹ûʹÓÃÆäËü±à³ÌÓïÑÔÈ´ÓֱȽÏÈÝÒ×ʱ,ÎÒÃDz»·Áͨ¹ý JNI À´Èò»Í¬ÓïÑԵijÌÐò¹²Í¬Íê³É.
JNI µÄ½Ì³Ì, ÍøÉÏ C µÄ±È½Ï¶à,Java Ò²ÌṩÁË javah.exe Ϊ C ÓïÑ﵀ JNI ³ÌÐòÉú³ÉÍ·Îļþ, Èç¹ûÄãÊÇÒ»¸ö Delphi ±à³ÌÔ±, ÄÜ·ñÈà JAVA Óë Delphi ³ÌÐò½»»¥ÄØ? ´ð°¸Êǿ϶¨µÄ,½ñÌìÎÒÃǾÍÀ´ ......

Delphi¶¯Ì¬Ê¼þÉîÈë·ÖÎö

Delphi¶¯Ì¬Ê¼þÉîÈë·ÖÎö
2009-2-7
×÷Õß:²»µÃÏÐ
ºËÐÄÌáʾ£º±¾ÊµÑéÖ¤Ã÷ÁËÔÚÀàÖз½·¨µÄµ÷ÓÃʱºò£¬ËùÓеķ½·¨¶¼Òþº¬ÁËÒ»¸öSelf²ÎÊý£¬²¢ÇҸòÎÊý×÷Ϊ¶ÔÏó·½·¨µÄµÚÒ»¸ö²ÎÊý´«µÝ...
Ê×ÏÈ×öÒ»¸ö¿Õ´°Ì壬·ÅÈëÒ»Button¡£
ÔÚimplementationÏÂÃæÉùÃ÷Á½¸ö·½·¨ÈçÏ£º
//Íⲿ·½·¨£¬Ö»ÉùÃ÷Ò»¸ö²ÎÊý£¬´Ëʱ°´ÕÕ±ê×¼µÄ¶ÔÏóÄÚ²¿Ê¼þ·½·¨T ......

Delphi Ñ­»·µÄÃØÃÜ

¼¼Êõ½»Á÷,DH½²½â. ¹þ¹þ,ÎÒ³ÐÈÏÎÒÊDZêÌâµ³.
×î½ü¿´ÌìÊéÒ¹¶ÁÀïÃæÊǶÔCÓïÑԵĴúÂë·´»ã±à,²»´í,¿ÉϧDelphiûÓÐÕâÑùµÄÊé,ÄÇÎÒÃÇ×Ô¼º¶¯ÊÖ°É.
Ê×ÏȽøÈëForÑ­»·ÁË. Function TestFor( a, b: Integer ): Integer ;
Var
I: Integer ;
Begin
Result := a + b ;
For I := 0 To 49 Do
Result := Result + I ......

DELPHIÏûÏ¢µÄ´¦ÀíÁ÷³Ì


ÏûÏ¢µÄ´¦ÀíÁ÷³Ì£¬Á÷³ÌÈçÏ£º
ÆäÅÉ·¢´¦Àí¹ý³ÌÏêϸÈçÏ£º
 ×¢Ò⣺TWinControlÀïÃæWndProcÓе÷ÓÃϵͳAPI DefWindowProc,¸Ãº¯Êýµ÷ÓÃȱʡµÄ´°¿Ú¹ý³ÌÀ´ÎªÓ¦ÓóÌÐòûÓд¦ÀíµÄÈκδ°¿ÚÏûÏ¢ÌṩȱʡµÄ´¦Àí¡£¶øTWinControlÀïÃæDefaultHandlerÓÖµ÷ÓÃÁËϵͳAPI CallWindowProc£¬¸Ãº¯ÊýCallWindowProc½«ÏûÏ¢ÐÅÏ¢´«Ë͸øÖ¸¶¨µÄ´°¿ ......

Delphi ¶¯Ì¬´´½¨´°¿ÚµÄ¼¸ÖÖ·½·¨

  ·½·¨1£º¿ÉдΪº¯Êý£¬ÔÙµ÷ÓÃ
  Application.CreateForm(TForm1, Form1);
  Form1.ShowModal;
  Form1.Free;
  ·½·¨2£º
  Form1:= TForm1.Create(Application);
  try
     Form1.ShowModal;
  finally
     ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ