Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Sat Dec 06, 2014 10:56 pm Post subject: |
|
|
Code: |
D3DHOOK class:
The d3dhook functions provide a method to render graphics and text inside the game, as long as it is running in directx9, 10 or 11
createD3DHook(textureandcommandlistsize OPTIONAL, hookmessages OPTIONAL)
Hooks direct3d and allocates a buffer with given size for storage of for the rendercommand list
hookmessages defines if you want to hook the windows message handler for the direct3d window. The d3dhook_onClick function makes use of that
If no size is provided 16MB is used and hookmessages is true
Note: You can call this only once for a process
It returns a d3dhook object
properties
Width: Integer : The width of the screen (readonly)
Height: integer: The height of the screen (readonly)
DisabledZBuffer: boolean : Set this to true if you don't want previously rendered walls to overlap a newly rendered object (e.g map is rendered first, then the players are rendered)
WireframeMode: boolean : Set this to true if you don't want the faces of 3d objects to be filled
MouseClip: boolean : Set this if to true if you have one of those games where your mouse can go outside of the gamewindow and you don't want that.
OnClick: function(d3dhook_sprite, x, y)
A function to be called when clicked on an sprite (excluding the mouse)
x and y are coordinates in the sprite object. If sprites overlap the highest zorder sprite will be given. It does NOT care if a transparent part is clicked or not
Note: If you set this it can cause a slowdown in the game if there are a lot of sprites and you press the left button a lot
OnKeyDown: function(virtualkey, char)
function(vkey, char) : boolean
A function to be called when a key is pressed in the game window (Not compatible with DirectInput8)
Return false if you do not wish this key event to pass down to the game
methods
beginUpdate() : Use this function when you intent to update multiple sprites,textcontainers or textures. Otherwise artifacts may occur (sprite 1 might be drawn at the new location while sprite 2 might still be at the old location when a frame is rendered)
endUpdate() : When done updating, call this function to apply the changes
enableConsole(virtualkey): Adds a (lua)console to the specific game. The given key will bring it up (0xc0=tilde)
createTexture(filename) : Returns a d3dhook_texture object
createTexture(picture, transparentColor OPTIONAL): Returns a d3dhook_texture object
if the picture is not a transparent image the transparentcolor parameter can be used to make one of it's colors transparent
createFontmap(font) : Returns a d3dhook_fontmap object created from the given font
createSprite(d3dhook_texture): returns a d3dhook_sprite object that uses the given texture for rendering
createTextContainer(d3dhook_fontmap, x, y, text): Returns a d3dhook_textContainer object
D3DHook_Texture Class (Inheritance: Object)
This class controls the texture in memory. Without a sprite to use it, it won't show
properties
Height: integer (ReadOnly)
Width: integer (ReadOnly)
methods
loadTextureByPicture(picture)
D3DHook_FontMap Class (Inheritance: D3DHook_Texture->Object)
A fontmap is a texture that contains extra data regarding the characters. This class is used by the textcontainer
Current implementation only supports 96 characters (character 32 to 127)
properties
-
methods
changeFont(font): Changes the fontmap to the selected font
getTextWidth(string): Returns the width of the given string in pixels
D3DHook_RenderObject Class (Inheritance: Object)
The renderobject is the abstract class used to control in what manner objects are rendered.
The sprite and TextContainer classed inherit from this
properties
X: Float - The x-coordinate of the object on the screen
Y: Float - The y-coordinate of the object on the screen
CenterX: Float - X coordinate inside the object. It defines the rotation spot and affects the X position
CenterY: Float - Y " "
Rotation: Float - Rotation value in degrees (0 and 360 are the same)
Alphablend: Float - Alphablend value. 1.0 is fully visible, 0.0=invisible
Visible: boolean - Set to false to hide the object
ZOrder: integer - Determines if the object will be shown in front or behind another object
methods
-
D3DHook_Sprite Class (Inheritance: D3DHook_RenderObject->Object)
A d3dhook_sprite class is a visible texture on the screen.
properties
Width: Integer - The width of the sprite in pixels. Default is the initial texture width
Height: Integer - The height of the sprite in pixels. Default is the initial texture height
Texture: d3dhook_texture - The texture to show on the screen
methods
-
D3Dhook_TextContainer Class (Inheritance: D3DHook_RenderObject->Object)
A d3dhook_sprite class draws a piece of text on the screen based on the used fontmap.
While you could use a texture with the text, updating a texture in memory is slow. So if you wish to do a lot of text updates, use a textcontainer
properties
FontMap : The D3DHook_FontMap object to use for rendering text
Text : The text to render
methods
-
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|