game(client): optimize touch drawing

This commit is contained in:
nillerusr
2022-09-16 02:41:03 +03:00
parent bf860c87c6
commit f07ba797c5
4 changed files with 811 additions and 19 deletions
+16 -5
View File
@@ -77,6 +77,15 @@ struct event_s
} typedef touch_event_t;
struct CTouchTexture
{
IVTFTexture *vtf;
float X0, Y0, X1, Y1; // position in atlas texture
int height, width;
char szName[1024];
};
class CTouchButton
{
public:
@@ -86,9 +95,6 @@ public:
// Field of button in pixels
float x1, y1, x2, y2;
// Button texture
int texture;
rgba_t color;
char texturefile[256];
char command[256];
@@ -99,7 +105,7 @@ public:
float fadespeed;
float fadeend;
float aspect;
int textureID;
CTouchTexture* texture;
};
class CTouchPanel : public vgui::Panel
@@ -149,7 +155,6 @@ public:
}
};
class CTouchControls
{
public:
@@ -188,6 +193,7 @@ public:
void GetTouchDelta( float yaw, float pitch, float *dx, float *dy );
void EditEvent( touch_event_t *ev );
void EnableTouchEdit(bool enable);
void CreateAtlasTexture();
CTouchPanel *touchPanel;
float screen_h, screen_w;
@@ -199,6 +205,7 @@ private:
bool initialized = false;
ETouchState state;
CUtlLinkedList<CTouchButton*> btns;
CUtlVector<CTouchTexture*> textureList;
int look_finger, move_finger, wheel_finger;
CTouchButton *move_button;
@@ -206,6 +213,10 @@ private:
float move_start_x, move_start_y;
float m_flPreviousYaw, m_flPreviousPitch;
int touchTextureID;
IMesh* m_pMesh;
CMeshBuilder meshBuilder;
// editing
CTouchButton *edit;
CTouchButton *selection;