diff --git a/data/resources/logo.png b/data/resources/logo.png new file mode 100644 index 000000000..dea38452c Binary files /dev/null and b/data/resources/logo.png differ diff --git a/src/cube/dialog/HelpAboutView.cpp b/src/cube/dialog/HelpAboutView.cpp index 084836991..52e1ac066 100644 --- a/src/cube/dialog/HelpAboutView.cpp +++ b/src/cube/dialog/HelpAboutView.cpp @@ -37,6 +37,7 @@ ////////////////////////////////////////////////////////////////////////////// #include "pch.hpp" +#include #include #include #include @@ -45,6 +46,10 @@ #include #include +// GDI+ for loading the image +#include +#include + ////////////////////////////////////////////////////////////////////////////// using namespace musik::cube::dialog; @@ -60,7 +65,10 @@ const int anim_h = 300; ( ( (G) >> 2 ) << 5 ) | \ ( ( (B) >> 3 ) ) \ )) - + +#define extract_r(C) ( ( (C) >> 11 & 0x1F ) << 3 ) +#define extract_g(C) ( ( ( (C) >> 5 ) & 0x3F ) << 2 ) +#define extract_b(C) ( ( (C) & 0x1F ) << 3 ) ////////////////////////////////////////////////////////////////////////////// @@ -88,7 +96,7 @@ void HelpAboutView::DrawingThread(HWND hwnd, BITMAPINFO* bmi) // Calc color table for plasma effect for(int i=0; i<256; i++) { - int + int r = 20 + 19.0 * sin((double)i * 3.1415 / 40.0), g = 40 + 39.0 * sin((double)i * 3.1415 / 40.0), b = 120 + 79.0 * cos((double)i * 3.1415 / 120.0); @@ -99,6 +107,85 @@ void HelpAboutView::DrawingThread(HWND hwnd, BITMAPINFO* bmi) // Start time of animation unsigned long time_start = ::GetTickCount(); + // Init GDI* + Gdiplus::GdiplusStartupInput gp_si; + ULONG_PTR gp_tok; + Gdiplus::GdiplusStartup(&gp_tok, &gp_si, NULL); + + // Load logo + Gdiplus::Bitmap* gp_logo = Gdiplus::Bitmap::FromFile( + (musik::core::GetApplicationDirectory() + _T("resources\\logo.png")).c_str() + ); + + // Convert logo to correct format + unsigned int + logo_width = gp_logo->GetWidth(), + logo_height = gp_logo->GetHeight(); + unsigned int + *logo = new unsigned int[logo_width * logo_height], + *plogo = logo; + BYTE + *logo_alpha = new BYTE[logo_width * logo_height], + *plogo_alpha = logo_alpha; + + for(int y=0; yGetPixel(x, y, &col); + + *plogo = anim_color(col.GetRed(), col.GetGreen(), col.GetBlue()); + ++plogo; + + *plogo_alpha = col.GetAlpha(); + ++plogo_alpha; + } + } + + // Create font for text scroller + HFONT font = ::CreateFont( + 14, + 0, + 0, + 0, + FW_NORMAL, + 0, + 0, + 0, + ANSI_CHARSET, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + ANTIALIASED_QUALITY | CLEARTYPE_QUALITY, + DEFAULT_PITCH, + _T("Courier New") + ); + + // Define Texts here, there are played in this order + uistring texts[] = { + _T("--+ musikCube 2 | milestone 2 +--"), + _T("created by"), + _T("avatar"), + _T("doep"), + _T("bjorn"), + _T("jooles"), + _T("naaina"), + _T("mC2 are copyright (c) mC2 Team 2007-2008"), + _T("win32cpp are copyright (c) Casey Langen 2007-2008"), + _T("mC2 wouldn't be possible without these projects:"), + _T("tuniac (http://tuniac.sf.net)"), + _T("boost (http://www.boost.org)"), + _T("sqlite3 (http://www.sqlite.org)"), + _T("taglib (http://developer.kde.org/~wheeler/taglib)") + }; + + RECT cr; + ::GetClientRect(hwnd, &cr); + + RECT textrect; + textrect.left = 0; + textrect.top = 200; + textrect.right = cr.right; + textrect.bottom = 220; + // Start drawing loop while(anim_running) { // Calc current time @@ -149,16 +236,88 @@ void HelpAboutView::DrawingThread(HWND hwnd, BITMAPINFO* bmi) wy[i] += sy[i]; } } + + // Display logo + float alpha = 0.7 + 0.3 * sin(0.3 * time * 3.1415); + int lx = 127, ly = 40; + for(int y=0; y= 0.4 && alpha <= 0.42) || + (alpha >= 0.71 && alpha <= 0.714) + ) && !(y % (1 + (rand() % logo_height)))) { + blackit = true; + } + + for(int x=0; x 2.5f) { + + if(textidx+1 == sizeof(texts) / sizeof(uistring)) { + textidx = 0; + } else { + textidx++; + } + + tdlast = time; + } + + ::DrawText( + hdc, + texts[textidx].c_str(), + texts[textidx].size() + 1, + &textrect, + DT_CENTER + ); + } + // Some idle time to give other threads the chance to process - ::Sleep(1); + Sleep(1); } + // Shutdown GDI+ + delete gp_logo; delete logo; + Gdiplus::GdiplusShutdown(gp_tok); + + // Delete resources delete[] screen; screen = NULL; } diff --git a/src/cube/main.cpp b/src/cube/main.cpp index add842e32..0134872e9 100644 --- a/src/cube/main.cpp +++ b/src/cube/main.cpp @@ -54,7 +54,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPTSTR commandLi // Initialize locale try { uistring appDirectory( musik::core::GetApplicationDirectory() ); - Locale::Instance()->SetLocaleDirectory(appDirectory); + Locale::Instance()->SetLocaleDirectory(appDirectory + _T("\\locales")); Locale::Instance()->LoadConfig(_T("english")); } catch(...) {