mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-04-28 01:14:49 +00:00
- some fixes, propery deallocation- is projectm a class or not?
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/personal/carm/dev-1.0@240 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -157,12 +157,14 @@ void projectM::default_key_handler( projectMEvent event, projectMKeycode keycode
|
||||
// paranoia but could be useful if directory is empty
|
||||
/// @bug implement == operator
|
||||
if (!(m_presetPos != m_presetChooser->end()))
|
||||
return;
|
||||
return;
|
||||
m_presetChooser->getNumPresets();
|
||||
++m_presetPos;
|
||||
/// @bug implement == operator
|
||||
if (!(m_presetPos != m_presetChooser->end()))
|
||||
--m_presetPos;
|
||||
this->activePreset = m_presetPos.allocate(this->presetInputs, this->presetOutputs);
|
||||
//this->activePreset = m_presetPos.allocate(
|
||||
break;
|
||||
case PROJECTM_K_r:
|
||||
// if (PresetSwitcher::switchPreset(RANDOM_NEXT, HARD_CUT) < 0) {
|
||||
|
||||
@ -159,7 +159,9 @@ int x, y;
|
||||
DLLEXPORT void projectM::projectM_reset() {
|
||||
|
||||
DWRITE( "projectM_reset(): in\n" );
|
||||
this->activePreset = NULL;
|
||||
|
||||
/// @bug it's very possible this is a hack
|
||||
this->activePreset = std::auto_ptr<Preset>(0);
|
||||
|
||||
this->presetURL = NULL;
|
||||
this->fontURL = NULL;
|
||||
@ -638,11 +640,6 @@ DLLEXPORT void projectM::projectM_setTitle( char *title ) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @bug:move to header file
|
||||
/** initPresetTools: initializes the preset
|
||||
loading library. this should be done before
|
||||
any parsing. function in limbo, may be dumped */
|
||||
int projectM::initPresetTools() {
|
||||
|
||||
/* Initializes the builtin function database */
|
||||
@ -682,4 +679,15 @@ int projectM::initPresetTools() {
|
||||
return PROJECTM_SUCCESS;
|
||||
}
|
||||
|
||||
void projectM::destroyPresetTools() {
|
||||
|
||||
if(m_presetChooser)
|
||||
delete(m_presetChooser);
|
||||
|
||||
if (m_presetLoader)
|
||||
delete(m_presetLoader);
|
||||
|
||||
Eval::destroy_infix_ops();
|
||||
BuiltinFuncs::destroy_builtin_func_db();
|
||||
|
||||
}
|
||||
|
||||
@ -73,6 +73,8 @@
|
||||
|
||||
#include "PresetChooser.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
//#include <dmalloc.h>
|
||||
class BeatDetect;
|
||||
class Func;
|
||||
@ -125,7 +127,8 @@ public:
|
||||
static const std::string PROJECTM_PRESET_PATH;
|
||||
|
||||
static projectM *currentEngine;
|
||||
static Preset *activePreset;
|
||||
/// @bug: why is this static?
|
||||
static std::auto_ptr<Preset> activePreset;
|
||||
static Renderer *renderer;
|
||||
static RenderTarget *renderTarget;
|
||||
|
||||
@ -142,10 +145,6 @@ public:
|
||||
|
||||
GLubyte *fbuffer;
|
||||
|
||||
/** Preset information */
|
||||
/// bug: move
|
||||
int preset_index; /** Index into the preset dir */
|
||||
|
||||
#ifndef WIN32
|
||||
/* The first ticks value of the application */
|
||||
struct timeval startTime;
|
||||
@ -239,7 +238,12 @@ public:
|
||||
projectMKeycode keycode, projectMModifier modifier );
|
||||
void default_key_handler( projectMEvent event, projectMKeycode keycode );
|
||||
|
||||
/// Initializes preset loading / management libraries
|
||||
int initPresetTools();
|
||||
|
||||
/// Deinitialize all preset related tools. Usually done before projectM cleanup
|
||||
void destroyPresetTools();
|
||||
|
||||
private:
|
||||
|
||||
// The current position of the directory iterator
|
||||
|
||||
Reference in New Issue
Block a user