Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi nochmal Overlay (https://www.delphipraxis.net/137473-nochmal-overlay.html)

MasterTobi 21. Jul 2009 17:12


nochmal Overlay
 
Hallo,

ich habe nun dieses ganze forum nach Overlay abgesucht, nur irgendwie blick ic hes nicht oder was weiß ich.

vll kann mir jemand helfen.

also:

ich habe das sdk von d7/d8/d9 + madcodehook.

meine frage ist eig nur wie ich es schaffe einen text in einem spiel auszugeben. einfach nur einen simplen text zb Hallo

gibt es den nicht irgendwo ein bsp ?


p.s. diese frage wurde auch von anderen öfter gestellt, vll hilft uns einer :)


mfg
Tobi

MasterTobi 22. Jul 2009 21:59

Re: nochmal Overlay
 
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,direct3d9,dxtypes,directdraw,d3dx9,madcodehook;

type
  TForm1 = class(TForm)
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  direct3dcreate9next : function (sdkversion                                        : dword ) : dword; stdcall = nil;
  createdevice9next  : function (self, adapter, devtype, wnd, flags, params, device: pointer) : dword; stdcall = nil;
  presentnext        : function (self: pointer; const sourcerect, destrect : prect; const destwindowoverride : hwnd; dirtyregion : prgndata) : hresult; stdcall = nil;
  font               : id3dxfont;
  mycolor            : td3dcolor;

implementation

{$R *.dfm}
function getinterfacemethod(const intf; methodindex: dword) : pointer;
begin
  result := pointer(pointer(dword(pointer(intf)^) + methodindex * 4)^);
end;



procedure showtext(x,y: integer; s: string; col: td3dcolor);
var
  rect : Prect;
begin
  rect.top := y+100; rect.left := x+100;
  rect.bottom := y+100; rect.right := x+100;
  if @font <> nil then
    font.drawtexta(nil,pchar(s),length(s),rect,dt_noclip,mycolor);
end;

function presentcallback(self : pointer; const sourcerect, destrect : prect; const destwindowoverride : hwnd; dirtyregion : prgndata) : hresult; stdcall;
var
  test : hwnd;
begin
showtext(100,100,'test',mycolor);
result := presentnext(self,sourcerect,destrect,destwindowoverride,dirtyregion);

end;


function createdevice9callback(self, adapter, devtype, wnd, flags, params, device: pointer) : dword; stdcall;
begin
  font := nil;
  result := createdevice9next(self, adapter, devtype, wnd, flags, params, device);
  if font = nil then
  begin
    d3dxcreatefont(idirect3ddevice9(device^),
                   20,
                   20,
                   0,
                   1,
                   false,
                   ansi_charset,
                   out_default_precis,
                   default_quality,
                   default_pitch,
                   'Arial',
                   font);
    mycolor := d3dcolor_rgba(255,0,0,255);
    font.preloadcharacters(0,255);
  end;
  if result = 0 then begin
    if @presentnext = nil then
    begin
      hookcode(getinterfacemethod(device^, 17), @presentcallback, @presentnext)
    end else
      renewhook(@presentnext);
  end;
end;



function direct3dcreate9callback(sdkversion: dword) : dword; stdcall;
begin
  font := nil;
  result := direct3dcreate9next(sdkversion);
  if result <> 0 then
    if @createdevice9next = nil then
      hookcode(getinterfacemethod(result, 16), @createdevice9callback, @createdevice9next)
    else
      renewhook(@createdevice9next);
end;

function hookdirect3d9 : boolean;
begin
  result := hookapi('d3d9.dll', 'Direct3DCreate9', @direct3dcreate9callback, @direct3dcreate9next);
end;

begin
  hookdirect3d9;
  end.



den code kennt ihr ja alle :) nur wieso funktioniert das nicht?

quelle http://www.delphidev.de/forum/viewtopic.php?id=497&p=2 sagt es funktioniert ich seh bloß nix weiß einer warum ?


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:56 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz