Code a Dll with Powerdraw

Started by
8 comments, last by Muhagl 21 years ago
I have to Code a Dll with Power Draw so i can Skript my Game with VB. But i can always Init PowerDraw and Clear the Screen. Timer, Font and VDTb doesnt work... On Init PowerFont or VDTb ive got the ErrorString: "The Method was Called with invalide parameters or in inapropriate situation" ??? Is this come from the DLL Coding or i beeing too Stupid for PowerDraw... Plz Help!! Hmmm... i have to go bach to DelphiX O_O [edited by - Muhagl on March 18, 2003 4:10:23 PM]
Advertisement
Showing your PowerDraw initialization code would help...
Ok, thats the Init Code for PDraw but i think that works (Screen get Clear with the right Color)

Function RPGDX9_Init: Integer; begin  FM_Engine.Draw := TPowerDraw.Create(FM_Engine);  FM_Engine.Draw.Initialize;  FM_Engine.Draw.InitDevice;  PDrawExDllName := ''C:\tmp\'' + PDrawExDllName;  RPGDX9_Switch := true;  FM_Engine.Draw.Clear($FF00FF00);  FM_Engine.Draw.Present; end; 


And thats the Font loading Code:

Function RPGE4_LoadSystemFont(FontFile: PChar): Integer;var FontFileStr: String;    Res: Integer; begin  RPGE4_LoadSystemFont := 0;  {Convert Null Termided String in Pascal String}  FontFileStr := StrPas(FontFile);  {Check File}  if FileExists(FontFileStr)   then begin    {Load Font}    Res := FM_Engine.DXF_System.LoadFromFile(FontFileStr, D3DFMT_A4R4G4B4 );    if Res <> 0 then ShowMessage(ErrorString(res)); // Here is the Error! ******    FM_Engine.DXF_System.InvertGraphics;    FM_Engine.DXF_System.Scale := 256;    FM_Engine.Draw.Clear($FF000000);    FM_Engine.Draw.BeginScene;    FM_Engine.DXF_System.TextOut(''testing'',4,4,$00FF00);    FM_Engine.Draw.EndScene;    FM_Engine.Draw.Present;   end else begin    ShowMessage(''Fine not found'');    RPGE4_LoadSystemFont := 1;   end; end; 



Hope you can help me...
Error code -1 with the message "The method was called in inapropriate situation" happends when you try to load font or graphics when PowerDraw hasn''t been initialized. Since in your code you never checked the resulting value of Initialize and InitDevice, the error pumped out of font loading routine.
hmmm. i shoud get the Messages from the Init Code... I Try it and send a post of the results...
Sry 4 Doppelpost...

Ive got no Error Messages on Init...

Function RPGDX9_Init: Integer;var res: Integer; begin  FM_Engine.Draw := TPowerDraw.Create(FM_Engine);  res := FM_Engine.Draw.Initialize;   if (res <> 0) then    ShowMessage(Errorstring(res));  res := FM_Engine.Draw.InitDevice;   if (res <> 0) then    ShowMessage(Errorstring(res));  PDrawExDllName := ''C:\tmp\'' + PDrawExDllName;  RPGDX9_Switch := true;  FM_Engine.Draw.Clear($FF00FF00);  FM_Engine.Draw.Present; end; 


Now i`m really think i''m to Stupid for uning PDraw :D

Hmmm... Im using the PDraw Dx9 Version... Can this be the Answer? Delphi Ver7

Few suggestions - you''d assign path before you initialize PowerDraw; don''t compare resulting code to 0, it might be bigger than 0 (which isn''t an error), compare it like "if (Res < errNone)"; also, check the order of initialization process and loading routine... I think the problem is somewhere in your code since PowerDraw routines check for Initialized flag each time and return errInvalidCall if the component is not initialized.
!!! Also, keep in mind to assign PowerDraw to Font, i.e. Font.PowerDraw:= PowerDraw... same applies to imagelists, etc.

Oh my God! It Works! Very Special Thanks to you! Thats Great!!! *sing*

Ehem... it was the Font.PowerDraw := Form.PowerDraw;

*sing*

[edited by - Muhagl on March 20, 2003 3:15:10 PM]
Gee, the very first time I read your message, it reminded me something... I once had an annoying errInvalidCall problem which I couldn''t figure what it was... unfortunally, forgot that it was .PowerDraw = PowerDraw thinggy.
Hmmm that means... ... ...I''m not to Stupid for using PowerDraw (Jehhaaa!) *g*

But... Is that PowerDraw = PowerDraw1 thing not Declared in the Object Properties?

This topic is closed to new replies.

Advertisement