inline Color32 coloring2(const long iter,const long max_iter){ if (iter==max_iter){ return Color32(255,0,0); }else{ return Color32(modColor2(iter*20),modColor2(iter*15+85),modColor2(iter*30+171)); } }
inline Color32 coloring3_s(const long iter,const long max_iter){ if (iter==max_iter){ return Color32(255,0,0); }else{ return Color32(modColor2(iter),modColor2(iter+85),modColor2(iter+171)); } }
//color=i%256 // / / / / / // / / / / / // / / / / / inline Color32 coloring1(const long iter,const long max_iter){ if (iter==max_iter){ return Color32(255,0,0); }else{ return Color32((iter*20)%256,(iter*15+85)%256,(iter*30+171)%256); } }
inline Color32 coloring4(const double iter,const long max_iter){ if (iter==max_iter){ return Color32(255,0,0); }else{ return Color32(sinColor(iter*20),sinColor(iter*15+85),sinColor(iter*30+171)); } }
graphic::SpriteDesc Player::getDesc() { graphic::SpriteDesc ret; ret.setPos(RectC(0, 0, abs(width()), abs(height()))); ret.setUV(getUVRect()); ret.setColor(Color32(255, 255, 255)); ret.setHilight(Color32(0, 0, 0)); return ret; }
void Button::Render() { SDL_Rect absolutePosition = GetAbsolutePosition(); // Draw the background and border g_graphics->Blit(s_images[m_state], NULL, SCREEN_SURFACE_ID, &absolutePosition, Color32(255,0,0,128)); g_graphics->DrawRect(&absolutePosition, Color32(255,0,0)); Widget::Render(); }
void DebugRenderer::cube(const Vector3& pos, const Matrix4& rot, float sideLength, const Color32& color) { Vector3 coords[8]; for (uint i = 0; i < 8; ++i) coords[i] = rot.apply((m_cubeCoords[i] * sideLength)) + pos; quad(coords[1], coords[0], coords[3], coords[2], Color32(255, 0, 0, 0)); quad(coords[4], coords[5], coords[6], coords[7], Color32(0, 255, 0, 0)); quad(coords[0], coords[1], coords[5], coords[4], Color32(0, 0, 255, 0)); quad(coords[7], coords[6], coords[2], coords[3], Color32(255, 255, 0, 0)); quad(coords[5], coords[1], coords[2], coords[6], Color32(255, 0, 255, 0)); quad(coords[0], coords[4], coords[7], coords[3], color); }
void Scene::Initialize(uint32_t uID, std::string * name) { _name = *name; _uID = uID; Texture* blankDiff = new Texture(Color32(0xFFFFFFFF)); Texture* blankNrm = new Texture(Color32((uint8_t)255, (uint8_t)127, (uint8_t)127, (uint8_t)255)); _defaultMaterial = new Material ( blankDiff, blankNrm ); InitializeScene(); }
void ColorBlock::splatX() { for(int i = 0; i < 16; i++) { uint8 x = m_color[i].r; m_color[i] = Color32(x, x, x, x); } }
void ColorBlock::swizzleDXT5n() { for(int i = 0; i < 16; i++) { Color32 c = m_color[i]; m_color[i] = Color32(0xFF, c.g, 0, c.r); } }
Color32 Thing::getPixel(int x, int y) { unsigned char r,g,b,a; unsigned int* pixels = (unsigned int*)this->screen_ref->pixels; unsigned int* pixel = pixels + y*(this->screen_ref->pitch/4) + x; // offset of pointer SDL_GetRGBA(*pixel, this->screen_ref->format, &r, &g, &b, &a); return Color32(r,g,b,a); };
void ColorBlock::splatY() { for(int i = 0; i < 16; i++) { uint8 y = m_color[i].g; m_color[i] = Color32(y, y, y, y); } }
BOOL MenuState::Init() { exit = FALSE; GET_INPUT_MANAGER; input::IController* lController; lInputManager->ClearAllActionInput(); if ((lController = lInputManager->CreateController(input::ETypeControls::eKeyboard)) == 0) return FALSE; /*lController->RegisterInputAction(eExit, input::KeyboardController::eEscape); lController->RegisterInputAction(eNum1, input::KeyboardController::e1); lController->RegisterInputAction(eNum2, input::KeyboardController::e2); lController->RegisterInputAction(eNum3, input::KeyboardController::e3);*/ if ((lController = lInputManager->CreateController(input::ETypeControls::eMouse)) == 0) return FALSE; lController->RegisterInputAction(eLeftButton, input::MouseController::eLeftButton); GET_WORLD; lWorld->Init(); graphics::Camera* lCamera = graphics::RenderManager::Instance()->CreateOrthographicCamera(0.0f, 800.0f, 600.0f, 0.0f, -1.0f, 1.0f); graphics::RenderManager::Instance()->SetRenderCamera(lCamera); graphics::RenderManager::Instance()->SetUIRenderCamera(graphics::RenderManager::Instance()->CreateOrthographicCamera(0.0f, 800.0f, 600.0f, 0.0f, -1.0f, 1.0f)); logic::IGameObject* lGameObject = new logic::IGameObject(); lGameObject->AddComponent(lCamera); lWorld->AddGameObject(lGameObject, TRUE); mMenu = ui::MenuManager::Instance()->CreateMenu(); io::FileSystem::Instance()->ChangeDirectory(".\\materials"); //mMenu->AddButtonWithImage(Rect<>(240, 210, 200, 200), &StartGame1, "Menu1.png"); mMenu->AddButtonWithText(Rect<>(400, 280, 200, 70), &StartGame2, "Start", 2.0f )->ConfigureOnFocus(2.5f, Color32(1.0f, 0.0f, 0.0f, 1.0f), 0.2f); //mMenu->AddButtonWithImage(Rect<>(550, 210, 200, 200), &StartGame2, "Menu2.png"); mMenu->AddButtonWithText(Rect<>(400, 355, 200, 70), &Exit, "Exit", 2.0f)->ConfigureOnFocus(2.5f, Color32(1.0f, 0.0f, 0.0f, 1.0f), 0.2f); graphics::RenderManager::Instance()->SetClearColor(Color32(0.25f, 0.5f, 0.6f, 1.0f)); //core::LogString("Press 1 on the Game Screen to play snake game"); //core::LogString("Press 2 on the Game Screen to play platform game"); //core::LogString("Press ESC to exit"); io::FileSystem::Instance()->ChangeDirectory(".\\audio"); mMusic = audio::AudioManager::Instance()->CreateSound2D("Menu.mp3"); mMusic->Play(audio::eAudioGroups::eMusic, TRUE); io::FileSystem::Instance()->ChangeDirectory(".\\materials"); mTextRenderer = graphics::RenderManager::Instance()->LoadTextRenderer("PerfectPixel.ttf", 24); return TRUE; }
void Icon::Select( bool bSelect ) { if( bSelect ) m_sHighlightColor = Color32( 186, 199, 227 ); else m_sHighlightColor = m_sEraseColor; m_bSelected = bSelect; Invalidate(); Flush(); }
VSprite* CSpriteFactory::CreateMemoSprite(VScene* pScene,TSpriteNode* pSpriteNode) { VMemoSprite* pSprite = new VMemoSprite(pSpriteNode->getWidth(),pSpriteNode->getHeight()); pSprite->setIsAutoLine(true); pSprite->setIsAllowMultiLine(true); pSprite->getFont().setSize(20); pSprite->setColor(Color32(255,189,189)); pSprite->addLine(pSpriteNode->getName().c_str()); return pSprite; }
/// Get average color of the block. Color32 ColorBlock::averageColor() const { uint r, g, b, a; r = g = b = a = 0; for(uint i = 0; i < 16; i++) { r += m_color[i].r; g += m_color[i].g; b += m_color[i].b; a += m_color[i].a; } return Color32(uint8(r / 16), uint8(g / 16), uint8(b / 16), uint8(a / 16)); }
Button::Button ( InputCallback _callback, Widget *_callbackParam, const char *_caption, SDL_Rect &_pos ) : InputWidget ( _callback, _callbackParam, _pos.x, _pos.y, _pos.w, _pos.h ), m_state(BUTTON_STATE_ACTIVE) { if (Button::s_images[0] == INVALID_SURFACE_ID) { Button::s_images[BUTTON_STATE_INACTIVE] = g_graphics->LoadImage("themes/default/button/inactive.png"); Button::s_images[BUTTON_STATE_ACTIVE] = g_graphics->LoadImage("themes/default/button/active.png"); Button::s_images[BUTTON_STATE_HOVER] = g_graphics->LoadImage("themes/default/button/hover.png"); Button::s_images[BUTTON_STATE_PRESSED] = g_graphics->LoadImage("themes/default/button/pressed.png"); } m_widgetClass = WIDGET_BUTTON; m_caption = new TextUI(_caption, Color32(255,0,0), 0, 0); AddWidget(m_caption); // Forces a position recalculation for m_caption. m_damaged = true; }
Color32 bicubicFast(const Pixels32Ref& pic,const long srcx_16,const long srcy_16) { UInt32 result; asm { mov ecx,pic mov eax,srcy_16 mov ebx,srcx_16 movzx edi,ah //v_8 mov edx,[ecx+Pixels32Ref.pdata] shr eax,16 mov esi,[ecx+Pixels32Ref.byte_width] dec eax movzx ecx,bh //u_8 shr ebx,16 imul eax,esi lea edx,[edx+ebx*4-4] add edx,eax //pixel mov eax,ecx neg ecx pxor mm7,mm7 //0 //mov edx,pixel pxor mm0,mm0 //result=0 //lea eax,auv_7 lea ebx,[(offset SinXDivX_Table_MMX)+256*4+edi*4] call _private_ThreeOrder_Fast_MMX lea ebx,[(offset SinXDivX_Table_MMX)+edi*4] call _private_ThreeOrder_Fast_MMX neg edi lea ebx,[(offset SinXDivX_Table_MMX)+256*4+edi*4] call _private_ThreeOrder_Fast_MMX lea ebx,[(offset SinXDivX_Table_MMX)+512*4+edi*4] call _private_ThreeOrder_Fast_MMX psraw mm0,3 packuswb mm0,mm7 movd result,mm0 } return Color32(result); }
ErrorWindow::ErrorWindow ( const char *_title, const char *_text, bool _critical ) : Window (_title, g_graphics->GetCenterX() - 150, g_graphics->GetCenterY() - 50, 300, 100), m_critical(_critical) { m_widgetClass = WIDGET_ERROR_WINDOW; m_caption = new TextUI ( "[null]", Color32(255,0,0), 35, 30 ); AddWidget ( m_caption ); SDL_Rect pos; pos.w = 50; pos.h = 20; pos.x = (m_position.w / 2) - (pos.w / 2); pos.y = 60; Button *button = new Button ( (InputCallback)ErrorWindow_OnOKClick, this, "OK", pos ); m_enterKeyDefault = button; AddWidget ( button ); button = NULL; SetCaption ( _text ); }
//--------------------------------------------------------------------- // ● 選択している項目を変更した //--------------------------------------------------------------------- void SceneGameover::_onSelectIndex() { mPointCursor->moveTo( COMMAND_POS_X - 38, COMMAND_POS_Y + mSelectIndex * 32 + 16 ); mDescContents->Clear( Color32( 0, 0, 0, 0 ) ); if ( mSelectIndex == 0 ) { mDescContents->DrawText("Continue", LRect(8, 2, 256, 256), mDescTitleFont, Color32::White, Color32::Black, 0, TextAlignment::Left); mFormatText.setText( "ステージの最初からやり直します。\n\nスコアが 0 にリセットされます。" ); mFormatText.build(); } else { mDescContents->DrawText("End", LRect(8, 2, 256, 256), mDescTitleFont, Color32::White, Color32::Black, 0, TextAlignment::Left); mFormatText.setText( "タイトル画面に戻ります。" ); mFormatText.build(); } }
//--------------------------------------------------------------------- // ● 矢印の位置設定 //--------------------------------------------------------------------- void SceneTitle::_setPointCursorIndex( int index_ ) { //mSelectIndex = index_; mPointCursor->moveTo((int)COMMAND_POS_X - 38, (int)COMMAND_POS_Y + mSelectIndex * 32 + 16); mDescContents->Clear(Color32(0, 0, 0, 0)); // モード選択中 if (mStep == 1) { mDescContents->DrawText(gDescContentTitles_1[mSelectIndex], Rect(8, 2, 256, 256), mDescTitleFont, Color32::Black, Color32::White, 0, TextAlignment::Left); mFormatText.setText(gDescContents_1[mSelectIndex]); mFormatText.build(); } // 難易度選択中 else if (mStep == 2) { mDescContents->DrawText(gDescContentTitles_2[mSelectIndex], Rect(8, 2, 256, 256), mDescTitleFont, Color32::Black, Color32::White, 0, TextAlignment::Left); mFormatText.setText(gDescContents_2[mSelectIndex]); mFormatText.build(); } }
inline Color::operator D3DCOLOR() const { return Color32(*this); }
Color32 &setLerp(const Color32 &lhs, const Color32 &rhs, float t) { *this = Color32(Color().setLerp(Color(lhs), Color(rhs), t)); return *this; }
Color32 operator/(float rhs) const { return Color32(*this)/=rhs; }
Color32 operator*(float rhs) const { return Color32(*this)*=rhs; }
Color32 operator/(const Color32 &rhs) const { return Color32(*this)/=rhs; }
Color32 operator*(const Color32 &rhs) const { return Color32(*this)*=rhs; }
Color32 operator-(const Color32 &rhs) const { return Color32(*this)-=rhs; }
Color32 operator+(const Color32 &rhs) const { return Color32(*this)+=rhs; }
Color32 &operator/=(float rhs) { *this = Color32(Color(*this)/rhs); return *this; }