improved server

This commit is contained in:
2025-07-14 14:59:41 +03:00
parent a9c28b8940
commit 3e27fb1bd4
20 changed files with 400 additions and 97 deletions

View File

@@ -6,6 +6,7 @@
#include "input.h"
#include "fgui/widget.h"
#include "fgui/label.h"
#include "mesh.h"
class C_MOBAPlayer: public C_BaseEntity
{
@@ -14,11 +15,13 @@ public:
virtual void Spawn( void ) override;
virtual void Destroy( void ) override;
virtual void Think( float fDelta ) override;
IMesh *m_pMesh;
IMeshInstance *m_pMeshInstance;
};
void C_MOBAPlayer::Precache()
{
}
CFGUI_Label *pText = new CFGUI_Label();
void C_MOBAPlayer::Spawn()
@@ -27,6 +30,67 @@ void C_MOBAPlayer::Spawn()
pText->SetPosition(100, 100);
pText->SetLabelSize(15);
pText->SetLabel("Hello, world!");
float cubeVertices[] = {
// Front face
-0.1f, -0.1f, 0.1f, 0, 0,
0.1f, -0.1f, 0.1f, 1, 0,
0.1f, 0.1f, 0.1f, 1, 1,
-0.1f, -0.1f, 0.1f, 0, 0,
0.1f, 0.1f, 0.1f, 1, 1,
-0.1f, 0.1f, 0.1f, 0, 1,
// Back face
0.1f, -0.1f, -0.1f, 0, 0,
-0.1f, -0.1f, -0.1f, 1, 0,
-0.1f, 0.1f, -0.1f, 1, 1,
0.1f, -0.1f, -0.1f, 0, 0,
-0.1f, 0.1f, -0.1f, 1, 1,
0.1f, 0.1f, -0.1f, 0, 1,
// Left face
-0.1f, -0.1f, -0.1f, 0, 0,
-0.1f, -0.1f, 0.1f, 1, 0,
-0.1f, 0.1f, 0.1f, 1, 1,
-0.1f, -0.1f, -0.1f, 0, 0,
-0.1f, 0.1f, 0.1f, 1, 1,
-0.1f, 0.1f, -0.1f, 0, 1,
// Right face
0.1f, -0.1f, 0.1f, 0, 0,
0.1f, -0.1f, -0.1f, 1, 0,
0.1f, 0.1f, -0.1f, 1, 1,
0.1f, -0.1f, 0.1f, 0, 0,
0.1f, 0.1f, -0.1f, 1, 1,
0.1f, 0.1f, 0.1f, 0, 1,
// Top face
-0.1f, 0.1f, 0.1f, 0, 0,
0.1f, 0.1f, 0.1f, 1, 0,
0.1f, 0.1f, -0.1f, 1, 1,
-0.1f, 0.1f, 0.1f, 0, 0,
0.1f, 0.1f, -0.1f, 1, 1,
-0.1f, 0.1f, -0.1f, 0, 1,
// Bottom face
-0.1f, -0.1f, -0.1f, 0, 0,
0.1f, -0.1f, -0.1f, 1, 0,
0.1f, -0.1f, 0.1f, 1, 1,
-0.1f, -0.1f, -0.1f, 0, 0,
0.1f, -0.1f, 0.1f, 1, 1,
-0.1f, -0.1f, 0.1f, 0, 1
};
IVertexBuffer *pVertexBuffer = IRenderer::CreateVertexBuffer(sizeof(cubeVertices));
void *pMapping = pVertexBuffer->Map();
V_memcpy(pMapping, cubeVertices, sizeof(cubeVertices));
pVertexBuffer->Unmap();
m_pMesh = IMeshRendering::CreateMesh();
m_pMesh->SetVertexBuffer(pVertexBuffer);
m_pMeshInstance = m_pMesh->CreateInstance();
};
void C_MOBAPlayer::Destroy()
@@ -48,6 +112,11 @@ void C_MOBAPlayer::Think( float fDelta )
g_cameraView[3][1] = pEntity->m_position[1];
g_cameraView[3][2] = pEntity->m_position[2]+0.7;
}
mat4 m;
glm_mat4_identity(m);
m_pMeshInstance->SetMatrix(m);
m_pMeshInstance->SetPosition(pEntity->m_position);
m_pMeshInstance->Draw();
};
LINK_CLIENT_ENTITY(C_MOBAPlayer, CMOBAPlayer)