Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernization #61

Open
wants to merge 1 commit into
base: Omega
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/Pyro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#endif

#include "Pyro.h"

#include <vector>

#include <stdio.h>
#include <math.h>
#include <stddef.h>
Expand Down Expand Up @@ -129,7 +132,7 @@ class ATTR_DLL_LOCAL CScreensaverPyro
int m_iWidth;
int m_iHeight;

struct projectile *m_projectiles;
std::vector<projectile> m_projectiles;
struct projectile *m_free_projectiles;

int m_how_many;
Expand Down Expand Up @@ -171,9 +174,10 @@ CScreensaverPyro::CScreensaverPyro()
bool CScreensaverPyro::Start()
{
m_free_projectiles = nullptr;
m_projectiles = static_cast<struct projectile*>(calloc(m_how_many, sizeof (struct projectile)));
for (int i = 0; i < m_how_many; i++)
free_projectile(&m_projectiles[i]);
m_projectiles.resize(m_how_many);

for (auto& projectile : m_projectiles)
free_projectile(&projectile);

#ifndef WIN32
std::string fraqShader = kodi::addon::GetAddonPath("resources/shaders/" GL_TYPE_STRING "/frag.glsl");
Expand Down Expand Up @@ -265,7 +269,6 @@ void CScreensaverPyro::Render()
// any resources we have created.
void CScreensaverPyro::Stop()
{
free(m_projectiles);
#ifndef WIN32
glDeleteBuffers(1, &m_vertexVBO);
m_vertexVBO = 0;
Expand Down