Sign in to follow this  
Followers 0
cppman

Direct3D

41 posts in this topic

#1 ·  Posted (edited)

Here is the updated version of my Direct3D plugin. It provides you functions for drawing sprites now :shocked:

Here is a list of the functions, and the parameters they take: (I prefixed all of the functions with A2D)

A2DCreateDevice($hWnd, $nWidth, $nHeight, $nFullscreen, $nFormat)
A2DReleaseDevice()

A2DCreateSprite($sImage, $surface_width, $surface_height, $transparent_color, $nFormat)
A2DReleaseSprite($nSpriteID)

A2DClear($nClearColor)
A2DBeginScene()
A2DEndScene()
A2DPresentScene()

A2DDrawPixel($x, $y, $color)
A2DDrawLine($x1, $y1, $x2, $y2, $color)
A2DDrawRectangle($x, $y, $width, $height, $color)
A2DDrawSprite($id, $x, $y, $width, $height)
A2DDrawSpriteEx($id, $src_x, $src_y, $src_w, $src_h, $dest_x, $dest_y, $dest_w, $dest_h)
oÝ÷ Ù8^~æjÚZ­©µêÜjvÞz+azº'zíçè®f­±×ªÞv)ÚÙÖ®Ý:,zÛayج¦V²^~ée±ÊÞzz+Â)Ý£Êj{¬zÞ¡ûayÊ'²Ö§¶Æ¥²^rV«yاkgZ»}7è
XC9aÓ~Ø1T,´DA
!ü¨¹ªÞlº·n­Âú+«m¢ëÊj{¬{Mú`Å9L1BÓjwb¶ë²Ø^r©º×«ßÛyö®×b²ZÉú+«H}©Þ®º+¡Ç.®·z'zíçîËb¢{"·¥·­º¹õ¢Ø^¯¬z+pYkzÛ«J+jr즸­z̨º»)®+^Ƭ²('yÖ§Ûajܨ¹Æ§¥«,¶ax
¶°JâµçîËb¢qè¥ëaÈ^,¢g©zex:0Zu«miÈfz{
Edited by chris95219

Share this post


Link to post
Share on other sites



Oh, very cool.. I enjoyed playing around with this. I'm looking forward to try the new stuff you will add

Share this post


Link to post
Share on other sites

Hmm, i think it has a problem with the Plug-in and the functions not declaring correctly:

>Running AU3Check (1.54.6.0)  from:C:\Program Files\AutoIt3
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(15,15) : ERROR: InitDirect3D9(): undefined function.
InitDirect3D9()
~~~~~~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(16,36) : ERROR: CreateDevice(): undefined function.
CreateDevice($hWnd, 1024, 768, $opt)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(32,12) : ERROR: Clear(): undefined function.
    Clear($col)
    ~~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(33,13) : ERROR: BeginScene(): undefined function.
    BeginScene()
    ~~~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(34,58) : ERROR: DrawRectangle(): undefined function.
    DrawRectangle($x, $y, 50, 50, random(0x000000, 0xFFFFFF))
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(35,11) : ERROR: EndScene(): undefined function.
    EndScene()
    ~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(36,10) : ERROR: Present(): undefined function.
    Present()
    ~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(41,17) : ERROR: ReleaseDirect3D(): undefined function.
ReleaseDirect3D()
~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3 - 8 error(s), 0 warning(s)
!>19:41:16 AU3Check ended.rc:2
>Running:(3.2.2.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3"   
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3 (15) : ==> Unknown function name.: 
InitDirect3D9() 
^ ERROR

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hmm, i think it has a problem with the Plug-in and the functions not declaring correctly:

>Running AU3Check (1.54.6.0)  from:C:\Program Files\AutoIt3
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(15,15) : ERROR: InitDirect3D9(): undefined function.
InitDirect3D9()
~~~~~~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(16,36) : ERROR: CreateDevice(): undefined function.
CreateDevice($hWnd, 1024, 768, $opt)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(32,12) : ERROR: Clear(): undefined function.
    Clear($col)
    ~~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(33,13) : ERROR: BeginScene(): undefined function.
    BeginScene()
    ~~~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(34,58) : ERROR: DrawRectangle(): undefined function.
    DrawRectangle($x, $y, 50, 50, random(0x000000, 0xFFFFFF))
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(35,11) : ERROR: EndScene(): undefined function.
    EndScene()
    ~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(36,10) : ERROR: Present(): undefined function.
    Present()
    ~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3(41,17) : ERROR: ReleaseDirect3D(): undefined function.
ReleaseDirect3D()
~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3 - 8 error(s), 0 warning(s)
!>19:41:16 AU3Check ended.rc:2
>Running:(3.2.2.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3"   
C:\Documents and Settings\Owner\My Documents\nick\D3D\Direct3D\Test.au3 (15) : ==> Unknown function name.: 
InitDirect3D9() 
^ ERROR
Thats weird.. I get the same errors when I run au3check, but when I just run the script, or compile it, it runs perfectly fine. Have you tried running the script by itself? It shouldn't be the plugin code because I have it setup just as the example plugin shows you..

AU3_PLUGIN_FUNC g_AU3_Funcs[] = 
{
    {"InitDirect3D9", 0, 0},
    {"CreateDevice", 4, 4},
    {"ResetDevice", 4, 4},
    {"DrawPixel", 3, 3},
    {"DrawRectangle", 5, 5},
    {"CreateSprite", 2, 2},
    {"DrawSprite", 6, 6},
    {"Clear", 1, 1},
    {"BeginScene", 0, 0},
    {"EndScene", 0, 0},
    {"Present", 0, 0},
    {"ReleaseDirect3D", 0, 0}
};

and for each function I have declared like this(the first one.. as an example):

AU3_PLUGIN_DEFINE(InitDirect3D9)
{
    AU3_PLUGIN_VAR  *pResult;
    g_D3D = Direct3DCreate9(D3D_SDK_VERSION);
    pResult = AU3_AllocVar();
    if (g_D3D == NULL) {
        AU3_SetInt32(pResult, -1);
    }
    AU3_SetInt32(pResult, 0);
    return AU3_PLUGIN_OK;
}
Edited by chris95219

Share this post


Link to post
Share on other sites

This is what I got when I tried to run:

A messagebox from windows saying:

"This application has failed to start because d3dx9_32.dll was not found."

I also get an Au3Check Error of "InitDirect3D9()

Error: Unknown Function Name.

So.. yeah.. where can I get this dll?


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I still get an Unknown Function Name for InitDirect3d9 when i directly run the script

Edited by D-Generation X

Share this post


Link to post
Share on other sites

This is what I got when I tried to run:

A messagebox from windows saying:

"This application has failed to start because d3dx9_32.dll was not found."

I also get an Au3Check Error of "InitDirect3D9()

Error: Unknown Function Name.

So.. yeah.. where can I get this dll?

http://www.dll-files.com/dllindex/dll-files.shtml?d3dx9_32 :shocked:

nice work chris95219. very interesting.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Thank you for your plugin chris95219, nice work m8 .. dig it :shocked:

for those that get the

"ERROR: InitDirect3D9(): undefined function." as well as other errors similar to undeclared functions while running the test.au3 ...

You could try adding/declaring in the script to hush those errors.

#compiler_plugin_funcs = InitDirect3D9
#compiler_plugin_funcs = CreateDevice
#compiler_plugin_funcs = Clear
#compiler_plugin_funcs = BeginScene
#compiler_plugin_funcs = DrawPixel
#compiler_plugin_funcs = DrawRectangle
#compiler_plugin_funcs = EndScene
#compiler_plugin_funcs = Present
#compiler_plugin_funcs = ReleaseDirect3DoÝ÷ Ø    l¢ÈhºWHmç%¢È§Ø^¦[ |!zx­ßÛx¬çpØ^«­¢+ÙA±Õ¥¹
±½Í ÅÕ½ÐíáÔ̹±°ÅÕ½Ðì¤

Cheers

Edited by smashly

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

wow this is awsome. Iv'e been playing around with DirectX 8 in VB 6 for a while but if I can do this in AutoIt, screw VB! Thank you soooo much! I can't wait until this is more functional.

Hallman

Edited by Hallman

Share this post


Link to post
Share on other sites

wow this is awsome. Iv'e been playing around with DirectX 8 in VB 6 for a while but if I can do this in AutoIt, screw VB! Thank you soooo much!

Hallman

this is cool.. suprisinly uses less cpu usage than other plugins..

i also got an error, but fixed after i added d3dx9_32.dll to the script folder..


Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

Share this post


Link to post
Share on other sites

I am still getting the error about the Unknown Function Name (NOT undefined function)

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I had issues too. Here is a good clean version with both dlls, the closeplugin, and the compilerpluginfuncs

#compiler_plugin_funcs=InitDirect3D9, SetClearColor, CreateDevice, Clear, BeginScene, DrawRectangle, EndScene, Present, ReleaseDirect3D

Update first post with this.

Updated: Test.zip

Great Work, More functions please!

thanks

Edited by CyberZeroCool

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

I had issues too. Here is a good clean version with both dlls, the closeplugin, and the compilerpluginfuncs

Update first post with this.

Updated: Test.zip

Great Work, More functions please!

thanks

Nope, i still get the error in both examples.

Share this post


Link to post
Share on other sites

Nope, i still get the error in both examples.

I still get an error when I run just the script, try to use Scite to edit the script and run it with beta from there using Alt+F5

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

question ... what are using to compile this plugin? I'm trying to learch C++ but I dont know a good compiler ... Thanks, Hallman

Edited by Hallman

Share this post


Link to post
Share on other sites

question ... what are using to compile this plugin? I'm trying to learch C++ but I dont know a good compiler ... Thanks, Hallman

Visual C++

msdn.microsoft.com/vstudio/express/downloads/

C++ is fun but Direct3D isn't quite the easiest library to use, lol.

As, for all of those errors.. I have no clue on how to fix it, or why it doesn't even work.

I'm working on adding some new functions right now :shocked:

Share this post


Link to post
Share on other sites

Visual C++

msdn.microsoft.com/vstudio/express/downloads/

C++ is fun but Direct3D isn't quite the easiest library to use, lol.

As, for all of those errors.. I have no clue on how to fix it, or why it doesn't even work.

I'm working on adding some new functions right now :shocked:

Thanks for the functions, I can't wait

I would say about the errors to:

  • Using latest beta
  • Have both DLLs
  • Have compiler lines to ignore the unknown functions
Download test scripts

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

Visual C++

msdn.microsoft.com/vstudio/express/downloads/

C++ is fun but Direct3D isn't quite the easiest library to use, lol.

As, for all of those errors.. I have no clue on how to fix it, or why it doesn't even work.

I'm working on adding some new functions right now :shocked:

ok thanks!

Hallman

Share this post


Link to post
Share on other sites

ok thanks!

Hallman

I just updated my first post.

It supports sprites now :shocked:

-I think that is all the functions I'm going to add.. the rest seem pointless.(Getting the number of adapters and stuff like that can easily be done through the registry).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0