C# Class Vocaluxe.Lib.Draw.CDirect3D

Inheritance: System.Windows.Forms.Form, IDraw
显示文件 Open project: stsundermann/Vocaluxe

Public Methods

Method Description
AddTexture ( Bitmap bmp ) : Vocaluxe.Lib.Draw.STexture

Adds a texture and stores it in the Vram

AddTexture ( Bitmap bmp, string TexturePath ) : Vocaluxe.Lib.Draw.STexture

Adds a texture and stores it in the Vram

AddTexture ( int W, int H, IntPtr Data ) : Vocaluxe.Lib.Draw.STexture
AddTexture ( int W, int H, byte &Data ) : Vocaluxe.Lib.Draw.STexture
AddTexture ( string TexturePath ) : Vocaluxe.Lib.Draw.STexture

Adds a texture and stores it in the VRam

CDirect3D ( ) : System

Creates a new Instance of the CDirect3D Class

ClearScreen ( ) : void

Removes all textures from the screen

CopyScreen ( ) : Vocaluxe.Lib.Draw.STexture
CopyScreen ( Vocaluxe.Lib.Draw.STexture &Texture ) : void

Copies the current frame into a texture

DrawColor ( Vocaluxe.Lib.Draw.SColorF color, Vocaluxe.Lib.Draw.SRectF rect ) : void

Draws a colored rectangle

DrawLine ( int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2 ) : void

Draws a line

DrawText ( string Text, int x, int y, float h, float z ) : void

Draws a text string

DrawText ( string Text, int x, int y, int h ) : void

Draws a text string

DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture ) : void

Draws a texture

DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect ) : void

Draws a texture

DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect, Vocaluxe.Lib.Draw.SColorF color ) : void

Draws a texture

DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect, Vocaluxe.Lib.Draw.SColorF color, Vocaluxe.Lib.Draw.SRectF bounds ) : void

Draws a texture

DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect, Vocaluxe.Lib.Draw.SColorF color, Vocaluxe.Lib.Draw.SRectF bounds, bool mirrored ) : void

Draws a texture

DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect, Vocaluxe.Lib.Draw.SColorF color, bool mirrored ) : void

Draws a texture

DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect, Vocaluxe.Lib.Draw.SColorF color, float begin, float end ) : void

Draws a texture

DrawTextureReflection ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect, Vocaluxe.Lib.Draw.SColorF color, Vocaluxe.Lib.Draw.SRectF bounds, float space, float height ) : void

Draws a reflection of a texture

GetScreenHeight ( ) : int

Gets the current viewport height

GetScreenWidth ( ) : int

Gets the current viewport width

GetTextBounds ( Vocaluxe.Menu.CText text ) : RectangleF

Calculates the bounds for a CText object

GetTextBounds ( Vocaluxe.Menu.CText text, float Height ) : RectangleF

Calculates the bounds for a CText object

Init ( ) : bool

Inits the Device

MainLoop ( ) : void

Starts the rendering

MakeScreenShot ( ) : void

Creates a Screenshot of the current frame

QuequeTexture ( int W, int H, byte &Data ) : Vocaluxe.Lib.Draw.STexture
RemoveTexture ( Vocaluxe.Lib.Draw.STexture &Texture ) : void

Removes a texture from the Vram

Reset ( ) : void

Resets the device, all objects in the Direct3D default pool get flushed and need to be recreated

TextureCount ( ) : int

Gets the count of current textures

Unload ( ) : bool

Unloads all Textures and other objects used by Direct3D for rendering

UpdateTexture ( Vocaluxe.Lib.Draw.STexture &Texture, IntPtr Data ) : bool

Updates the data of a texture

UpdateTexture ( Vocaluxe.Lib.Draw.STexture &Texture, byte &Data ) : bool

Updates the data of a texture

Protected Methods

Method Description
OnLoad ( EventArgs e ) : void
OnResize ( EventArgs e ) : void
WndProc ( Message &m ) : void

Private Methods

Method Description
AddToVertexBuffer ( TexturedColoredVertex vertices, Texture tex, System.Matrix rotation ) : void

Adds a quad a list which will be added and rendered to the vertexbuffer when calling RenderToVertexBuffer to reduce vertexbuffer calls each frame to a minimum

CalculateRotationMatrix ( float rot, float rx1, float rx2, float ry1, float ry2 ) : System.Matrix
CheckQueque ( ) : void
EnterFullScreen ( ) : void

Triggers the Fullscreen mode

LeaveFullScreen ( ) : void

Triggers the windowed mode

NextPowerOfTwo ( float n ) : float

Calculates the next power of two

OnClosingEvent ( object sender, CancelEventArgs e ) : void
OnKeyDown ( object sender, System e ) : void
OnKeyPress ( object sender, System e ) : void
OnKeyUp ( object sender, System e ) : void
OnMouseDown ( object sender, MouseEventArgs e ) : void
OnMouseEnter ( object sender, EventArgs e ) : void
OnMouseLeave ( object sender, EventArgs e ) : void
OnMouseMove ( object sender, MouseEventArgs e ) : void
OnMouseUp ( object sender, MouseEventArgs e ) : void
OnMouseWheel ( object sender, MouseEventArgs e ) : void
OnPaintEvent ( object sender, PaintEventArgs e ) : void
OnPreviewKeyDown ( object sender, System e ) : void
OnResizeEvent ( object sender, EventArgs e ) : void
RResize ( ) : void

Resizes the viewport

RenderVertexBuffer ( ) : void

Renders the vertex buffer

_TextureExists ( Vocaluxe.Lib.Draw.STexture &Texture ) : bool

Checks if a texture exists

Method Details

AddTexture() public method

Adds a texture and stores it in the Vram
public AddTexture ( Bitmap bmp ) : Vocaluxe.Lib.Draw.STexture
bmp System.Drawing.Bitmap The Bitmap of which the texute will be created from
return Vocaluxe.Lib.Draw.STexture

AddTexture() public method

Adds a texture and stores it in the Vram
public AddTexture ( Bitmap bmp, string TexturePath ) : Vocaluxe.Lib.Draw.STexture
bmp System.Drawing.Bitmap The Bitmap of which the texute will be created from
TexturePath string The path to the texture
return Vocaluxe.Lib.Draw.STexture

AddTexture() public method

public AddTexture ( int W, int H, IntPtr Data ) : Vocaluxe.Lib.Draw.STexture
W int
H int
Data System.IntPtr
return Vocaluxe.Lib.Draw.STexture

AddTexture() public method

public AddTexture ( int W, int H, byte &Data ) : Vocaluxe.Lib.Draw.STexture
W int
H int
Data byte
return Vocaluxe.Lib.Draw.STexture

AddTexture() public method

Adds a texture and stores it in the VRam
public AddTexture ( string TexturePath ) : Vocaluxe.Lib.Draw.STexture
TexturePath string The texture's filepath
return Vocaluxe.Lib.Draw.STexture

CDirect3D() public method

Creates a new Instance of the CDirect3D Class
public CDirect3D ( ) : System
return System

ClearScreen() public method

Removes all textures from the screen
public ClearScreen ( ) : void
return void

CopyScreen() public method

public CopyScreen ( ) : Vocaluxe.Lib.Draw.STexture
return Vocaluxe.Lib.Draw.STexture

CopyScreen() public method

Copies the current frame into a texture
public CopyScreen ( Vocaluxe.Lib.Draw.STexture &Texture ) : void
Texture Vocaluxe.Lib.Draw.STexture The texture in which the frame is copied to
return void

DrawColor() public method

Draws a colored rectangle
public DrawColor ( Vocaluxe.Lib.Draw.SColorF color, Vocaluxe.Lib.Draw.SRectF rect ) : void
color Vocaluxe.Lib.Draw.SColorF The color in which the rectangle will be drawn in
rect Vocaluxe.Lib.Draw.SRectF The coordinates in a SRectF struct
return void

DrawLine() public method

Draws a line
public DrawLine ( int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2 ) : void
a int The alpha value from 0-255
r int The red value from 0-255
g int The red value from 0-255
b int The red value from 0-255
w int The width of the line
x1 int The start x-value
y1 int The start y-value
x2 int The end x-value
y2 int The end y-value
return void

DrawText() public method

Draws a text string
public DrawText ( string Text, int x, int y, float h, float z ) : void
Text string The text to be drawn
x int The text's x-position
y int The text's y-position
h float The text's height
z float The text's x-position
return void

DrawText() public method

Draws a text string
public DrawText ( string Text, int x, int y, int h ) : void
Text string The text to be drawn
x int The text's x-position
y int The text's y-position
h int The text's height
return void

DrawTexture() public method

Draws a texture
public DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture ) : void
Texture Vocaluxe.Lib.Draw.STexture The texture to be drawn
return void

DrawTexture() public method

Draws a texture
public DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect ) : void
Texture Vocaluxe.Lib.Draw.STexture The texture to be drawn
rect Vocaluxe.Lib.Draw.SRectF A SRectF struct containing the destination coordinates
return void

DrawTexture() public method

Draws a texture
public DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect, Vocaluxe.Lib.Draw.SColorF color ) : void
Texture Vocaluxe.Lib.Draw.STexture The texture to be drawn
rect Vocaluxe.Lib.Draw.SRectF A SRectF struct containing the destination coordinates
color Vocaluxe.Lib.Draw.SColorF A SColorF struct containing a color which the texture will be colored in
return void

DrawTexture() public method

Draws a texture
public DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect, Vocaluxe.Lib.Draw.SColorF color, Vocaluxe.Lib.Draw.SRectF bounds ) : void
Texture Vocaluxe.Lib.Draw.STexture The texture to be drawn
rect Vocaluxe.Lib.Draw.SRectF A SRectF struct containing the destination coordinates
color Vocaluxe.Lib.Draw.SColorF A SColorF struct containing a color which the texture will be colored in
bounds Vocaluxe.Lib.Draw.SRectF A SRectF struct containing which part of the texture should be drawn
return void

DrawTexture() public method

Draws a texture
public DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect, Vocaluxe.Lib.Draw.SColorF color, Vocaluxe.Lib.Draw.SRectF bounds, bool mirrored ) : void
Texture Vocaluxe.Lib.Draw.STexture The texture to be drawn
rect Vocaluxe.Lib.Draw.SRectF A SRectF struct containing the destination coordinates
color Vocaluxe.Lib.Draw.SColorF A SColorF struct containing a color which the texture will be colored in
bounds Vocaluxe.Lib.Draw.SRectF A SRectF struct containing which part of the texture should be drawn
mirrored bool True if the texture should be mirrored
return void

DrawTexture() public method

Draws a texture
public DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect, Vocaluxe.Lib.Draw.SColorF color, bool mirrored ) : void
Texture Vocaluxe.Lib.Draw.STexture The texture to be drawn
rect Vocaluxe.Lib.Draw.SRectF A SRectF struct containing the destination coordinates
color Vocaluxe.Lib.Draw.SColorF A SColorF struct containing a color which the texture will be colored in
mirrored bool True if the texture should be mirrored
return void

DrawTexture() public method

Draws a texture
public DrawTexture ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect, Vocaluxe.Lib.Draw.SColorF color, float begin, float end ) : void
Texture Vocaluxe.Lib.Draw.STexture The texture to be drawn
rect Vocaluxe.Lib.Draw.SRectF A SRectF struct containing the destination coordinates
color Vocaluxe.Lib.Draw.SColorF A SColorF struct containing a color which the texture will be colored in
begin float A Value ranging from 0 to 1 containing the beginning of the texture
end float A Value ranging from 0 to 1 containing the ending of the texture
return void

DrawTextureReflection() public method

Draws a reflection of a texture
public DrawTextureReflection ( Vocaluxe.Lib.Draw.STexture Texture, Vocaluxe.Lib.Draw.SRectF rect, Vocaluxe.Lib.Draw.SColorF color, Vocaluxe.Lib.Draw.SRectF bounds, float space, float height ) : void
Texture Vocaluxe.Lib.Draw.STexture The texture of which a reflection should be drawn
rect Vocaluxe.Lib.Draw.SRectF A SRectF struct containing the destination coordinates
color Vocaluxe.Lib.Draw.SColorF A SColorF struct containing a color which the texture will be colored in
bounds Vocaluxe.Lib.Draw.SRectF A SRectF struct containing which part of the texture should be drawn
space float The space between the texture and the reflection
height float The height of the reflection
return void

GetScreenHeight() public method

Gets the current viewport height
public GetScreenHeight ( ) : int
return int

GetScreenWidth() public method

Gets the current viewport width
public GetScreenWidth ( ) : int
return int

GetTextBounds() public method

Calculates the bounds for a CText object
public GetTextBounds ( Vocaluxe.Menu.CText text ) : RectangleF
text Vocaluxe.Menu.CText The CText object of which the bounds should be calculated for
return System.Drawing.RectangleF

GetTextBounds() public method

Calculates the bounds for a CText object
public GetTextBounds ( Vocaluxe.Menu.CText text, float Height ) : RectangleF
text Vocaluxe.Menu.CText The CText object of which the bounds should be calculated for
Height float The height of the CText object
return System.Drawing.RectangleF

Init() public method

Inits the Device
public Init ( ) : bool
return bool

MainLoop() public method

Starts the rendering
public MainLoop ( ) : void
return void

MakeScreenShot() public method

Creates a Screenshot of the current frame
public MakeScreenShot ( ) : void
return void

OnLoad() protected method

protected OnLoad ( EventArgs e ) : void
e System.EventArgs
return void

OnResize() protected method

protected OnResize ( EventArgs e ) : void
e System.EventArgs
return void

QuequeTexture() public method

public QuequeTexture ( int W, int H, byte &Data ) : Vocaluxe.Lib.Draw.STexture
W int
H int
Data byte
return Vocaluxe.Lib.Draw.STexture

RemoveTexture() public method

Removes a texture from the Vram
public RemoveTexture ( Vocaluxe.Lib.Draw.STexture &Texture ) : void
Texture Vocaluxe.Lib.Draw.STexture The texture to be removed
return void

Reset() public method

Resets the device, all objects in the Direct3D default pool get flushed and need to be recreated
public Reset ( ) : void
return void

TextureCount() public method

Gets the count of current textures
public TextureCount ( ) : int
return int

Unload() public method

Unloads all Textures and other objects used by Direct3D for rendering
public Unload ( ) : bool
return bool

UpdateTexture() public method

Updates the data of a texture
public UpdateTexture ( Vocaluxe.Lib.Draw.STexture &Texture, IntPtr Data ) : bool
Texture Vocaluxe.Lib.Draw.STexture The texture to update
Data System.IntPtr A Pointer containing the data of which the texture should be updated
return bool

UpdateTexture() public method

Updates the data of a texture
public UpdateTexture ( Vocaluxe.Lib.Draw.STexture &Texture, byte &Data ) : bool
Texture Vocaluxe.Lib.Draw.STexture The texture to update
Data byte A byte array containing the new texture's data
return bool

WndProc() protected method

protected WndProc ( Message &m ) : void
m System.Windows.Forms.Message
return void