无法将参数4从"float [4]"转换为"CVec4 *" [英] cannot convert parameter 4 from 'float [4]' to 'CVec4 *'

查看:128
本文介绍了无法将参数4从"float [4]"转换为"CVec4 *"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为游戏制作工具并具有功能,但是在尝试使用它时会出错.但是我不知道如何解决它,请有人帮我.

Im making a tool for a game, and have a function, but when trying to use it, it will give an error. But i can't figure out how to fix it, please somebody help me. Been stuck with this for hours.

class

CVec4
{
public :
浮动 x,y,z,w;
};

无效

CVec4
{
     public:
     float x, y, z, w;
};

void

DrawEngineText(FLOAT PosX,FLOAT PosY,PVOID pFont,CVec4 * tColor,FLOAT ScaleX,FLOAT ScaleY,FLOAT f1,FLOAT f2,CHAR * szText){

DWORD * pDrawEngineString =(DWORD *)0x5F6B00;
_ asm
{
推0x0
推f2
推f1
推ScaleY
推ScaleX
push PosY
push PosX
push pFont
push 0x7FFFFFFF
push szText
mov ecx,tColor
调用[pDrawEngineString]
添加esp ,0x28
}
}

然后在我使用它时:

DrawEngineText( FLOAT PosX, FLOAT PosY, PVOID pFont, CVec4* tColor, FLOAT ScaleX, FLOAT ScaleY, FLOAT f1, FLOAT f2, CHAR* szText ) {

DWORD* pDrawEngineString = (DWORD*)0x5F6B00;
_asm
{
push 0x0
push f2
push f1
push ScaleY
push ScaleX
push PosY
push PosX
push pFont
push 0x7FFFFFFF
push szText
mov ecx, tColor
call [pDrawEngineString]
add esp, 0x28
}
}

Then when i use it:

 

浮动 tGree [4] = {1.0f, 0.0f,1.0f,0.0f};
DrawEngineText(200,200,
"Arial" ,tGree,0、0、0、0, " ; Test"

float tGree[4] = { 1.0f, 0.0f, 1.0f, 0.0f };
DrawEngineText(200, 200,
"Arial", tGree, 0, 0, 0, 0, "Test");

I get this error:
cannot convert parameter 4 from 'float [4]' to 'CVec4 *'

 

推荐答案

您可能需要通过声明

You probably need to make tGeet an object of class CVect4, by declaring

CVect4 tGeet(float1,float2,float3,float4);

CVect4 tGeet(float1, float2, float3, float4);

并使用4个浮点值初始化该对象.

and initializing this object with 4 float values.

然后可以调用DrawEngineText(200,200,"Arial" 测试" );

还需要为CVect4定义一个构造函数,例如:

Cvect4 :: CVect4(float float1, float float2,float float3,float4)
{
x = float1;
y = float2;
z = float3;
w = float4;
}

You can then call DrawEngineText(200, 200, "Arial", &tGree, 0, 0, 0, 0, "Test");

You also need to define a constructor for CVect4 like this :

Cvect4::CVect4(float float1, float float2, float float3, float float4)
{
    x = float1;
    y = float2;
    z = float3;
    w = float4;
}

 


这篇关于无法将参数4从"float [4]"转换为"CVec4 *"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆