Affichage des articles dont le libellé est Drawing. Afficher tous les articles
Affichage des articles dont le libellé est Drawing. Afficher tous les articles

jeudi 6 mars 2014

[Help] WarFace Item drawing. topic




Hi guys, who can help me how get drawing item grenade or C4 etc...?
i use this method:

Code:



pES = pEnv->pEntitySystem;

void ItemLoop()
{
        char ee2[255];
        sprintf(ee2,"Count %d",Count);
        GUI::Text.Draw(ee2,100,100,20,Color::colGreen,0,0,0);

        for (int i = 0; i < Count; i++)
        {
                IEntity* pItem = pES->GetEntity(i);
                if(pItem )
                {
                ddd++;
                Vec3 Pos = pItem->GetWorldPos();
                Vec3 Out;

                char str[255];
                sprintf(str,"%s",pItem->GetName());

                if(WorldToScreen(&Pos, &Out) )
                {                                       
                    GUI::Text.Draw(str,Out.x,Out.y,20,Color::ColYellow,0,0,0);
                }
        }
              sprintf(ee2,"Result:Count: %d",ddd);
              GUI::Text.Draw(ee2,100,140,20,Color::colGreen,0,0,0);
}


i get this, but my grenade or c4 = NULL, why ?








onClick="if (this.parentNode.parentNode.getElementsByTagName('div')['show_spoil'].style.display != '')
{
this.parentNode.parentNode.getElementsByTagName('div')['show_spoil'].style.display = '';
this.parentNode.parentNode.getElementsByTagName('div')['hide_spoil'].style.display = 'none';
this.value = 'Hide Spoiler!';
}
else
{
this.parentNode.parentNode.getElementsByTagName('div')['show_spoil'].style.display = 'none';
this.parentNode.parentNode.getElementsByTagName('div')['hide_spoil'].style.display = '';
this.value = 'Show Spoiler!';
}" />





if use IEntity* Next(); blah blah blah, work, but sometimes i get random crash,and i trying to find an alternative method.





mardi 28 janvier 2014

[Help] Transparent window returns no drawing topic




Hi Friends!

As the title Suggests, I have a problem with the output of my drawings and my written text. In another project, in Which I practiced drawing a line and write a text. Since I Could See the results. But Because The background what not transparent!

Can someone tell me what I'm doing wrong here?

Thank you!


Here is my exercise code:

PHP Code:







using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;


using System.Security.Permissions;

using System.Runtime.InteropServices;

using System.Threading;

using Microsoft.DirectX;

using Microsoft.DirectX.Direct3D;


namespace 
DX3D_First

{

    public 
partial class frmOverlay Form

    
{

        
#region DLL-IMPORT


        
internal struct Margins

        
{

            public 
int LeftRightTopBottom;

        }


        [
DllImport"user32.dll"SetLastError true )]

        public static 
extern UInt32 GetWindowLongIntPtr hWndint nIndex );


        [
DllImport"user32.dll" )]

        static 
extern int SetWindowLongIntPtr hWndint nIndexIntPtr dwNewLong );


        [
DllImport"user32.dll" )]

        static 
extern bool SetLayeredWindowAttributesIntPtr hwnduint crKeybyte bAlphauint dwFlags );


        [
DllImport"dwmapi.dll" )]

        static 
extern void DwmExtendFrameIntoClientAreaIntPtr hWndref Margins pMargins );


        public const 
int GWL_EXSTYLE = -20;


        public const 
int WS_EX_LAYERED 0x80000;


        public const 
int WS_EX_TRANSPARENT 0x20;


        public const 
int LWA_ALPHA 0x2;


        public const 
int LWA_COLORKEY 0x1;


        
#endregion

        

        
Device device null;


        
Microsoft.DirectX.Direct3D.Font dxText;

        
Microsoft.DirectX.Direct3D.Line dxLine;


        
Margins marg;

        
bool bStopThread false;


        protected 
override CreateParams CreateParams

        
{

            
get

            
{

                new 
SecurityPermissionSecurityPermissionFlag.UnmanagedCode ).Demand();

                
CreateParams CP base.CreateParams;


                
CP.ExStyle CP.ExStyle 0x00000020;


                return 
CP;

            }

        }


        public 
frmOverlay()

        {

            
InitializeComponent();


            
Gfx();


            
Thread dx = new Thread( new ThreadStartdxThread ) );

            
dx.IsBackground true;

            
dx.Start();

        }



        protected 
override void OnPaintPaintEventArgs e )

        {

            
marg.Left 0;

            
marg.Top 0;

            
marg.Right this.Width;

            
marg.Bottom this.Height;


            
DwmExtendFrameIntoClientAreathis.Handleref marg );

        }


        public 
bool Gfx()

        {

            try

            {

                
SetWindowLongthis.HandleGWL_EXSTYLE, ( IntPtr )( GetWindowLongthis.HandleGWL_EXSTYLE ) | WS_EX_LAYERED WS_EX_TRANSPARENT ) );

                
SetLayeredWindowAttributesthis.Handle0255LWA_ALPHA );


                
PresentParameters pp = new PresentParameters();


                
pp.Windowed true;

                
pp.SwapEffect SwapEffect.Discard;

                
pp.BackBufferFormat Format.A8B8G8R8;


                
device = new Device0DeviceType.HardwarethisCreateFlags.HardwareVertexProcessingpp );


                
dxLine = new Microsoft.DirectX.Direct3D.Linedevice );

                
dxText = new Microsoft.DirectX.Direct3D.Fontdevice, new System.Drawing.Font"Arial"12 ) );


                return 
true;

            }

            catch (
DirectXException)

            {

                return 
false;

            }

        }


        public 
void DrawRectint _Xint _Yint _Widthint _HeightColor _Color )

        {

            
Vector2[] Lines = new Vector2];


            
Lines]._X;

            
Lines]._Y;


            
Lines]._X _Width;

            
Lines]._Y;


            
Lines]._X _Width;

            
Lines]._Y _Height;


            
Lines]._X;

            
Lines]._Y _Height;


            
Lines]._X;

            
Lines]._Y;


            
dxLine.DrawLines_Color );

        }


        public 
void dxThread()

        {

            while(!
bStopThread)

            {

                if( 
device == null ) return;


                
device.ClearClearFlags.TargetColor.FromArgb000), 1.0f);

                
device.RenderState.ZBufferEnable false;

                
device.RenderState.Lighting false;

                
device.RenderState.CullMode Cull.None;

                
device.Transform.Projection Matrix.OrthoOffCenterLH0this.Widththis.Height00);

                
device.BeginScene();


                
// Rendering

                
DrawRect1020100150Color.Blue );


                
dxText.DrawTextnull"Hello World!"100100Color.Red );


                
device.EndScene();

                
device.Present();


                
Application.DoEvents();

            }


            
device.Dispose();


            
Application.Exit();

        }






        public 
void FillRectfloat xfloat yfloat wfloat hint rint gint b )

        {

            
CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored];


            
verts].Position = new Vector4xh00.5f );

            
verts].Position = new Vector4xy00.5f );

            
verts].Position = new Vector4wh00.5f );

            
verts].Position = new Vector4wy00.5f );

            
//or make it with for(int i = 0; i < 4; i++) to write less code

            
verts].Color System.Drawing.Color.FromArgbrg).ToArgb();

            
verts].Color System.Drawing.Color.FromArgbrg).ToArgb();

            
verts].Color System.Drawing.Color.FromArgbrg).ToArgb();

            
verts].Color System.Drawing.Color.FromArgbrg).ToArgb();


            
device.VertexFormat CustomVertex.TransformedColored.Format;

            
device.DrawUserPrimitivesPrimitiveType.TriangleStrip2verts );

        }




        public 
void DrawRectanglefloat xfloat yfloat wfloat hColor color )

        {

            
float thickness = ( 25 );

            
//Vertical bar 1

            
FillRect- ( ), - ( ), thickness/*just to keep our width consistent*/hcolor.Rcolor.Gcolor.);

            
////Horiz 1

            
FillRect- ( ), - ( ), wthicknesscolor.Rcolor.Gcolor.);

            
////Horizontal bar 2, -50 because we want the exact center of the crosshair to be 

            ////at our X,Y coords and not the far left on crosshair on them

            
FillRect- ( ), + ( ), wthicknesscolor.Rcolor.Gcolor.);

            
////Vertical bar 2

            
FillRect+ ( ), - ( ), thicknesshcolor.Rcolor.Gcolor.);

        }

    }