mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-06 15:35:04 +00:00
WTF!
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@508 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -32,7 +32,7 @@ Renderer::Renderer(int width, int height, int gx, int gy, RenderTarget *renderTa
|
||||
|
||||
this->drawtitle=0;
|
||||
|
||||
this->title = NULL;
|
||||
this->title = "Unknown";
|
||||
|
||||
/** Other stuff... */
|
||||
this->correction = 1;
|
||||
@ -1200,21 +1200,19 @@ void Renderer::draw_title_to_texture() {
|
||||
{
|
||||
glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
|
||||
glColor4f(1.0,1.0,1.0,1.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
|
||||
glLoadIdentity();
|
||||
glTranslatef(0,0.5, 0);
|
||||
|
||||
glScalef(0.0025,-0.0025,30*.0025);
|
||||
//glTranslatef(0,0, 1.0);
|
||||
|
||||
poly_font->FaceSize( 22);
|
||||
|
||||
glRasterPos2f(0.0, 0.0);
|
||||
|
||||
if ( this->title != NULL ) {
|
||||
poly_font->Render(this->title );
|
||||
} else {
|
||||
poly_font->Render("Unknown" );
|
||||
}
|
||||
|
||||
poly_font->Render(this->title.c_str() );
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||
glPopMatrix();
|
||||
this->drawtitle=0;
|
||||
@ -1233,28 +1231,24 @@ void Renderer::draw_title_to_screen() {
|
||||
|
||||
glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
|
||||
glColor4f(1.0,1.0,1.0,1.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
|
||||
|
||||
//glTranslatef(this->vw*.5,this->vh*.5 , -1.0);
|
||||
glTranslatef(0,0.5 , 0);
|
||||
glLoadIdentity();
|
||||
|
||||
glTranslatef(-0.5, 0 , 0);
|
||||
|
||||
glScalef(easein3,easein3,30*.0025);
|
||||
|
||||
glRotatef(easein2*360,1,0,0);
|
||||
|
||||
|
||||
//glTranslatef(-.5*this->vw,0, 0.0);
|
||||
|
||||
//poly_font->Depth(1.0);
|
||||
poly_font->FaceSize(22);
|
||||
|
||||
glRasterPos2f(0.0, 0.0);
|
||||
if ( this->title != NULL ) {
|
||||
poly_font->Render(this->title );
|
||||
} else {
|
||||
poly_font->Render("Unknown" );
|
||||
}
|
||||
|
||||
poly_font->Render(this->title.c_str() );
|
||||
|
||||
// poly_font->Depth(0.0);
|
||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||
glPopMatrix();
|
||||
@ -1277,11 +1271,8 @@ void Renderer::draw_title() {
|
||||
glRasterPos2f(0.01, 0.05);
|
||||
title_font->FaceSize( (unsigned)(20*(this->vh/512.0)));
|
||||
|
||||
if ( this->title != NULL ) {
|
||||
title_font->Render(this->title );
|
||||
} else {
|
||||
title_font->Render("Unknown" );
|
||||
}
|
||||
|
||||
title_font->Render(this->title.c_str() );
|
||||
// glPopMatrix();
|
||||
//glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ FTGLPolygonFont *poly_font;
|
||||
|
||||
int totalframes;
|
||||
float realfps;
|
||||
char *title;
|
||||
std::string title;
|
||||
int drawtitle;
|
||||
|
||||
Renderer( int width, int height, int gx, int gy, RenderTarget *renderTarget, TextureManager *textureManager, BeatDetect *beatDetect, std::string fontURL);
|
||||
|
||||
@ -817,23 +817,13 @@ DLLEXPORT void projectM::projectM_resetGL ( int w, int h )
|
||||
}
|
||||
|
||||
/** Sets the title to display */
|
||||
DLLEXPORT void projectM::projectM_setTitle ( char *title )
|
||||
{
|
||||
/*
|
||||
if (strcmp(this->title, title)!=0)
|
||||
{printf("new title\n");
|
||||
this->drawtitle=1;
|
||||
|
||||
if ( this->title != NULL ) {
|
||||
free( this->title );
|
||||
this->title = NULL;
|
||||
}
|
||||
|
||||
this->title = (char *)wipemalloc( sizeof( char ) * ( strlen( title ) + 1 ) );
|
||||
strcpy( this->title, title );
|
||||
|
||||
}
|
||||
*/
|
||||
DLLEXPORT void projectM::projectM_setTitle ( std::string title )
|
||||
{
|
||||
if (title != renderer->title)
|
||||
{
|
||||
renderer->title=title;
|
||||
renderer->drawtitle=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ public:
|
||||
void projectM_init(int gx, int gy, int fps, int texsize, int width, int height);
|
||||
void projectM_reset();
|
||||
DLLEXPORT void projectM_resetGL( int width, int height );
|
||||
DLLEXPORT void projectM_setTitle( char *title );
|
||||
DLLEXPORT void projectM_setTitle( std::string title );
|
||||
DLLEXPORT void renderFrame();
|
||||
|
||||
|
||||
|
||||
@ -9,8 +9,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "projectM-wmp.h"
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CProjectMwmp::CProjectMwmp
|
||||
// Constructor
|
||||
@ -348,6 +346,30 @@ STDMETHODIMP CProjectMwmp::Destroy()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
char* ConvertBSTRToLPSTR (BSTR bstrIn)
|
||||
{
|
||||
LPSTR pszOut = NULL;
|
||||
|
||||
if (bstrIn != NULL)
|
||||
{
|
||||
int nInputStrLen = SysStringLen (bstrIn);
|
||||
|
||||
// Double NULL Termination
|
||||
int nOutputStrLen = WideCharToMultiByte(CP_ACP, 0, bstrIn, nInputStrLen, NULL, 0, 0, 0) + 2;
|
||||
|
||||
pszOut = new char [nOutputStrLen];
|
||||
|
||||
if (pszOut)
|
||||
{
|
||||
memset (pszOut, 0x00, sizeof (char)*nOutputStrLen);
|
||||
|
||||
WideCharToMultiByte (CP_ACP, 0, bstrIn, nInputStrLen, pszOut, nOutputStrLen, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return pszOut;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CProjectMwmp::NotifyNewMedia
|
||||
// Invoked when a new media stream begins playing.
|
||||
@ -357,9 +379,23 @@ STDMETHODIMP CProjectMwmp::Destroy()
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP CProjectMwmp::NotifyNewMedia(IWMPMedia *pMedia)
|
||||
{
|
||||
if (starting == false)
|
||||
{
|
||||
CComBSTR name;
|
||||
pMedia->get_name(&name);
|
||||
|
||||
LPTSTR pszConvertedCharStr = ConvertBSTRToLPSTR (name);
|
||||
std::string strConverted (pszConvertedCharStr);
|
||||
|
||||
delete [] pszConvertedCharStr;
|
||||
|
||||
globalPM->projectM_setTitle(strConverted);
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CProjectMwmp::OnWindowMessage
|
||||
// Window messages sent to the parent window.
|
||||
|
||||
Reference in New Issue
Block a user