From 08aff7983df7b0effa0fb8506a7d11fb17533a2b Mon Sep 17 00:00:00 2001 From: w1z7ard Date: Tue, 14 Aug 2007 01:24:39 +0000 Subject: [PATCH] added -Wall, removed all warnings thereafter - killed glConsole git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/personal/carm/dev-1.0@324 6778bc44-b910-0410-a7a0-be141de4315d --- src/projectM-engine/CMakeLists.txt | 4 +- src/projectM-engine/Common.hpp | 10 - src/projectM-engine/CustomShape.cpp | 2 +- src/projectM-engine/CustomShape.hpp | 2 +- src/projectM-engine/CustomWave.cpp | 22 +- src/projectM-engine/CustomWave.hpp | 2 +- src/projectM-engine/PBuffer.cpp | 4 +- src/projectM-engine/Param.cpp | 11 +- src/projectM-engine/Parser.cpp | 14 +- src/projectM-engine/PerPointEqn.cpp | 5 +- src/projectM-engine/Preset.cpp | 13 +- src/projectM-engine/PresetChooser.hpp | 4 +- src/projectM-engine/Renderer.cpp | 3 - src/projectM-engine/console_interface.cpp | 7 + src/projectM-engine/glConsole.cpp | 1028 --------------------- src/projectM-engine/glConsole.h | 114 --- src/projectM-engine/projectM.cpp | 7 +- 17 files changed, 50 insertions(+), 1202 deletions(-) delete mode 100755 src/projectM-engine/glConsole.cpp delete mode 100755 src/projectM-engine/glConsole.h diff --git a/src/projectM-engine/CMakeLists.txt b/src/projectM-engine/CMakeLists.txt index e12cb16f5..078eaea30 100644 --- a/src/projectM-engine/CMakeLists.txt +++ b/src/projectM-engine/CMakeLists.txt @@ -2,9 +2,9 @@ PROJECT(projectM) ADD_LIBRARY(projectM SHARED projectM.cpp projectM.hpp PBuffer.cpp PBuffer.hpp InitCond.cpp InitCond.hpp Expr.cpp PCM.cpp Parser.cpp Preset.cpp Common.hpp BeatDetect.cpp PCM.hpp PerPixelEqn.cpp Eval.hpp Param.cpp CustomWave.cpp CustomShape.hpp CustomShape.cpp Param.hpp CustomWave.hpp BeatDetect.hpp console_interface.h -Func.hpp Func.cpp Eval.cpp wipemalloc.h PerFrameEqn.cpp PerPointEqn.cpp fftsg.cpp glConsole.cpp console_interface.cpp +Func.hpp Func.cpp Eval.cpp wipemalloc.h PerFrameEqn.cpp PerPointEqn.cpp fftsg.cpp console_interface.cpp CValue.hpp Expr.hpp timer.cpp wipemalloc.cpp PerFrameEqn.hpp PerPixelEqn.hpp PerPointEqn.hpp BuiltinFuncs.hpp -BuiltinFuncs.cpp compare.h event.h fatal.h fftsg.h glConsole.h timer.h BuiltinParams.hpp BuiltinParams.cpp Preset.hpp Renderer.cpp Renderer.hpp ParamUtils.hpp PresetLoader.cpp PresetLoader.hpp PresetChooser.hpp PresetChooser.cpp PresetFrameIO.cpp PresetFrameIO.hpp PresetMerge.cpp PresetMerge.hpp) +BuiltinFuncs.cpp compare.h event.h fatal.h fftsg.h timer.h BuiltinParams.hpp BuiltinParams.cpp Preset.hpp Renderer.cpp Renderer.hpp ParamUtils.hpp PresetLoader.cpp PresetLoader.hpp PresetChooser.hpp PresetChooser.cpp PresetFrameIO.cpp PresetFrameIO.hpp PresetMerge.cpp PresetMerge.hpp) OPTION(USE_FTGL "Use FTGL for on-screen fonts" ON) diff --git a/src/projectM-engine/Common.hpp b/src/projectM-engine/Common.hpp index 78fb7b514..6d6776acd 100755 --- a/src/projectM-engine/Common.hpp +++ b/src/projectM-engine/Common.hpp @@ -83,16 +83,6 @@ inline void DWRITE( char *fmt, ... ) { return; va_list args; va_start( args, fmt ); -//#ifdef DEBUG -//#ifdef MACOS - // if ( debugFile != NULL ) {\ - vprintf(fmt, args ); - // fflush( debugFile );\ - // } else {\ - // printf( fmt, args );\ - // } -//#endif -//#endif va_end( args ); } diff --git a/src/projectM-engine/CustomShape.cpp b/src/projectM-engine/CustomShape.cpp index 690abdb44..98c649981 100755 --- a/src/projectM-engine/CustomShape.cpp +++ b/src/projectM-engine/CustomShape.cpp @@ -232,7 +232,7 @@ void CustomShape::load_custom_shape_init() traverse ( param_tree, fun ); } -void CustomShape::eval_custom_shape_init_conds() +void CustomShape::evalInitConds() { // NOTE: This is verified to be same behavior as trunk diff --git a/src/projectM-engine/CustomShape.hpp b/src/projectM-engine/CustomShape.hpp index 588fce27b..70ae8ab0c 100755 --- a/src/projectM-engine/CustomShape.hpp +++ b/src/projectM-engine/CustomShape.hpp @@ -109,7 +109,7 @@ public: int checkTrees(); void load_custom_shape_init(); - void eval_custom_shape_init_conds(); + void evalInitConds(); }; diff --git a/src/projectM-engine/CustomWave.cpp b/src/projectM-engine/CustomWave.cpp index a9cfe3bdf..d7d3c8150 100755 --- a/src/projectM-engine/CustomWave.cpp +++ b/src/projectM-engine/CustomWave.cpp @@ -46,20 +46,22 @@ CustomWave::CustomWave(int _id): id(_id), per_frame_count(0), - samples(512), - bSpectrum(0), - sep(1), - smoothing(0.0), - bUseDots(0), - bAdditive(0), r(0), g(0), b(0), a(0), + samples(512), + bSpectrum(0), + bUseDots(0), + bAdditive(0), + scaling(1.0), + smoothing(0.0), + + per_point_eqn_string_index(0), per_frame_eqn_string_index(0), - per_frame_init_eqn_string_index(0), - per_point_eqn_string_index(0) + per_frame_init_eqn_string_index(0) + { Param * param; @@ -76,7 +78,7 @@ CustomWave::CustomWave(int _id): this->sample_mesh = (float*)wipemalloc(MAX_SAMPLE_SIZE*sizeof(float)); /* Start: Load custom wave parameters */ - + if ((param = Param::new_param_float("r", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &this->r, this->r_mesh, 1.0, 0.0, .5)) == NULL) { delete(this); @@ -507,7 +509,7 @@ int CustomWave::add_per_point_eqn(char * name, GenExpr * gen_expr) } -void CustomWave::eval_custom_wave_init_conds() +void CustomWave::evalInitConds() { for (std::map::iterator pos = init_cond_tree.begin(); pos != init_cond_tree.end(); ++pos) diff --git a/src/projectM-engine/CustomWave.hpp b/src/projectM-engine/CustomWave.hpp index 973078d01..7a63db1db 100755 --- a/src/projectM-engine/CustomWave.hpp +++ b/src/projectM-engine/CustomWave.hpp @@ -131,7 +131,7 @@ public: void load_unspecified_init_conds(); - void eval_custom_wave_init_conds(); + void evalInitConds(); }; diff --git a/src/projectM-engine/PBuffer.cpp b/src/projectM-engine/PBuffer.cpp index 689bdf698..b1e690488 100755 --- a/src/projectM-engine/PBuffer.cpp +++ b/src/projectM-engine/PBuffer.cpp @@ -48,7 +48,7 @@ RenderTarget::RenderTarget(int texsize, int width, int height) : usePbuffers(fal { glewInit(); - GLuint fb, color_rb, depth_rb, rgba_tex, depth_tex, i, other_tex; + GLuint fb, depth_rb, rgba_tex, other_tex; glGenFramebuffersEXT(1, &fb); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, fb ); @@ -91,7 +91,7 @@ RenderTarget::RenderTarget(int texsize, int width, int height) : usePbuffers(fal } #endif -fallback: + DWRITE( "using teximage hack fallback\n" ); /** Fallback pbuffer creation via teximage hack */ diff --git a/src/projectM-engine/Param.cpp b/src/projectM-engine/Param.cpp index ad33cba41..c22d4ceb8 100755 --- a/src/projectM-engine/Param.cpp +++ b/src/projectM-engine/Param.cpp @@ -45,8 +45,8 @@ Param::Param( std::string _name, short int _type, short int _flags, void * _engi type(_type), flags (_flags), matrix_flag (0), - matrix (_matrix), engine_val(_engine_val), + matrix (_matrix), default_init_val (_default_init_val), upper_bound (_upper_bound), lower_bound (_lower_bound) @@ -62,11 +62,11 @@ Param::Param( std::string _name, short int _type, short int _flags, void * _engi /* Creates a user defined parameter */ Param::Param(std::string _name) : + name(_name), type(P_TYPE_DOUBLE), - flags(P_FLAG_USERDEF), + flags(P_FLAG_USERDEF), matrix_flag(0), - matrix(0), - name(_name) + matrix(0) { engine_val = new float(); @@ -148,6 +148,7 @@ Param * Param::new_param_float(char * name, short int flags, void * engine_val, Param * param; CValue iv, ub, lb; + assert(engine_val); iv.float_val = init_val; ub.float_val = upper_bound; @@ -167,6 +168,7 @@ Param * Param::new_param_int(char * name, short int flags, void * engine_val, Param * param; CValue iv, ub, lb; + assert(engine_val); iv.int_val = init_val; ub.int_val = upper_bound; @@ -186,6 +188,7 @@ Param * Param::new_param_bool(char * name, short int flags, void * engine_val, Param * param; CValue iv, ub, lb; + assert(engine_val); iv.bool_val = init_val; ub.bool_val = upper_bound; diff --git a/src/projectM-engine/Parser.cpp b/src/projectM-engine/Parser.cpp index 3dfafd9e4..e7fafc2ca 100755 --- a/src/projectM-engine/Parser.cpp +++ b/src/projectM-engine/Parser.cpp @@ -377,14 +377,6 @@ int Parser::parse_line(FILE * fs, Preset * preset) { line_mode = CUSTOM_WAVE_WAVECODE_LINE_MODE; - //if (PARSE_DEBUG) - // printf("parse_line: wavecode prefix found: \"%s\"\n", eqn_string); - - // printf("string:%d\n", 5); - - //SUPER MYSTERIO-BUG - Don't Remove - printf(""); - return parse_wavecode(eqn_string, fs, preset); } @@ -484,7 +476,7 @@ int Parser::parse_line(FILE * fs, Preset * preset) { return PROJECTM_SUCCESS; } else if (line_mode == PER_PIXEL_LINE_MODE) { - if (PARSE_DEBUG) printf("parse_line: implicit per pixel eqn\n", line_count); + if (PARSE_DEBUG) printf("parse_line: implicit per pixel eqn (LINE %d)\n", line_count); return parse_per_pixel_eqn(fs, preset, eqn_string); @@ -1726,7 +1718,6 @@ int Parser::parse_wave(char * token, FILE * fs, Preset * preset) { return PROJECTM_FAILURE; } - int last_custom_wave_id = id; strncpy(last_eqn_type, eqn_type, MAX_TOKEN_SIZE); return parse_wave_helper(fs, preset, id, eqn_type, 0); @@ -1884,9 +1875,8 @@ int Parser::parse_shape(char * token, FILE * fs, Preset * preset) { int id; char * eqn_type; - char string[MAX_TOKEN_SIZE]; CustomShape * custom_shape; - InitCond * init_cond; + if (token == NULL) diff --git a/src/projectM-engine/PerPointEqn.cpp b/src/projectM-engine/PerPointEqn.cpp index ba3736974..dd4f64169 100755 --- a/src/projectM-engine/PerPointEqn.cpp +++ b/src/projectM-engine/PerPointEqn.cpp @@ -73,9 +73,10 @@ if (!param->matrix_flag) PerPointEqn::PerPointEqn(int _index, Param * _param, GenExpr * _gen_expr, int _samples): index(_index), + samples(_samples), param(_param), - gen_expr(_gen_expr), - samples(_samples) + gen_expr(_gen_expr) + {} diff --git a/src/projectM-engine/Preset.cpp b/src/projectM-engine/Preset.cpp index ddd116ecc..dfd379acf 100755 --- a/src/projectM-engine/Preset.cpp +++ b/src/projectM-engine/Preset.cpp @@ -37,10 +37,10 @@ #include Preset::Preset(const std::string & filename, const PresetInputs & presetInputs, PresetOutputs & presetOutputs): - file_path(filename), builtinParams(presetInputs, presetOutputs), customWaves(&presetOutputs.customWaves), customShapes(&presetOutputs.customShapes), + file_path(filename), m_presetOutputs(presetOutputs) { @@ -133,8 +133,6 @@ int Preset::add_per_pixel_eqn(char * name, GenExpr * gen_expr) } - if (PER_PIXEL_EQN_DEBUG) printf("add_per_pixel_eqn: new equation (index = %d,matrix=%X) (param = \"%s\")\n", - per_pixel_eqn->index, per_pixel_eqn->param->matrix, per_pixel_eqn->param->name.c_str()); /* Insert the per pixel equation into the preset per pixel database */ std::pair::iterator, bool> inserteeOption = per_pixel_eqn_tree.insert @@ -155,7 +153,7 @@ void Preset::evalCustomShapeInitConditions() { for (PresetOutputs::cshape_container::iterator pos = customShapes->begin(); pos != customShapes->end(); ++pos) - pos->second->eval_custom_shape_init_conds(); + pos->second->evalInitConds(); } @@ -163,7 +161,7 @@ void Preset::evalCustomWaveInitConditions() { for (PresetOutputs::cwave_container::iterator pos = customWaves->begin(); pos != customWaves->end(); ++pos) - pos->second->eval_custom_wave_init_conds(); + pos->second->evalInitConds(); } @@ -179,6 +177,7 @@ void Preset::evalCustomWavePerFrameEquations() assert(_pos->second); _pos->second->evaluate(); } + std::map & per_frame_eqn_tree = pos->second->per_frame_eqn_tree; for (std::map::iterator _pos = per_frame_eqn_tree.begin(); _pos != per_frame_eqn_tree.end(); ++_pos) { @@ -287,7 +286,7 @@ void Preset::initialize(const std::string & pathname) void Preset::loadBuiltinParamsUnspecInitConds() { - +std::cerr << "builtin params unspec" << std::endl; InitCondUtils::LoadUnspecInitCond loadUnspecInitCond(this->init_cond_tree, this->per_frame_init_eqn_tree); this->builtinParams.traverse(loadUnspecInitCond); @@ -297,6 +296,7 @@ void Preset::loadBuiltinParamsUnspecInitConds() { void Preset::loadCustomWaveUnspecInitConds() { + std::cerr << "custom wave unspec" << std::endl; for (PresetOutputs::cwave_container::iterator pos = customWaves->begin(); pos != customWaves->end(); ++pos) { assert(pos->second); @@ -308,6 +308,7 @@ void Preset::loadCustomWaveUnspecInitConds() void Preset::loadCustomShapeUnspecInitConds() { +std::cerr << "custom shape unspec" << std::endl; for (PresetOutputs::cshape_container::iterator pos = customShapes->begin(); pos != customShapes->end(); ++pos) { assert(pos->second); diff --git a/src/projectM-engine/PresetChooser.hpp b/src/projectM-engine/PresetChooser.hpp index baa2bec16..f1771b413 100644 --- a/src/projectM-engine/PresetChooser.hpp +++ b/src/projectM-engine/PresetChooser.hpp @@ -96,7 +96,7 @@ public: }; - /// An STL-esque iterator to beginning traversing presets from a directory + /// An STL-esque iterator to begin traversing presets from a directory /// \returns the position of the first preset in the collection PresetIterator begin(); @@ -188,7 +188,7 @@ inline PresetIterator PresetChooser::end() const { template std::auto_ptr PresetChooser::weightedRandom(const PresetInputs & presetInputs, PresetOutputs & presetOutputs, WeightFunctor & weightFunctor) { - doWeightedSample(weightFunctor); + return doWeightedSample(weightFunctor); } template diff --git a/src/projectM-engine/Renderer.cpp b/src/projectM-engine/Renderer.cpp index 1406cdae1..82905854a 100644 --- a/src/projectM-engine/Renderer.cpp +++ b/src/projectM-engine/Renderer.cpp @@ -646,10 +646,8 @@ void Renderer::draw_shapes(PresetOutputs *presetOutputs) { int i; - float theta; float radius; - CustomShape *pos; float pi = 3.14159265; float start,inc,xval,yval; @@ -806,7 +804,6 @@ void Renderer::draw_waveform(PresetOutputs *presetOutputs, PresetInputs *presetI float wave_x_temp=0; float wave_y_temp=0; float dy_adj; - float xx,yy; float cos_rot; float sin_rot; diff --git a/src/projectM-engine/console_interface.cpp b/src/projectM-engine/console_interface.cpp index 0aad8fa90..33af4714d 100755 --- a/src/projectM-engine/console_interface.cpp +++ b/src/projectM-engine/console_interface.cpp @@ -64,6 +64,7 @@ void projectM::key_handler( projectMEvent event, switch( event ) { + case PROJECTM_KEYDOWN: //default_key_handler(); @@ -91,6 +92,9 @@ void projectM::key_handler( projectMEvent event, } break; + default: + break; + } } @@ -234,5 +238,8 @@ void projectM::default_key_handler( projectMEvent event, projectMKeycode keycode default: break; } + default: + break; + } } diff --git a/src/projectM-engine/glConsole.cpp b/src/projectM-engine/glConsole.cpp deleted file mode 100755 index 580d6b354..000000000 --- a/src/projectM-engine/glConsole.cpp +++ /dev/null @@ -1,1028 +0,0 @@ -/** - * projectM -- Milkdrop-esque visualisation SDK - * Copyright (C)2003-2004 projectM Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * See 'LICENSE.txt' included within this release - * - */ -/** - * $Id: glConsole.c,v 1.2 2005/12/28 18:51:18 psperl Exp $ - * - * Encapsulation of an OpenGL-based console - * - */ - -#include -#include -#include -#include -#ifdef MACOS -#include -#endif /** MACOS */ -#include - -#include "projectM.hpp" - -#ifdef MACOS -#include -#else -#include -#endif /** MACOS */ -#include "glConsole.h" -#include "Common.hpp" -#include "fatal.h" - -#include "wipemalloc.h" - -#ifdef USE_FTGL -#include -#include -#endif /** USE_FTGL */ - -#define HEIGHT_SPACE 8 /* pixel space between lines */ -#define DEFAULT_CONSOLE_FOREGROUND_COLOR CONSOLE_WHITE -#define DEFAULT_CONSOLE_BACKGROUND_COLOR CONSOLE_BLACK -#define DEFAULT_CURSOR_COLOR CONSOLE_GREEN -#define CURSOR_REFRESH_RATE 10 - -static int gl_console_set_color(color_t color); -int clear_console_screen_buffer(gl_console_t * gl_console); -int clear_console_scroll_buffer(gl_console_t * gl_console); -//float screen_width = 800; -//float screen_height = 600; - -extern projectM *PM; -int refresh_count = 0; - -/* Creates a new console of (width X height) with left corner at - (x, y) */ -gl_console_t * glConsoleCreate(int screen_width, int screen_height, int scroll_width, int scroll_height, - float start_x, float start_y, int Font_Descriptor) { - - console_char_t * buffer; - gl_console_t * gl_console; - - if ((screen_width > MAX_CONSOLE_WIDTH) || (screen_width < 1)) - return NULL; - - if ((screen_height > MAX_CONSOLE_HEIGHT) || (screen_height < 1)) - return NULL; - - if ((gl_console = (gl_console_t*)wipemalloc(sizeof(gl_console_t))) == NULL) - return NULL; - - if ((scroll_height < screen_height)) - return NULL; - - if ((scroll_width < screen_width)) - return NULL; - - if ((buffer = (console_char_t*)wipemalloc(scroll_width*scroll_height*sizeof(console_char_t))) == NULL) - return NULL; - /* Need to know height and width of screen so we can see if the - if x and y are valid, will do later */ - - /* Set struct parameters */ - gl_console->screen_buffer = buffer; - gl_console->font_descriptor = Font_Descriptor; - gl_console->screen_width = screen_width; - gl_console->screen_height = screen_height; - gl_console->scroll_width = scroll_width; - gl_console->scroll_height = scroll_height; - gl_console->start_x = start_x; /* x coordinate of console's upper left corner */ - gl_console->start_y = start_y; /* y coordinate of console's upper left corner */ - gl_console->screen_start_x = gl_console->screen_start_y = 0; - gl_console->screen_x = gl_console->screen_y = 0; /* set cursor positions to zero */ - gl_console->cursor_ptr = buffer; /* start cursor pointer at beginning of buffer */ - gl_console->current_fg = DEFAULT_CONSOLE_FOREGROUND_COLOR; - gl_console->current_bg = DEFAULT_CONSOLE_BACKGROUND_COLOR; - gl_console->scroll_buffer = buffer; - gl_console->cursor_color = DEFAULT_CURSOR_COLOR; - gl_console->cursor_style = BAR_STYLE; - gl_console->flags = 0; - /* Clears the console buffer */ - clear_console_scroll_buffer(gl_console); - - if (GL_CONSOLE_DEBUG) printf("glConsoleCreate: finished initializing\n"); - - /* Finished, return new console */ - return gl_console; -} - -/* Destroy the passed console */ -int glConsoleDestroy(gl_console_t * console) { - - if (console == NULL) - return PROJECTM_FAILURE; - - free(console->scroll_buffer); - free(console); - - console = NULL; - - return PROJECTM_SUCCESS; - -} - - -int glConsoleClearScreen(gl_console_t * console) { - - if (console == NULL) - return PROJECTM_FAILURE; - - clear_console_screen_buffer(console); - - return PROJECTM_SUCCESS; -} - - -int glConsoleClearBuffer(gl_console_t * console) { - - if (console == NULL) - return PROJECTM_FAILURE; - - clear_console_scroll_buffer(console); - glConsoleAlignCursorLeft(console); - glConsoleAlignCursorUp(console); - - return PROJECTM_SUCCESS; -} - -/* Aligns cursor to the next character 'c' */ -int glConsoleCursorToNextChar(char c, gl_console_t * gl_console) { - - console_char_t * endofbuf; - if (gl_console == NULL) - return PROJECTM_FAILURE; - - endofbuf = gl_console->scroll_buffer + (gl_console->scroll_width*gl_console->scroll_height) - 1; - - while ((gl_console->cursor_ptr != endofbuf) && (gl_console->cursor_ptr->symbol != c)) - glConsoleMoveCursorForward(gl_console); - - return PROJECTM_SUCCESS; - -} - -int glConsoleMoveCursorUp(gl_console_t * gl_console) { - - /* Null argument check */ - if (gl_console == NULL) - return PROJECTM_FAILURE; - - /* The screen buffer is at the top and so is the screen cursor */ - if ((gl_console->screen_start_y == 0) && (gl_console->screen_y == 0)) { - - /* Wrap up flag specified, move cursor to bottom of screen */ - if (gl_console->flags & CONSOLE_FLAG_SCROLL_WRAP_UP) { - glConsoleAlignCursorDown(gl_console); - } - - - /* Do nothing instead */ - - } - /* The screen cursor is at the top but not the screen buffer */ - else if (gl_console->screen_y == 0){ - - /* screen_y stays the same, since it scrolls up one */ - - /* Decrement the cursor_ptr by one line */ - gl_console->cursor_ptr -= gl_console->scroll_width; - - /* Decrement starting 'y' position of the screen buffer */ - gl_console->screen_start_y--; - - /* Decrement the screen buffer by one line */ - gl_console->screen_buffer -= gl_console->scroll_width; - - - } - /* General case, not at top or bottoom */ - else { - gl_console->screen_y--; - gl_console->cursor_ptr -= gl_console->scroll_width; - } - - return PROJECTM_SUCCESS; -} - - -int glConsoleMoveCursorDown(gl_console_t * gl_console) { - - /* Null argument check */ - if (gl_console == NULL) - return PROJECTM_FAILURE; - - /* The screen buffer is at the bottom and so is the screen cursor, this may not ever - happen */ - if (gl_console->screen_start_y == (gl_console->scroll_height - gl_console->screen_height)) { - if (gl_console->screen_y == (gl_console->screen_height - 1)) { - // printf("BOTTOM AND END\n"); - /* Wrap down to up enabled */ - if (gl_console->flags & CONSOLE_FLAG_SCROLL_WRAP_DOWN) { - glConsoleAlignCursorUp(gl_console); - } - - /* Otherwise, do nothing */ - } - } - - /* The screen cursor is at the bottom but not the end of the scroll buffer */ - else if (gl_console->screen_y == (gl_console->screen_height - 1)) { - - // printf("BOTTOM BUT NOT END\n"); - /* screen_y stays the same, since it scrolls down one */ - - /* Increment the cursor_ptr by one line */ - gl_console->cursor_ptr += gl_console->scroll_width; - - /* Increment starting 'y' position of the screen buffer */ - gl_console->screen_start_y++; - - /* Increment the screen buffer by one line */ - gl_console->screen_buffer += gl_console->scroll_width; - - - } - - /* General case, not at top or bottoom */ - else { - // printf("GENERAL CASE\n"); - gl_console->screen_y++; - gl_console->cursor_ptr += gl_console->scroll_width; - } - - return PROJECTM_SUCCESS; -} - -/* Move the console forward one character, wrap around is the current behavior */ -int glConsoleMoveCursorForward(gl_console_t * gl_console) { - - /* Null argument check */ - if (gl_console == NULL) - return PROJECTM_FAILURE; - - - /* The case where the end of the screen is reached and the end of the scroll buffer */ - if ((gl_console->screen_start_x + gl_console->screen_width) == (gl_console->scroll_width)) { - if ((gl_console->screen_x) == (gl_console->screen_width - 1)) { - - /* Wrap around to next line if this flag is enabled */ - if (gl_console->flags & CONSOLE_FLAG_SCROLL_WRAP_RIGHT) { - /* Down one and to the left */ - glConsoleMoveCursorDown(gl_console); - glConsoleAlignCursorLeft(gl_console); - } - - /* Otherwise do nothing */ - } - } - - /* The case where the end of the screen is reach, but the not end of the scroll buffer */ - else if (gl_console->screen_x == (gl_console->screen_width - 1)) { - - /* screen_x doesn't change because the whole console is shifted left */ - /* screen_y doesn't change because we haven't reached the end of the scroll buffer */ - - gl_console->cursor_ptr++; /* increment cursor pointer */ - gl_console->screen_buffer++; /* move the screen buffer right one */ - gl_console->screen_start_x++; /* incrementing the start of the screen 'x' variable */ - } - - /* The most common case, no scrolling required. In other words, the cursor is at some - arbitrary non end point position */ - else { - gl_console->screen_x++; /* increment x variable */ - gl_console->cursor_ptr++; /* increment cursor pointer */ - } - - return PROJECTM_SUCCESS; -} - - -/* Moves the cursor backward one space */ -int glConsoleMoveCursorBackward(gl_console_t * gl_console) { - - /* Null argument check */ - if (gl_console == NULL) - return PROJECTM_FAILURE; - - /* The case where the beginning of the screen is reached and the beginning of the scroll buffer */ - if ((gl_console->screen_start_x == 0) && (gl_console->screen_x == 0)) { - if (gl_console->flags & CONSOLE_FLAG_SCROLL_WRAP_LEFT) { - glConsoleMoveCursorUp(gl_console); - glConsoleAlignCursorRight(gl_console); - } - - } - - /* The case where the beginning of the screen is reach, but the not beginning of the scroll buffer */ - else if (gl_console->screen_x == 0) { - gl_console->cursor_ptr--; /* decrement cursor pointer */ - gl_console->screen_buffer--; /* move the screen buffer left one */ - gl_console->screen_start_x--; /* decrement the start of the screen 'x' variable */ - } - - /* The most common case, no scrolling required. In other words, the cursor is at some - arbitrary non end point position */ - else { - gl_console->screen_x--; /* increment x variable */ - gl_console->cursor_ptr--; /* increment cursor pointer */ - } - - /* Finised, return success */ - return PROJECTM_SUCCESS; -} - -/* Sets the cursor position to (x,y) of the passed console */ -int glConsoleSetCursorPos(int x, int y, gl_console_t * gl_console) { - - /* Null argument check */ - if (gl_console == NULL) - return PROJECTM_FAILURE; - - /* Bound checks */ - if ((x < 0) || (x > (gl_console->scroll_width-1))) - return PROJECTM_FAILURE; - - if ((y < 0) || (y > (gl_console->scroll_height-1))) - return PROJECTM_FAILURE; - - - /* Set cursor ptr to new screen location. This variable does not depend on if the - screen needs to be scrolled */ - gl_console->cursor_ptr = gl_console->scroll_buffer + (y * gl_console->scroll_width) + x; - - /* Goal 1: Determine what needs to be changed on the X axis */ - - - /* Case (i): x coordinate is less than the starting screen buffer x coordinate. Must - shift the screen buffer left by difference of the two coordinates */ - if (x < gl_console->screen_start_x) { - // printf("X: case (i)\n"); - - /* Align x offset to new x corodinate */ - gl_console->screen_start_x = x; - - /* Set screen_x to zero because we are left edge aligned in the screen buffer */ - gl_console->screen_x = 0; - - } - - /* Case (ii): x coordinate is greater than farthest screen buffer x coordinate. Must - shift the screen buffer right by difference of the two coordinates */ - else if (x > (gl_console->screen_start_x+gl_console->screen_width-1)) { - // printf("X: case (ii)\n"); - - /* Align end of screen buffer X coordinate space to new x coordinate */ - gl_console->screen_start_x = x - (gl_console->screen_width - 1); - - /* Set screen_x to right edge of screen buffer because we are right aligned to the new x coordinate */ - gl_console->screen_x = gl_console->screen_width - 1; - } - - /* CASE (iii): x coordinate must lie within the current screen buffer rectangle. No need to - shift the screen buffer on the X axis */ - else { - // printf("X: case (iii)\n"); - - /* Set the new screen coordinate to the passed in x coordinate minus the starting screen buffer distance */ - gl_console->screen_x = x - gl_console->screen_start_x; - - } - - - /* Goal 2: Determine what needs to be changed on the Y axis */ - - /* Case (i): y coordinate is less than the starting screen buffer y coordinate. Must - shift the screen buffer up by difference of the two coordinates */ - if (y < gl_console->screen_start_y) { - // printf("Y: case (i) y = %d, start_y = %d\n", y, gl_console->screen_start_y); - - /* Align y offset to new y corodinate */ - gl_console->screen_start_y = y; - - /* Set screen_y to zero because we are top aligned in the screen buffer */ - gl_console->screen_y = 0; - - } - - /* Case (ii): y coordinate is greater than loweest screen buffer y coordinate. Must - shift the screen buffer down by difference of the two coordinates */ - else if (y > (gl_console->screen_start_y+gl_console->screen_height-1)) { - // printf("Y: case (ii)\n"); - - /* Align end of screen buffer Y coordinate space to new y coordinate */ - gl_console->screen_start_y = y - (gl_console->screen_height-1); - - /* Set screen_y to bottom edge of screen buffer because we are bottom aligned to the new y coordinate */ - gl_console->screen_y = gl_console->screen_height - 1; - } - - /* CASE (iii): y coordinate must lie within the current screen buffer rectangle. No need to - shift the screen buffer on the Y axis */ - - else { - // printf("Y: case (iii)\n"); - /* Set the new screen coordinate to the passed in y coordinate minus the starting screen buffer distance */ - gl_console->screen_y = y - gl_console->screen_start_y; - - } - - - /* Re-adjust screen buffer ptr based on computed screen starting coordinates */ - gl_console->screen_buffer = gl_console->scroll_buffer + (gl_console->screen_start_y*gl_console->screen_width) - + gl_console->screen_start_x; - - - return PROJECTM_SUCCESS; -} - -/* Sets 'x' and 'y' to the console coordinates of the current cursor position */ -int glConsoleGetCursorPos(int * x, int * y, gl_console_t * gl_console) { - - /* Null argument check */ - if (gl_console == NULL) - return PROJECTM_FAILURE; - - /* Null arguments passed, bail */ - if ((x == NULL) || (y == NULL)) - return PROJECTM_FAILURE; - - /* Set coordinates with appropiate offset */ - *x = gl_console->screen_x + gl_console->screen_start_x; - *y = gl_console->screen_y + gl_console->screen_start_y; - - return PROJECTM_SUCCESS; -} - -/* Helper function that changes the current color */ -static int gl_console_set_color(color_t color) { - - switch (color) { - - case CONSOLE_BLACK: - glColor4f(0, 0, 0, 1); - break; - case CONSOLE_RED: - glColor4f(1, 0, 0, 1); - break; - case CONSOLE_GREEN: - glColor4f(0, 1, 0, 1); - break; - case CONSOLE_WHITE: - glColor4f(1, 1, 1, 1); - break; - case CONSOLE_BLUE: - glColor4f(0, 0, 1, 1); - break; - case CONSOLE_TRANS: - glColor4f(0, 0, 0, 0); - break; - default: /* hmm, use white I guess */ - glColor4f(1, 1, 1, 1); - } - - return PROJECTM_SUCCESS; -} - -/* Sets the passed console to a new foreground */ -int glConsoleSetFGColor(color_t color, gl_console_t * gl_console) { - - if (gl_console == NULL) - return PROJECTM_FAILURE; - - gl_console->current_fg = color; - - return PROJECTM_SUCCESS; -} - -/* Sets the passed console to a new background */ -int glConsoleSetBGColor(color_t color, gl_console_t * gl_console) { - - if (gl_console == NULL) - return PROJECTM_FAILURE; - - gl_console->current_bg = color; - - return PROJECTM_SUCCESS; -} - -/* Sets the cursor color */ -int glConsoleSetCursorColor(color_t color, gl_console_t * gl_console) { - - if (gl_console == NULL) - return PROJECTM_FAILURE; - - gl_console->cursor_color = color; - - return PROJECTM_SUCCESS; -} - -/* Prints a string starting from the current cursor position */ -int glConsolePrintString(char * s, gl_console_t * gl_console) { - - int len; - int i; - console_char_t console_char; - char symbol; - - /* Null argument checks */ - if (gl_console == NULL) - return PROJECTM_FAILURE; - - if (s == NULL) - return PROJECTM_FAILURE; - - /* Set the console struct to correct fg and bg values. - The character value will change in the for loop */ - console_char.fg_color = gl_console->current_fg; - console_char.bg_color = gl_console->current_bg; - console_char.symbol = 0; - - /* Calculate length of the string */ - len = strlen(s); - - - for (i = 0; i < len; i++) { - - /* Case on the type of character */ - - switch (symbol = *(s+i)) { - - case '\r': - case '\n': - console_char.symbol = symbol; - *gl_console->cursor_ptr = console_char; - glConsoleMoveCursorDown(gl_console); - glConsoleAlignCursorLeft(gl_console); - break; - case '\b': - glConsoleMoveCursorBackward(gl_console); - break; - default: - /* Change the screen_buffer value */ - console_char.symbol = symbol; - *gl_console->cursor_ptr = console_char; - glConsoleMoveCursorForward(gl_console); - - } - } - - return PROJECTM_SUCCESS; -} - - -/* Clears the console screen_buffer, using current fg and bg values */ -int clear_console_screen_buffer(gl_console_t * gl_console) { - - int i, console_size; - console_char_t console_char; - - /* Set console struct to current fg and bg values */ - console_char.fg_color = gl_console->current_fg; - console_char.bg_color = gl_console->current_bg; - console_char.symbol = 0; /* empty symbol */ - - if (gl_console == NULL) - return PROJECTM_FAILURE; - - console_size = gl_console->scroll_width * gl_console->scroll_height; - - for (i = 0; i < console_size; i++) - *(gl_console->screen_buffer + i) = console_char; - - return PROJECTM_SUCCESS; -} - -/* Clears the entire buffer */ -int clear_console_scroll_buffer(gl_console_t * gl_console) { - - int i, console_size; - console_char_t console_char; - - /* Set console struct to current fg and bg values */ - console_char.fg_color = gl_console->current_fg; - console_char.bg_color = gl_console->current_bg; - console_char.symbol = 0; /* empty symbol */ - - if (gl_console == NULL) - return PROJECTM_FAILURE; - - console_size = gl_console->scroll_width * gl_console->scroll_height; - - for (i = 0; i < console_size; i++) - *(gl_console->scroll_buffer + i) = console_char; - - return PROJECTM_SUCCESS; -} - -/* Align the cursor all the way to the right of the passed console */ -int glConsoleAlignCursorRight(gl_console_t * gl_console) { - - /* Null argument check */ - if (gl_console == NULL) - return PROJECTM_FAILURE; - - /* Set the cursor pointer to the rightmost end of the scroll buffer */ - gl_console->cursor_ptr += gl_console->scroll_width - (gl_console->screen_start_x + gl_console->screen_x) - 1; - - /* Move the screen buffer to the farthest right as possible */ - gl_console->screen_buffer += gl_console->scroll_width - gl_console->screen_start_x - gl_console->screen_width; - - /* Set the screen start 'x' value to length of the scroll buffer minus the length - of the screen buffer with a -1 offset to access the array correctly */ - gl_console->screen_start_x = gl_console->scroll_width - gl_console->screen_width; - - /* Set the screen_x cursor value to the screen width length minus an array adjustment offset */ - gl_console->screen_x = gl_console->screen_width - 1; - - - return PROJECTM_SUCCESS; -} - -/* Align the cursor all the way to the right of the passed console */ -int glConsoleAlignCursorLeft(gl_console_t * gl_console) { - - /* Null argument check */ - if (gl_console == NULL) - return PROJECTM_FAILURE; - - /* Set the cursor pointer to the left most end of the scroll buffer */ - gl_console->cursor_ptr -= (gl_console->screen_start_x + gl_console->screen_x); - - /* Set the screen buffer all the way to left */ - gl_console->screen_buffer -= gl_console->screen_start_x; - - /* Set the screen start x to the leftmost end of the scroll buffer */ - gl_console->screen_start_x = 0; - - /* Set the screen_x cursor value to the leftmost end of the screne buffer */ - gl_console->screen_x = 0; - - - /* Finished, return success */ - return PROJECTM_SUCCESS; -} - -/* Align the cursor to the top of the screen of the passed console */ -int glConsoleAlignCursorUp(gl_console_t * gl_console) { - - /* Null argument check */ - if (gl_console == NULL) - return PROJECTM_FAILURE; - - /* Set the cursor pointer to the top of the buffer plus the x offset */ - gl_console->cursor_ptr = gl_console->scroll_buffer + gl_console->screen_start_x + gl_console->screen_x; - - /* Set the screen start y to the top of the scroll buffer */ - gl_console->screen_start_y = 0; - - /* Set the screen_y cursor value to the top of the screen buffer */ - gl_console->screen_y = 0; - - /* Set screen buffer to the top shifted lefted by the screen start value */ - gl_console->screen_buffer = gl_console->scroll_buffer + gl_console->screen_start_x; - - /* Finished, return success */ - return PROJECTM_SUCCESS; -} - - -/* Align the cursor to the top of the screen of the passed console */ -int glConsoleAlignCursorDown(gl_console_t * gl_console) { - - /* Null argument check */ - if (gl_console == NULL) - return PROJECTM_FAILURE; - - /* Set the cursor pointer to the bottom of the buffer plus the x offset */ - gl_console->cursor_ptr = gl_console->scroll_buffer + - ((gl_console->scroll_height-1)*gl_console->scroll_width) - + gl_console->screen_start_x + gl_console->screen_x; - - /* Set the screen start y to the bottom of the scroll buffer mi screen_height */ - gl_console->screen_start_y = gl_console->scroll_height - gl_console->screen_height; - - /* Set the screen_y cursor value to the bottom of the screen buffer */ - gl_console->screen_y = gl_console->screen_height - 1; - - /* Set screen buffer to the bottom minus the height of the screen - shifted left by the screen start value */ - - gl_console->screen_buffer = gl_console->scroll_buffer + - ((gl_console->scroll_height - gl_console->screen_height) - *gl_console->scroll_width) + gl_console->screen_start_x; - - /* Finished, return success */ - return PROJECTM_SUCCESS; -} - - - -int glConsoleDraw( gl_console_t * console) { - -#ifdef USE_FTGL - int vw = 512; - int vh=512; - int x,y; - //float minx, miny, maxx, maxy; - char * symbol; - console_char_t * console_char; - float start_x, start_y; - - //REMOVE SOON - //int width=800,height=600; - - - // console->start_x=0; - // console->start_y=1; - - - int width=1; - int height=1; - - - - start_y = -(console->start_y - 1.0); - start_x = console->start_x; - - /* Null argument check */ - if (console == NULL) - return PROJECTM_FAILURE; - - symbol = (char*)wipemalloc(sizeof(char)+1); - *symbol = *(symbol+1) = 0; - - /* First, push the gl matrix to save data */ - glPushMatrix(); - - - /* Start rendering at the console's start position */ - glTranslatef(start_x,start_y,-1); - //glTranslatef(0,0.5,-1); - /* Assign a pointer to the start of the console buffer */ - console_char = console->screen_buffer; - - /* Iterate through entire console buffer, drawing each - character one at a time with appropiate foreground and - background values. May not be the most efficient. */ - - // glScalef(8.0,8.0,0); - - - - float llx; // The bottom left near most ?? in the x axis - float lly; // The bottom left near most ?? in the y axis - float llz; // The bottom left near most ?? in the z axis - float urx; // The top right far most ?? in the x axis - float ury; // The top right far most ?? in the y axis - float urz; // The top right far most ?? in the z axis - float advance; - - - //Figure out size of one console unit - PM->renderer->other_font->FaceSize((unsigned)(16*(vh/512.0))); - - /// @bug commented out to get projectM working - //advance=PM->renderer->other_font->Advance("W"); - PM->renderer->other_font->BBox("qpg_XT[",llx,lly,llx,urx,ury,urz); - - - float invfix=1.0/512; - llx*=invfix;lly*=invfix;llz*=invfix; - urx*=invfix;ury*=invfix;urz*=invfix; - advance=advance/vw; - - glTranslatef(advance*0.5,lly-ury,0); - - for (y = 0; y < console->screen_height; y++) { - - glPushMatrix(); - char buffer[console->screen_width+1]; - memset( buffer, '\0',sizeof(char) * (console->screen_width+1)); - - - - for (x = 0; x < console->screen_width; x++) { - - console_char = console->screen_buffer + (y*console->scroll_width) + x; - *symbol = console_char->symbol; - - - /* Draw the background color */ - if ((console->flags & CONSOLE_FLAG_ALWAYS_DRAW_BACKGROUND) || (*symbol != 0)) { - - /* Draw the background by drawing a rectangle */ - gl_console_set_color(console_char->bg_color); - glRectf(llx, lly ,llx+advance, ury); - - } - - /* We are at the cursor position. See if the cursor is hidden or not and act accordingly */ - if ((console_char == console->cursor_ptr) && (!(console->flags & CONSOLE_FLAG_CURSOR_HIDDEN))) { - - /* Cursor is not hidden and blinking */ - if (console->flags & CONSOLE_FLAG_CURSOR_BLINKING) { - if (refresh_count % CURSOR_REFRESH_RATE) - gl_console_set_color(console->cursor_color); - else - gl_console_set_color(console_char->bg_color); - } - - /* Cursor is not hidden, and not blinking */ - else { - gl_console_set_color(console->cursor_color); - } - - /* Draw the cursor according to the set style */ - if (console->cursor_style == BAR_STYLE) - glRectf(llx, lly, llx+advance, ury); - else if (console->cursor_style == UNDERLINE_STYLE) { - glRectf(llx, lly, llx+advance, ury); - } - } - - /* The cursor is not here or hidden, draw regular background (OLD COMMENT) */ - - /* Instead of the above, do nothing because we always draw the background before - printing the cursor to the screen */ - else { - -// if ((console->flags & CONSOLE_FLAG_ALWAYS_DRAW_BACKGROUND) || (*symbol != 0)) { - - /* Draw the background by drawing a rectangle */ -// gl_console_set_color(console_char->bg_color); -// glRectf(-0.5, 1.0 ,1.0, -1.0); - - //} - } - - /* If the symbol is nonzero draw it */ - if (*symbol != 0 && *symbol != '\n') { - buffer[x]=*symbol; - //gl_console_set_color(console_char->fg_color); - } - /* Now shift to the right by the size of the character space */ - glTranslatef(advance,0,0); - - // console_char++; - } - - - // glColor4f(0.0,1.0,1.0,1.0); - //glTranslatef(((lly-ury)*console->screen_width),0,0); - //glRasterPos2f(50,-50); - - glPopMatrix(); - - console_char = console->screen_buffer + (y*console->scroll_width + 1); - gl_console_set_color(console_char->fg_color); - glRasterPos2f(0,0); - - PM->renderer->other_font->Render(buffer); - - - /* New line, shift down the size of the symbol plus some extra space */ - - - glTranslatef(0,(lly-ury), 0); - } - //glColor4f(1,1,1,1); - - /* Finished, pop the gl matrix and return success */ - glPopMatrix(); - - - free(symbol); - refresh_count++; -#endif /** USE_FTGL */ - - return PROJECTM_SUCCESS; -} - - - -int glConsoleSetFlags(int flags, gl_console_t * gl_console) { - - if (gl_console == NULL) - return PROJECTM_FAILURE; - - gl_console->flags = gl_console->flags | flags; - - return PROJECTM_SUCCESS; -} - -#ifdef NOGOOD -int glConsoleStartShell(gl_console_t * gl_console) { - - int pid1, pid2; - char * s; - char c; - FILE * fs; - - if (gl_console == NULL) - return PROJECTM_FAILURE; - - if ((s = wipemalloc(sizeof(char) + 512)) == NULL) - return PROJECTM_FAILURE; - - memset(s, 0, 512); - -#if !defined(MACOS) && !defined(WIN32) - if ((pid1 = fork()) == 0) { - printf("bash starting\n"); - execve("/bin/bash", NULL, NULL); - printf("bash exiting..\n"); - exit(0); - } - - if ((pid2 = fork()) == 0) { - //fs = fopen("tempfile", "r"); - printf("about to loop on stdout\n"); - while (1) { - //printf("^");//fflush(stdout); - //ungetc(c, stdin); - fread(s, 1, 1, stdout); - *s = 'a'; - //printf("%c", *s);fflush(stdout); - glConsolePrintString(s, gl_console); - } - //fclose(fs); - printf("waiting for pid1 to exit\n"); - waitpid(pid1, NULL, 0); - free(s); - printf("pid1 exited\n"); - return PROJECTM_SUCCESS; - } - - printf("bash should have started\n"); -#endif /** !MACOS */ - return PROJECTM_SUCCESS; -} -#endif -/* Copies the console buffer into a character array */ -int glConsoleCopyBuffer(char * src, int len, gl_console_t * gl_console) { - - int i; - int j = 0; - int size; - char c; - if (src == NULL) - return PROJECTM_FAILURE; - if (len < 0) - return PROJECTM_FAILURE; - if (gl_console == NULL) - return PROJECTM_FAILURE; - - /* Clear the character space */ - memset(src, 0, len); - - size = gl_console->scroll_width*gl_console->scroll_height; - - for (i=0; ((i - j) < len) && (i < size); i++) { - c = (gl_console->scroll_buffer + i)->symbol; - - /* We don't want to accidentally null terminate the string...*/ - if (c != 0) - src[i - j] = c; - else - j++; - - // if (c != 0) - // src[i] = c; - // else - // src[i] = '\n'; - } - - /* Ensure the string actually ends */ - src[len - 1] = 0; - - return PROJECTM_SUCCESS; -} - -/* Sets the cursor draw style */ -int glConsoleSetCursorStyle(int style_num, gl_console_t * gl_console) { - - if (gl_console == NULL) - return PROJECTM_FAILURE; - - gl_console->cursor_style = style_num; - - return PROJECTM_SUCCESS; -} - diff --git a/src/projectM-engine/glConsole.h b/src/projectM-engine/glConsole.h deleted file mode 100755 index ecded4c00..000000000 --- a/src/projectM-engine/glConsole.h +++ /dev/null @@ -1,114 +0,0 @@ -/** - * projectM -- Milkdrop-esque visualisation SDK - * Copyright (C)2003-2007 projectM Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * See 'LICENSE.txt' included within this release - * - */ -/** - * $Id$ - * - * - * $Log$ - */ - -#ifndef _GLCONSOLE_H -#define _GLCONSOLE_H - -#define GL_CONSOLE_DEBUG 0 -#define MAX_CONSOLE_HEIGHT 500 -#define MAX_CONSOLE_WIDTH 500 - -#define CONSOLE_FLAG_NONE 0 -#define CONSOLE_FLAG_CURSOR_HIDDEN 1 -#define CONSOLE_FLAG_CURSOR_BLINKING (1 << 1) -#define CONSOLE_FLAG_SCROLL_WRAP_RIGHT (1 << 3) -#define CONSOLE_FLAG_SCROLL_WRAP_LEFT (1 << 4) -#define CONSOLE_FLAG_SCROLL_WRAP_UP (1 << 5) -#define CONSOLE_FLAG_SCROLL_WRAP_DOWN (1 << 6) -#define CONSOLE_FLAG_ALWAYS_DRAW_BACKGROUND (1 << 7) - -#define BAR_STYLE 0 -#define UNDERLINE_STYLE 1 - -typedef enum { - CONSOLE_RED, - CONSOLE_BLACK, - CONSOLE_BLUE, - CONSOLE_WHITE, - CONSOLE_GREEN, - CONSOLE_TRANS -} color_t; - -typedef struct CONSOLE_CHAR_T { - char symbol; - color_t fg_color; - color_t bg_color; -} console_char_t; - - -typedef struct GL_CONSOLE_T { - float start_x; - float start_y; - int screen_width; - int screen_height; - int scroll_width; - int scroll_height; - console_char_t * screen_buffer; /* start of current screen buffer */ - console_char_t * scroll_buffer; /* pointer to very top of buffer */ - int font_descriptor; - int screen_x; - int screen_y; - int screen_start_x; - int screen_start_y; - int cursor_style; - color_t current_fg; - color_t current_bg; - color_t cursor_color; - console_char_t * cursor_ptr; /* pointer to position in console buffer */ - short int flags; -} gl_console_t; - -int glConsoleSetFGColor(color_t color, gl_console_t * gl_console); -int glConsoleSetBGColor(color_t color, gl_console_t * gl_console); -int glConsoleSetCursorColor(color_t color, gl_console_t * gl_console); -int glConsoleSetCursorPos(int x, int y, gl_console_t * gl_console); -int glConsoleGetCursorPos(int * x, int * y, gl_console_t * gl_console); -int glConsoleShowCursor(gl_console_t * console); -int glConsoleHideCursor(gl_console_t * console); -int glConsoleDraw( gl_console_t * console); -int glConsoleClearScreen(gl_console_t * console); -int glConsoleClearBuffer(gl_console_t * console); -int glConsolePrintString(char * s, gl_console_t * console); -int glConsoleSetFlags(int flags, gl_console_t * console); -int glConsoleSetCursorStyle(int style_num, gl_console_t * console); -int glConsoleAlignCursorRight(gl_console_t * gl_console); -int glConsoleAlignCursorLeft(gl_console_t * gl_console); -int glConsoleAlignCursorUp(gl_console_t * gl_console); -int glConsoleAlignCursorDown(gl_console_t * gl_console); - -int glConsoleMoveCursorForward(gl_console_t * gl_console); -int glConsoleMoveCursorBackward(gl_console_t * gl_console); -int glConsoleMoveCursorUp(gl_console_t * gl_console); -int glConsoleMoveCursorDown(gl_console_t * gl_console); -int glConsoleStartShell(gl_console_t * gl_console); -int glConsoleCopyBuffer(char * src, int len, gl_console_t * gl_console); -int glConsoleCursorToNextChar(char c, gl_console_t * gl_console); -gl_console_t * glConsoleCreate(int screen_width, int screen_height, int scroll_width, int scroll_height, - float start_x, float start_y, int font_descriptor); -int glConsoleDestroy(gl_console_t * console); - -#endif /** !_GLCONSOLE_H */ diff --git a/src/projectM-engine/projectM.cpp b/src/projectM-engine/projectM.cpp index 365d71c43..e08ed8e3e 100755 --- a/src/projectM-engine/projectM.cpp +++ b/src/projectM-engine/projectM.cpp @@ -77,7 +77,7 @@ float smoothTime = 5; //int smoothFrame = 0; int oldFrame = 0; -DLLEXPORT projectM::projectM() :beatDetect ( 0 ) +DLLEXPORT projectM::projectM() :smoothFrame(0),beatDetect ( 0 ) { } @@ -722,8 +722,7 @@ DLLEXPORT void projectM::projectM_resetGL ( int w, int h ) { - int mindim, origtexsize; - + DWRITE ( "projectM_resetGL(): in: %d x %d\n", w, h ); /** Stash the new dimensions */ @@ -803,7 +802,7 @@ int projectM::initPresetTools() // First preset std::cerr << "[projectM] Allocating first preset..." << std::endl; m_activePreset = m_presetPos->allocate ( presetInputs, presetOutputs ); - +// m_activePreset2 = m_p std::cerr << "[projectM] First preset allocated. File path is \"" << m_activePreset->absoluteFilePath() << "\"" << std::endl; projectM_resetengine();