Added time offset sync, added web version multiplayer

This commit is contained in:
Vladislav Khorev committed 2026-02-09 22:56:48 +03:00
1 parent a59bcc0c4b
commit 2c1c077611
13 files changed
+534 -324

No files matched your search

+2 -17
View File
@@ -11,21 +11,14 @@ namespace ZL {
TextRenderer::~TextRenderer()
{
/*for (auto& kv : glyphs) {
if (kv.second.texID) glDeleteTextures(1, &kv.second.texID);
}*/
glyphs.clear();
textMesh.positionVBO.reset();
/*
if (vbo) glDeleteBuffers(1, &vbo);
// if (vao) glDeleteVertexArrays(1, &vao);
vao = 0;
vbo = 0;*/
}
bool TextRenderer::init(Renderer& renderer, const std::string& ttfPath, int pixelSize, const std::string& zipfilename)
{
r = &renderer;
#ifdef EMSCRIPTEN
@@ -47,15 +40,6 @@ bool TextRenderer::init(Renderer& renderer, const std::string& ttfPath, int pixe
textMesh.data.PositionData.resize(6, Eigen::Vector3f(0, 0, 0));
textMesh.RefreshVBO();
// VAO/VBO для 6 вершин (2 треугольника) * (pos.xy + uv.xy) = 4 float
// glGenVertexArrays(1, &vao);
/* glGenBuffers(1, &vbo);
//glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 6 * 4, nullptr, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
*/
ZL::CheckGlError();
return true;
}
@@ -142,6 +126,7 @@ bool TextRenderer::loadGlyphs(const std::string& ttfPath, int pixelSize, const s
void TextRenderer::drawText(const std::string& text, float x, float y, float scale, bool centered, std::array<float, 4> color)
{
if (!r || text.empty()) return;
// 1. Считаем ширину для центрирования