Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AlwinEsch committed Feb 3, 2019
1 parent 09a17de commit 0d463d1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
6 changes: 3 additions & 3 deletions screensaver.asteroids/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="screensaver.asteroids"
version="2.2.0"
version="2.2.1"
name="Asteroids"
provider-name="Team Kodi">
<requires>@ADDON_DEPENDS@</requires>
<extension
point="xbmc.ui.screensaver"
library_@PLATFORM@="@LIBRARY_FILENAME@"/>
<extension point="xbmc.addon.metadata">
<summary>Asteroids screensaver</summary>
<description>An old-style screen saver where the asteroids are shot away.</description>
<summary lang="en">Asteroids screensaver</summary>
<description lang="en">An old-style screen saver where the asteroids are shot away.</description>
<platform>@PLATFORM@</platform>
<assets>
<icon>resources/icon.png</icon>
Expand Down
13 changes: 5 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ bool CMyAddon::Start()
}

glGenBuffers(1, &m_vertexVBO);
glGenBuffers(1, &m_indexVBO);

#else
m_pContext = reinterpret_cast<ID3D11DeviceContext*>(Device());
Expand Down Expand Up @@ -172,6 +171,11 @@ void CMyAddon::Render()
if (!m_asteroids)
return;

#ifndef WIN32
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
#endif

Begin();
m_timer->Update();
m_asteroids->Update(m_timer->GetDeltaTime());
Expand Down Expand Up @@ -200,8 +204,6 @@ void CMyAddon::Stop()
#ifndef WIN32
glDeleteBuffers(1, &m_vertexVBO);
m_vertexVBO = 0;
glDeleteBuffers(1, &m_indexVBO);
m_indexVBO = 0;

SAFE_DELETE(m_shader);
#endif
Expand Down Expand Up @@ -232,7 +234,6 @@ bool CMyAddon::Draw()
GLfloat x, y, z;
GLfloat r, g, b;
} vertex[m_NumLines * 2];
unsigned int idx[m_NumLines * 2];

for (size_t j = 0; j < m_NumLines * 2; ++j)
{
Expand All @@ -242,17 +243,13 @@ bool CMyAddon::Draw()
vertex[j].r = m_VertBuf[j].col[0];
vertex[j].g = m_VertBuf[j].col[1];
vertex[j].b = m_VertBuf[j].col[2];
idx[j] = j;
}

GLint colLoc = m_shader->GetColLoc();

glBindBuffer(GL_ARRAY_BUFFER, m_vertexVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(PackedVertex)*m_NumLines*2, vertex, GL_STATIC_DRAW);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexVBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(idx), idx, GL_STATIC_DRAW);

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(PackedVertex), BUFFER_OFFSET(offsetof(PackedVertex, x)));
glEnableVertexAttribArray(0);

Expand Down
2 changes: 0 additions & 2 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ class ATTRIBUTE_HIDDEN CMyAddon
TRenderVertex* m_VertBuf;
CGUIShader* m_shader;
unsigned int m_vertexVBO;
unsigned int m_vertexVAO;
unsigned int m_indexVBO;

#else
ID3D11DeviceContext* m_pContext;
Expand Down

0 comments on commit 0d463d1

Please sign in to comment.