void ctlColourPicker::DoProcessLeftClick(wxMouseEvent& event) { wxColourData clrData; // If there is an initial colour, set it for wxColourDialog if (m_colour_clr.IsOk()) clrData.SetColour(m_colour_clr); // Declare the new dialog wxColourDialog dialog(this, &clrData); // and set its title dialog.SetTitle(m_title); // Now, show it if (dialog.ShowModal() == wxID_OK) { clrData = dialog.GetColourData(); SetColour(clrData.GetColour()); } }
UISlider::UISlider(SDL_Rect dim, SDL_Color backcol, SDL_Color forecol, const char* font, SDL_Color fontcol, int fx, int fy) { m_XPos = dim.x; m_YPos = dim.y; m_Width = dim.w; m_Height = dim.h; m_ForegroundColour = forecol; m_Font = font; m_FontCol = fontcol; m_FontDest.x = fx; m_FontDest.y = fy; SetColour(backcol); // Create some surfaces and prepare them. SDL_SmartSurface surf { SDL_CreateRGBSurface(0, m_Width, m_Height, 32, 0, 0, 0, 0) }; SDL_SmartSurface surf2 { SDL_CreateRGBSurface(0, m_Width, m_Height, 32, 0, 0, 0, 0) }; // Fill the surfaces in with pixels. SDL_FillRect(surf.get(), nullptr, SDL_MapRGB(surf->format, m_Colour.r, m_Colour.g, m_Colour.b)); SDL_FillRect(surf2.get(), nullptr, SDL_MapRGB(surf2->format, m_ForegroundColour.r, m_ForegroundColour.g, m_ForegroundColour.b)); // Create the textures. m_BarBack = SDL_CreateSmartTextureFromSurface(Locator::Get<Window>()->GetRenderer(), surf); m_BarFore = SDL_CreateSmartTextureFromSurface(Locator::Get<Window>()->GetRenderer(), surf2); // Set alpha blending on the textures. SDL_SetTextureBlendMode(m_BarBack.get(), SDL_BLENDMODE_BLEND); SDL_SetTextureAlphaMod(m_BarBack.get(), m_Colour.a); SDL_SetTextureBlendMode(m_BarFore.get(), SDL_BLENDMODE_BLEND); SDL_SetTextureAlphaMod(m_BarFore.get(), m_ForegroundColour.a); SDL_SmartSurface fontsurf { TTF_RenderText_Blended(Locator::Get<FontManager>()->Get(m_Font)->GetTTF().get(), "0%", m_FontCol) }; m_Percentage = SDL_CreateSmartTextureFromSurface(Locator::Get<Window>()->GetRenderer(), fontsurf); m_Dest.w = surf->w; m_Dest.h = surf->h; m_DestFore.w = surf2->w; m_DestFore.h = surf2->h; }
void SSGameLobby::TryChangeColour( int index, short playerID, bool force ) { auto canChange = [this, &index, &playerID]( ) -> bool { int i = 0; for ( auto& playerEntry : m_ConnectedPlayerEntries ) { if ( playerEntry.SelectedColourIndex == index && i != playerID ) return false; ++i; } return true; }; if ( g_NetworkInfo.AmIHost( ) ) { if ( canChange() ) { SetColour( index, playerID ); DEV( if ( playerID == g_NetworkInfo.GetNetworkID() ) { Logger::Log( "Broadcasting colour change to all clients. Player ID: " + rToString( playerID ) + ". Colour index: " + rToString(index), "SSGameLobby", LogSeverity::DEBUG_MSG ); } else { Logger::Log( "Received colour change request from client. Broadcasting colour change to all clients. Player ID: " + rToString( playerID ) + ". Colour index: " + rToString(index), "SSGameLobby", LogSeverity::DEBUG_MSG ); } ); // Broadcast colour change to clients if ( AreAnyClientsConnected( ) ) g_PacketPump.SendToAll( ColourChangeMessage( playerID, index, true ) ); } else {
//----------------------------------------------------------------------------------------------------------------------------------- void Button::HandleInput(DX::StepTimer const& timer, const Vector2& mousePosition) { UIObject::HandleInput(timer, mousePosition); if (AcceptsInput()) { if (IsMouseOver() && m_buttonState != ButtonState::kPressed) { m_buttonState = ButtonState::kHighlighted; SetColour(m_highlightedColour); } if (IsSelected()) { if (m_buttonState != ButtonState::kPressed) { assert(m_clickFunction); m_clickFunction(); m_buttonState = ButtonState::kPressed; } } } }
void DG8DynamicVB::SetColour(Colour4f *c) { SetColour(c->r,c->g,c->b,c->a); }
void Tile::SetTexture( std::string fileName ) { LoadTexture(fileName); SetColour(fileName); }
// do the action required to open a single atomic tag (iAction) void CMUSHclientDoc::MXP_OpenAtomicTag (const CString strTag, int iAction, CStyle * pStyle, CString & strAction, // new action CString & strHint, // new hint CString & strVariable, // new variable CArgumentList & ArgumentList) { CString strArgument; CString strArgumentName; bool bIgnoreUnusedArgs = false; // cut down on some spam by setting this COLORREF colour1, colour2; unsigned short iFlags = pStyle->iFlags; COLORREF iForeColour = pStyle->iForeColour; COLORREF iBackColour = pStyle->iBackColour; // call script if required if (m_dispidOnMXP_OpenTag != DISPID_UNKNOWN || m_bPluginProcessesOpenTag) { // dummy-up an argument list CString strArgument; CArgument * pArgument; POSITION pos; // put the arguments into the array for (pos = ArgumentList.GetHeadPosition (); pos; ) { pArgument = ArgumentList.GetNext (pos); // empty ones we will put there by position if (pArgument->strName.IsEmpty ()) strArgument += CFormat ("'%s'", (LPCTSTR) pArgument->strValue); else strArgument += CFormat ("%s='%s'", (LPCTSTR) pArgument->strName, (LPCTSTR) pArgument->strValue); if (pos) strArgument += " "; } // end of looping through each argument bool bNotWanted = MXP_StartTagScript (strTag, strArgument, ArgumentList); // re-get current style in case the script did a world.note pStyle = m_pCurrentLine->styleList.GetTail (); // put things backt to how they were pStyle->iFlags = iFlags; pStyle->iForeColour = iForeColour; pStyle->iBackColour = iBackColour; if (bNotWanted) return; // they didn't want to go ahead with this tag } // find current foreground and background RGB values GetStyleRGB (pStyle, colour1, colour2); // special processing for Pueblo // a tag like this: <A XCH_CMD="examine #1"> // will convert to a SEND tag if (iAction == MXP_ACTION_HYPERLINK && PUEBLO_ACTIVE) { strArgument = GetArgument (ArgumentList, "xch_cmd", 0, true); if (!strArgument.IsEmpty ()) { m_bPuebloActive = true; // for correct newline processing iAction = MXP_ACTION_SEND; } } // now take the action switch (iAction) { // temporarily make headlines the same as bold case MXP_ACTION_H1: case MXP_ACTION_H2: case MXP_ACTION_H3: case MXP_ACTION_H4: case MXP_ACTION_H5: case MXP_ACTION_H6: case MXP_ACTION_BOLD: pStyle->iFlags |= HILITE; break; case MXP_ACTION_UNDERLINE: pStyle->iFlags |= UNDERLINE; break; case MXP_ACTION_ITALIC: pStyle->iFlags |= BLINK; break; case MXP_ACTION_COLOR: { pStyle->iForeColour = colour1; pStyle->iBackColour = colour2; // convert to RGB colour to start with in case only FORE or BACK supplied pStyle->iFlags &= ~COLOURTYPE; // clear bits, eg. custom pStyle->iFlags |= COLOUR_RGB; // foreground colour strArgument = GetArgument (ArgumentList, "fore", 1, true); // get foreground colour if (!m_bIgnoreMXPcolourChanges) if (SetColour (strArgument, pStyle->iForeColour)) MXP_error (DBG_ERROR, errMXP_UnknownColour, TFormat ("Unknown colour: \"%s\"" , (LPCTSTR) strArgument)); // background colour strArgument = GetArgument (ArgumentList, "back", 2, true); // get background colour if (!m_bIgnoreMXPcolourChanges) if (SetColour (strArgument, pStyle->iBackColour)) MXP_error (DBG_ERROR, errMXP_UnknownColour, TFormat ("Unknown colour: \"%s\"" , (LPCTSTR) strArgument)); } break; // end of COLOR case MXP_ACTION_HIGH: { CColor clr; pStyle->iForeColour = colour1; pStyle->iBackColour = colour2; // convert to RGB colour to start with pStyle->iFlags &= ~COLOURTYPE; // clear bits, eg. custom pStyle->iFlags |= COLOUR_RGB; clr.SetColor (colour1); float lum = clr.GetLuminance (); lum += 0.15f; if (lum > 1.0f) lum = 1.0f; clr.SetLuminance (lum); pStyle->iForeColour = clr; } break; // end of COLOR case MXP_ACTION_SEND: // send to mud hyperlink pStyle->iFlags &= ~ACTIONTYPE; // cancel old actions if (GetKeyword (ArgumentList, "prompt")) pStyle->iFlags |= ACTION_PROMPT; // prompt action else pStyle->iFlags |= ACTION_SEND; // send-to action if (m_bUnderlineHyperlinks) pStyle->iFlags |= UNDERLINE; // underline it if (m_bUseCustomLinkColour) { // find current background RGB value pStyle->iForeColour = m_iHyperlinkColour; // use hyperlink colour pStyle->iBackColour = colour2; pStyle->iFlags &= ~COLOURTYPE; // clear bits, eg. custom pStyle->iFlags |= COLOUR_RGB; } strArgument = GetArgument (ArgumentList,"href", 1, false); // get link if (strArgument.IsEmpty ()) strArgument = GetArgument (ArgumentList,"xch_cmd", 1, false); // get link strAction = strArgument; // hyperlink strArgument = GetArgument (ArgumentList, "hint", 2, false); // get hints if (strArgument.IsEmpty ()) strArgument = GetArgument (ArgumentList,"xch_hint", 2, false); // get hint strHint = strArgument; // hints break; // end of MXP_ACTION_SEND case MXP_ACTION_HYPERLINK: // hyperlink strArgument = GetArgument (ArgumentList,"href", 1, false); // get link strAction = strArgument; // hyperlink pStyle->iFlags &= ~ACTIONTYPE; // cancel old actions pStyle->iFlags |= ACTION_HYPERLINK | UNDERLINE; // send-to action if (m_bUseCustomLinkColour) { pStyle->iForeColour = m_iHyperlinkColour; // use hyperlink colour pStyle->iBackColour = colour2; pStyle->iFlags &= ~COLOURTYPE; // clear bits, eg. custom pStyle->iFlags |= COLOUR_RGB; } break; // end of MXP_ACTION_HYPERLINK case MXP_ACTION_FONT: { pStyle->iForeColour = colour1; pStyle->iBackColour = colour2; // convert to RGB colour to start with in case only FORE or BACK supplied pStyle->iFlags &= ~COLOURTYPE; // clear bits, eg. custom pStyle->iFlags |= COLOUR_RGB; // eg. <FONT COLOR=Red,Blink> CStringList list; strArgument = GetArgument (ArgumentList,"color", 1, true); // get color etc. if (strArgument.IsEmpty () && PUEBLO_ACTIVE) strArgument = GetArgument (ArgumentList,"fgcolor", 1, true); // get color StringToList (strArgument, ",", list); // break into components for (POSITION pos = list.GetHeadPosition (); pos; ) { CString strItem = list.GetNext (pos); // get action item if (strItem == "blink") pStyle->iFlags |= BLINK; else if (strItem == "italic") pStyle->iFlags |= BLINK; else if (strItem == "underline") pStyle->iFlags |= UNDERLINE; else if (strItem == "bold") pStyle->iFlags |= HILITE; else if (strItem == "inverse") pStyle->iFlags |= INVERSE; else { // must be colour name, yes? // foreground colour if (!m_bIgnoreMXPcolourChanges) if (SetColour (strItem, pStyle->iForeColour)) MXP_error (DBG_ERROR, errMXP_UnknownColour, TFormat ("Unknown colour: \"%s\"" , (LPCTSTR) strItem)); } // end of colour } // end of handling each item in the list strArgument = GetArgument (ArgumentList,"back", 2, true); // get back color if (strArgument.IsEmpty () && PUEBLO_ACTIVE) strArgument = GetArgument (ArgumentList,"bgcolor", 2, true); // get back color // background colour if (!m_bIgnoreMXPcolourChanges) if (SetColour (strArgument, pStyle->iBackColour)) MXP_error (DBG_ERROR, errMXP_UnknownColour, TFormat ("Unknown colour: \"%s\"" , (LPCTSTR) strArgument)); // get font size argument to avoid warnings about unused arguments strArgument = GetArgument (ArgumentList,"size", 0, true); // get font size } break; // end of FONT case MXP_ACTION_VERSION: { CString strVersion = CFormat ("\x1B[1z<VERSION MXP=\"%s\" CLIENT=MUSHclient " "VERSION=\"%s\" REGISTERED=YES>%s", MXP_VERSION, MUSHCLIENT_VERSION, ENDLINE ); SendPacket (strVersion, strVersion.GetLength ()); // send version info back MXP_error (DBG_INFO, infoMXP_VersionSent, TFormat ("Sent version response: %s" , (LPCTSTR) strVersion.Mid (4))); } break; // end of VERSION case MXP_ACTION_AFK: if (m_bSendMXP_AFK_Response) // if player wants us to { strArgument = GetArgument (ArgumentList,"challenge", 1, false); // get challenge // find time since last player input CTimeSpan ts = CTime::GetCurrentTime() - m_tLastPlayerInput; CString strAFK = CFormat ("\x1B[1z<AFK %ld %s>%s", ts.GetTotalSeconds (), (LPCTSTR) strArgument, ENDLINE ); SendPacket (strAFK, strAFK.GetLength ()); // send AFK info back MXP_error (DBG_INFO, infoMXP_AFKSent, TFormat ("Sent AFK response: %s" , (LPCTSTR) strAFK.Mid (4))); } // end of AFK break; case MXP_ACTION_SUPPORT: { CString strSupports; CAtomicElement * pElement; CStringList list; CString strName; if (ArgumentList.IsEmpty ()) { for (POSITION pos = App.m_ElementMap.GetStartPosition(); pos; ) { App.m_ElementMap.GetNextAssoc (pos, strName, pElement); if ((pElement->iFlags & TAG_NOT_IMP) == 0) { strSupports += "+"; strSupports += pElement->strName; strSupports += " "; // now list the sub-items it supports StringToList (pElement->strArgs, ",", list); // break into components for (POSITION argpos = list.GetHeadPosition (); argpos; ) { CString strItem = list.GetNext (argpos); // get argument item strSupports += "+"; strSupports += pElement->strName; strSupports += "."; strSupports += strItem; strSupports += " "; } // end of doing each sub-item } // end of being implemented } // end of looping through all atomic elements } // end of wanting complete list else { for (POSITION pos = ArgumentList.GetHeadPosition (); pos; ) { CArgument * pArgument = ArgumentList.GetNext (pos); CStringList questionlist; StringToList (pArgument->strValue, ".", questionlist); // break into components // should be one or two words, eg. send.prompt or color if (questionlist.GetCount () > 2) { MXP_error (DBG_ERROR, errMXP_InvalidSupportArgument, TFormat ("Invalid <support> argument: %s" , (LPCTSTR) pArgument->strValue)); return; } CString strTag = questionlist.RemoveHead (); strTag.MakeLower (); // check valid name requested if (!IsValidName (strTag)) { MXP_error (DBG_ERROR, errMXP_InvalidSupportArgument, TFormat ("Invalid <support> argument: %s" , (LPCTSTR) strTag)); return; } // look up main element name if (!App.m_ElementMap.Lookup (strTag, pElement) || (pElement->iFlags & TAG_NOT_IMP) != 0) { // not supported strSupports += "-"; strSupports += strTag; strSupports += " "; continue; // all done for this argument } // only one word - they aren't looking for a suboption if (questionlist.IsEmpty ()) { // supported strSupports += "+"; strSupports += strTag; strSupports += " "; continue; // all done for this argument } CString strSubtag = questionlist.RemoveHead (); strSubtag.MakeLower (); if (strSubtag == "*") { // they want list of options for this tag // now list the sub-items it supports StringToList (pElement->strArgs, ",", list); // break into components for (POSITION argpos = list.GetHeadPosition (); argpos; ) { CString strItem = list.GetNext (argpos); // get argument item strSupports += "+"; strSupports += pElement->strName; strSupports += "."; strSupports += strItem; strSupports += " "; } // end of doing each sub-item } // end of wildcard else { // not wildcard - must be name // check valid name requested if (!IsValidName (strSubtag)) { MXP_error (DBG_ERROR, errMXP_InvalidSupportArgument, TFormat ("Invalid <support> argument: %s" , (LPCTSTR) strSubtag)); return; } // so, see if that word is in our arguments list StringToList (pElement->strArgs, ",", list); // break into components if (list.Find (strSubtag)) { strSupports += "+"; strSupports += pArgument->strValue; strSupports += " "; } else { strSupports += "-"; strSupports += pArgument->strValue; strSupports += " "; } } // end of not looking for wildcard } // end of doing each argument } // find individual items CString strMessage = CFormat ("\x1B[1z<SUPPORTS %s>%s", (LPCTSTR) strSupports, ENDLINE); SendPacket (strMessage, strMessage.GetLength ()); // send version info back MXP_error (DBG_INFO, infoMXP_SupportsSent, TFormat ("Sent supports response: %s" , (LPCTSTR) strMessage.Mid (4))); } bIgnoreUnusedArgs = true; break; // end of MXP_ACTION_SUPPORT case MXP_ACTION_OPTION: { CString strOptions; CStringList list; CString strName; if (ArgumentList.IsEmpty ()) { for (long i = 0; OptionsTable [i].pName; i++) { char * pName = OptionsTable [i].pName; strOptions += CFormat ("%s=%ld ", pName, (LPCTSTR) GetOptionItem (i)); } } // end of wanting complete list else { for (POSITION pos = ArgumentList.GetHeadPosition (); pos; ) { CArgument * pArgument = ArgumentList.GetNext (pos); strOptions += CFormat ("%s=%ld", (LPCTSTR) pArgument->strValue, (LPCTSTR) GetOption (pArgument->strValue)); } // end of doing each argument } // find individual items CString strMessage = CFormat ("\x1B[1z<OPTIONS %s>%s", (LPCTSTR) strOptions, ENDLINE); SendPacket (strMessage, strMessage.GetLength ()); // send version info back MXP_error (DBG_INFO, infoMXP_OptionsSent, TFormat ("Sent options response: %s" , (LPCTSTR) strMessage.Mid (4))); } bIgnoreUnusedArgs = true; break; // end of MXP_ACTION_OPTION case MXP_ACTION_RECOMMEND_OPTION: if (m_bMudCanChangeOptions) { CString strOptions; CStringList list; CString strName; for (POSITION pos = ArgumentList.GetHeadPosition (); pos; ) { CArgument * pArgument = ArgumentList.GetNext (pos); int iItem; int iResult = FindBaseOption (pArgument->strName, OptionsTable, iItem); if (iResult != eOK) MXP_error (DBG_ERROR, errMXP_InvalidOptionArgument, TFormat ("Option named '%s' not known.", (LPCTSTR) pArgument->strName)); else if (!(OptionsTable [iItem].iFlags & OPT_SERVER_CAN_WRITE)) MXP_error (DBG_ERROR, errMXP_CannotChangeOption, TFormat ("Option named '%s' cannot be changed.", (LPCTSTR) pArgument->strName)); else { iResult = SetOptionItem (iItem, atol (pArgument->strValue), true, false); if (iResult == eOK) MXP_error (DBG_INFO, infoMXP_OptionChanged, TFormat ("Option named '%s' changed to '%s'.", (LPCTSTR) pArgument->strName, (LPCTSTR) pArgument->strValue)); else MXP_error (DBG_ERROR, errMXP_OptionOutOfRange, TFormat ("Option named '%s' could not be changed to '%s' (out of range).", (LPCTSTR) pArgument->strName, (LPCTSTR) pArgument->strValue)); } } // end of doing each argument } bIgnoreUnusedArgs = true; break; // end of MXP_ACTION_RECOMMEND_OPTION case MXP_ACTION_USER: if (!m_name.IsEmpty () && m_connect_now == eConnectMXP) { CString strPacket = m_name + ENDLINE; SendPacket (strPacket, strPacket.GetLength ()); // send name to MUD MXP_error (DBG_INFO, infoMXP_CharacterNameSent, TFormat ("Sent character name: %s" , (LPCTSTR) m_name)); } else if (m_connect_now != eConnectMXP) MXP_error (DBG_WARNING, wrnMXP_CharacterNameRequestedButNotDefined, Translate ("Character name requested but auto-connect not set to MXP.")); else MXP_error (DBG_WARNING, wrnMXP_CharacterNameRequestedButNotDefined, Translate ("Character name requested but none defined.")); break; // end of USER case MXP_ACTION_PASSWORD: if (m_nTotalLinesSent > 10) // security check MXP_error (DBG_WARNING, wrnMXP_PasswordNotSent, "Too many lines sent to MUD - password not sent."); else if (!m_password.IsEmpty () && m_connect_now == eConnectMXP) { CString strPacket = m_password + ENDLINE; SendPacket (strPacket, strPacket.GetLength ()); // send password to MUD MXP_error (DBG_INFO, infoMXP_PasswordSent, "Sent password to world."); } else if (m_connect_now != eConnectMXP) MXP_error (DBG_WARNING, wrnMXP_PasswordRequestedButNotDefined, "Password requested but auto-connect not set to MXP."); else MXP_error (DBG_WARNING, wrnMXP_PasswordRequestedButNotDefined, "Password requested but none defined."); break; // end of PASSWORD // new para case MXP_ACTION_P: // experimental m_cLastChar = 0; m_bInParagraph = true; break; // end of MXP_ACTION_P // new line case MXP_ACTION_BR: bIgnoreUnusedArgs = true; // don't worry about args for now :) StartNewLine (true, 0); SetNewLineColour (0); break; // end of MXP_ACTION_BR // reset case MXP_ACTION_RESET: MXP_Off (); break; // end of MXP_ACTION_RESET // MXP options (MXP OFF, MXP DEFAULT_OPEN, MXP DEFAULT_SECURE etc. case MXP_ACTION_MXP: if (GetKeyword (ArgumentList, "off")) MXP_Off (true); /* if (GetKeyword (ArgumentList, "default_open")) { MXP_error (DBG_INFO, "MXP default mode now OPEN."); m_iMXP_defaultMode = eMXP_open; } // end of DEFAULT_OPEN if (GetKeyword (ArgumentList, "default_secure")) { MXP_error (DBG_INFO, "MXP default mode now SECURE."); m_iMXP_defaultMode = eMXP_secure; } // end of DEFAULT_SECURE if (GetKeyword (ArgumentList, "default_locked")) { MXP_error (DBG_INFO, "MXP default mode now LOCKED."); m_iMXP_defaultMode = eMXP_locked; } // end of DEFAULT_LOCKED if (GetKeyword (ArgumentList, "use_newlines")) { MXP_error (DBG_INFO, "Now interpreting newlines as normal."); m_bInParagraph = false; } // end of USE_NEWLINES if (GetKeyword (ArgumentList, "ignore_newlines")) { MXP_error (DBG_INFO, "Now ignoring newlines."); m_bInParagraph = true; } // end of IGNORE_NEWLINES */ break; // end of MXP_ACTION_MXP case MXP_ACTION_SCRIPT: MXP_error (DBG_INFO, infoMXP_ScriptCollectionStarted, "Script collection mode entered (discarding script)."); m_bMXP_script = true; break; // end of MXP_ACTION_SCRIPT case MXP_ACTION_HR: { // wrap up previous line if necessary if (m_pCurrentLine->len > 0) StartNewLine (true, 0); /* CString strLine; char * p = strLine.GetBuffer (m_nWrapColumn); memset (p, 175, m_nWrapColumn); strLine.ReleaseBuffer (m_nWrapColumn); AddToLine (strLine, 0); */ // mark line as HR line m_pCurrentLine->flags = HORIZ_RULE; StartNewLine (true, 0); // now finish this line } break; // end of MXP_ACTION_HR case MXP_ACTION_PRE: m_bPreMode = true; break; // end of MXP_ACTION_PRE case MXP_ACTION_UL: m_iListMode = eUnorderedList; m_iListCount = 0; break; // end of MXP_ACTION_UL case MXP_ACTION_OL: m_iListMode = eOrderedList; m_iListCount = 0; break; // end of MXP_ACTION_OL case MXP_ACTION_LI: { // wrap up previous line if necessary if (m_pCurrentLine->len > 0) StartNewLine (true, 0); CString strListItem = " * "; if (m_iListMode == eOrderedList) strListItem.Format (" %i. ", ++m_iListCount); AddToLine (strListItem, 0); } break; // end of MXP_ACTION_LI // pueblo tags we put here so we don't get warnings case MXP_ACTION_BODY : bIgnoreUnusedArgs = true; break; // just ignore it case MXP_ACTION_HEAD : bIgnoreUnusedArgs = true; break; // just ignore it case MXP_ACTION_HTML : bIgnoreUnusedArgs = true; break; // just ignore it case MXP_ACTION_TITLE: bIgnoreUnusedArgs = true; break; // just ignore it case MXP_ACTION_SAMP : bIgnoreUnusedArgs = true; break; // just ignore it case MXP_ACTION_CENTER : bIgnoreUnusedArgs = true; break; // just ignore it case MXP_ACTION_XCH_PANE : bIgnoreUnusedArgs = true; break; // just ignore it case MXP_ACTION_IMG : case MXP_ACTION_IMAGE: { GetKeyword (ArgumentList, "ismap"); // make sure we realise it is a keyword // detect newline treatment strArgument = GetArgument (ArgumentList,"xch_mode", 0, false); // get mode if (!strArgument.IsEmpty ()) { m_bPuebloActive = true; // for correct newline processing if (strArgument.CompareNoCase ("purehtml") == 0) m_bSuppressNewline = true; else if (strArgument.CompareNoCase ("html") == 0) m_bSuppressNewline = false; } // end of some sort of Pueblo strArgument = GetArgument (ArgumentList,"url", 0, false); // get link if (strArgument.IsEmpty () && PUEBLO_ACTIVE) strArgument = GetArgument (ArgumentList,"src", 0, false); // get link CString strFilename = GetArgument (ArgumentList,"fname", 0, false); // and file name if (!strArgument.IsEmpty ()) { CString strOldAction = strAction; int iFlags = pStyle->iFlags; COLORREF iForeColour = pStyle->iForeColour; COLORREF iBackColour = pStyle->iBackColour; // ensure on new line if (m_pCurrentLine->len > 0) StartNewLine (true, 0); // starting a new line may have deleted pStyle pStyle = m_pCurrentLine->styleList.GetTail (); if (m_bUseCustomLinkColour) { pStyle->iForeColour = m_iHyperlinkColour; // use hyperlink colour pStyle->iBackColour = colour2; pStyle->iFlags &= ~COLOURTYPE; // clear bits, eg. custom pStyle->iFlags |= COLOUR_RGB; } strArgument += strFilename; // append filename to URL strAction = strArgument; // hyperlink pStyle->iFlags &= ~ACTIONTYPE; // cancel old actions pStyle->iFlags |= ACTION_HYPERLINK; // send-to action if (m_bUnderlineHyperlinks) pStyle->iFlags |= UNDERLINE; // send-to action AddToLine ("[", 0); AddToLine (strArgument, 0); AddToLine ("]", 0); // have to add the action now, before we start a new line pStyle->pAction = GetAction (strAction, strHint, strVariable); strAction.Empty (); StartNewLine (true, 0); // new line after image tag // go back to old style (ie. lose the underlining) AddStyle (iFlags, iForeColour, iBackColour, 0, strOldAction); } } break; // end of MXP_ACTION_IMG case MXP_ACTION_XCH_PAGE: bIgnoreUnusedArgs = true; m_bPuebloActive = true; // for correct newline processing MXP_Off (); // same as <reset>? break; // end of MXP_ACTION_XCH_PAGE case MXP_ACTION_VAR: // set variable strVariable = GetArgument (ArgumentList,"", 1, false); // get name // case insensitive strVariable.MakeLower (); if (!IsValidName (strVariable)) { MXP_error (DBG_ERROR, errMXP_InvalidDefinition, TFormat ("Invalid MXP entity name: <!%s>", (LPCTSTR) strVariable)); strVariable.Empty (); return; } { // protect local variable CString strEntityContents; if (App.m_EntityMap.Lookup (strVariable, strEntityContents)) { MXP_error (DBG_ERROR, errMXP_CannotRedefineEntity, TFormat ("Cannot redefine entity: &%s;", (LPCTSTR) strVariable)); strVariable.Empty (); return; } } break; // end of MXP_ACTION_VAR default: { // warn them it is not implemented MXP_error (DBG_WARNING, wrnMXP_TagNotImplemented, TFormat ("MXP tag <%s> is not implemented" , (LPCTSTR) strTag)); } // end of default } // end of switch on iAction if (!bIgnoreUnusedArgs) CheckArgumentsUsed (strTag, ArgumentList); } // end of CMUSHclientDoc::MXP_OpenAtomicTag
void Console::SetColour() { CoreAssert(this != NULL); SetColour(0); }
void NewsScreenInterface::DrawDetails ( Button *button, bool highlighted, bool clicked ) { UplinkAssert (button); int screenheight = app->GetOptions ()->GetOptionValue ( "graphics_screenheight" ); glScissor ( button->x, screenheight - (button->y + button->height), button->width, button->height ); glEnable ( GL_SCISSOR_TEST ); // Get the offset char name_base [128]; sscanf ( button->name, "%s", name_base ); ScrollBox *scrollBox = ScrollBox::GetScrollBox( name_base ); if ( !scrollBox ) return; int offset = scrollBox->currentIndex; // Draw the button glBegin ( GL_QUADS ); SetColour ( "PanelBackgroundA" ); glVertex2i ( button->x, button->y + button->height ); SetColour ( "PanelBackgroundB" ); glVertex2i ( button->x, button->y ); SetColour ( "PanelBackgroundA" ); glVertex2i ( button->x + button->width, button->y ); SetColour ( "PanelBackgroundB" ); glVertex2i ( button->x + button->width, button->y + button->height ); glEnd (); SetColour ( "PanelBorder" ); border_draw ( button ); // Draw the text int maxnumlines = (button->height - 10 ) / 15; SetColour ( "DefaultText" ); LList <char *> *wrappedtext = wordwraptext ( button->caption, button->width ); if ( wrappedtext ) { for ( int i = offset; i < wrappedtext->Size (); ++i ) { if ( i > maxnumlines + offset ) break; int xpos = button->x + 10; int ypos = button->y + 10 + (i-offset) * 15; GciDrawText ( xpos, ypos, wrappedtext->GetData (i), HELVETICA_10 ); } //DeleteLListData ( wrappedtext ); // Only delete first entry - since there is only one string really if ( wrappedtext->ValidIndex (0) && wrappedtext->GetData (0) ) delete [] wrappedtext->GetData (0); delete wrappedtext; } glDisable ( GL_SCISSOR_TEST ); }
void wxGenericBrush::SetColour( const wxColour &colour ) { SetColour(wxGenericColour(colour)); }
void pawsButton::Draw() { pawsWidget::Draw(); int drawAlpha = -1; if (parent && parent->GetMaxAlpha() >= 0) { fadeVal = parent->GetFadeVal(); alpha = parent->GetMaxAlpha(); alphaMin = parent->GetMinAlpha(); drawAlpha = (int)(alphaMin + (alpha-alphaMin) * fadeVal * 0.010); } if ( down ) { if (!enabled && greyDownImage) greyDownImage->Draw(screenFrame, drawAlpha); else if (pressedImage) pressedImage->Draw(screenFrame, drawAlpha); } else if ( flash==0 ) { if (!enabled && greyUpImage) greyUpImage->Draw(screenFrame, drawAlpha); else if (releasedImage) releasedImage->Draw(screenFrame, drawAlpha); } else // Flash the button if it's not depressed. { if (flashtype == FLASH_HIGHLIGHT) { SetColour(graphics2D->FindRGB(255,0,0)); if (releasedImage) releasedImage->Draw(screenFrame, drawAlpha); } else { if (flash <= 10 ) { flash++; switch (flashtype) { case FLASH_REGULAR: if ( pressedImage ) pressedImage->Draw( screenFrame ); break; case FLASH_SPECIAL: if ( specialFlashImage ) specialFlashImage->Draw( screenFrame ); break; default: // Unexpected flash Error1("Unknown flash type!"); } } else { if (flash == 30) flash = 1; else flash++; if ( releasedImage ) releasedImage->Draw( screenFrame, drawAlpha ); } } } if (!(buttonLabel.IsEmpty())) { int drawX=0; int drawY=0; int width=0; int height=0; GetFont()->GetDimensions( buttonLabel , width, height ); int midX = screenFrame.Width() / 2; int midY = screenFrame.Height() / 2; drawX = screenFrame.xmin + midX - width/2; drawY = screenFrame.ymin + midY - height/2; drawY -= 2; // correction if (down) DrawWidgetText(buttonLabel, drawX + downTextOffsetX, drawY + downTextOffsetY); else DrawWidgetText(buttonLabel, drawX + upTextOffsetX, drawY + upTextOffsetY); } }
void wxRibbonMetroArtProvider::SetColourScheme( const wxColour& primary, const wxColour& secondary, const wxColour& tertiary) { m_primary_scheme_colour = primary; m_secondary_scheme_colour = secondary; m_tertiary_scheme_colour = tertiary; wxRibbonHSLColour primary_hsl(primary); wxRibbonHSLColour secondary_hsl(secondary); // tertiary not used for anything // Map primary saturation from [0, 1] to [.25, .75] bool primary_is_gray = false; static const double gray_saturation_threshold = 0.01; if(primary_hsl.saturation <= gray_saturation_threshold) primary_is_gray = true; else { primary_hsl.saturation = cos(primary_hsl.saturation * M_PI) * -0.25 + 0.5; } // Map primary luminance from [0, 1] to [.23, .83] primary_hsl.luminance = cos(primary_hsl.luminance * M_PI) * -0.3 + 0.53; // Map secondary saturation from [0, 1] to [0.16, 0.84] bool secondary_is_gray = false; if(secondary_hsl.saturation <= gray_saturation_threshold) secondary_is_gray = true; else { secondary_hsl.saturation = cos(secondary_hsl.saturation * M_PI) * -0.34 + 0.5; } // Map secondary luminance from [0, 1] to [0.1, 0.9] secondary_hsl.luminance = cos(secondary_hsl.luminance * M_PI) * -0.4 + 0.5; #define LikePrimary(h, s, l) \ primary_hsl.ShiftHue(h ## f).Saturated(primary_is_gray ? 0 : s ## f) \ .Lighter(l ## f).ToRGB() #define LikeSecondary(h, s, l) \ secondary_hsl.ShiftHue(h ## f).Saturated(secondary_is_gray ? 0 : s ## f) \ .Lighter(l ## f).ToRGB() m_page_border_pen = wxColour(218,219,220); // LikePrimary(1.4, 0.00, -0.2); // LikePrimary(1.4, 0.00, -0.08); // these are all needed for galleries (which are drawn using base class methods) m_page_background_top_colour = wxColour(245,246,247); // wxColour(254,254,254); // m_page_background_top_gradient_colour = wxColour(245,246,247); // wxColour(242,244,246); m_page_background_colour = wxColour(245,246,247); m_page_background_gradient_colour = wxColour(245,246,247); // wxColour(229,233,238); m_tab_active_background_colour = wxColour(245,246,247); // LikePrimary(1.0, 1.0, 0.94); m_tab_active_background_gradient_colour = *wxBLUE; // wxColour(250,250,250); // LikePrimary(1.0, 1.0, 0.94); m_tab_separator_colour = wxColour (245,246,247); // LikePrimary(0.9, 0.24, 0.05); m_tab_ctrl_background_brush = wxColour(254,254,254); // LikePrimary(1.0, 0.39, 0.07); m_tab_hover_background_colour = wxColour(253,253,253); // LikePrimary(1.3, 0.15, 0.10); m_tab_hover_background_top_colour = *wxBLUE; // wxColour(254,254,254); // LikePrimary(1.4, 0.36, 0.08); m_tab_border_pen = wxColour(218,219,220); // LikePrimary(1.4, 0.03, -0.05); m_tab_separator_gradient_colour = LikePrimary(1.7, -0.15, -0.18); m_tab_hover_background_top_gradient_colour = *wxBLUE; // wxColour(254,254,254); // LikePrimary(1.8, 0.34, 0.13); m_tab_label_colour = LikePrimary(4.3, 0.13, -0.49); m_tab_hover_background_gradient_colour = *wxBLUE; // LikeSecondary(-1.5, -0.34, 0.01); m_panel_minimised_border_gradient_pen = wxColour(232,239,247); // LikePrimary(-6.9, -0.17, -0.09); m_panel_minimised_border_pen = wxColour(164, 206, 249); // LikePrimary(-5.3, -0.24, -0.06); m_panel_border_gradient_pen = *wxBLUE; // LikePrimary(-5.2, -0.15, -0.06); m_panel_border_pen = wxColour(226,227,228); // LikePrimary(-2.8, -0.32, 0.02); m_panel_hover_label_background_brush = *wxBLUE; // LikePrimary(1.0, 0.30, 0.09); m_panel_active_background_colour = LikePrimary(1.6, -0.18, 0.18); m_panel_active_background_gradient_colour = LikePrimary(0.5, 0.34, 0.05); m_panel_label_colour = LikePrimary(2.8, -0.14, -0.45); // LikePrimary(2.8, -0.14, -0.35); m_panel_minimised_label_colour = m_tab_label_colour; m_panel_hover_button_background_brush = wxColour(232,239,247); //LikeSecondary(-0.9, 0.16, -0.07); m_panel_hover_button_border_pen = wxColour(164, 206, 249); // LikeSecondary(-3.9, -0.16, -0.14); SetColour(wxRIBBON_ART_PANEL_BUTTON_FACE_COLOUR, LikePrimary(1.4, -0.21, -0.23)); SetColour(wxRIBBON_ART_PANEL_BUTTON_HOVER_FACE_COLOUR, LikePrimary(1.5, -0.24, -0.29)); m_button_bar_label_colour = LikePrimary(2.8, -0.14, -0.6); // m_tab_label_colour; m_button_bar_hover_border_pen = wxColour(164, 206, 249); // LikeSecondary(-6.2, 0.47, -0.1); // LikeSecondary(-6.2, -0.47, -0.14); m_button_bar_hover_background_gradient_colour = wxColour(232,239,247); // LikeSecondary(-0.6, 0.16, 0.2); // LikeSecondary(-0.6, 0.16, 0.04); m_button_bar_hover_background_colour = wxColour(232,239,247); // LikeSecondary(-0.2, 0.16, -0.01); // LikeSecondary(-0.2, 0.16, -0.10); m_button_bar_hover_background_top_gradient_colour = wxColour(232,239,247); // LikeSecondary(0.2, 0.16, 0.03); // LikeSecondary(0.2, 0.16, 0.03); // m_button_bar_hover_background_top_colour = *wxRED; // LikeSecondary(8.8, 0.16, 0.17); // LikeSecondary(8.8, 0.16, 0.17); m_button_bar_active_border_pen = wxColour(102,167,232); // LikeSecondary(-6.2, -0.47, -0.25); m_button_bar_active_background_top_colour = *wxYELLOW; // LikeSecondary(-8.4, 0.08, 0.06); m_button_bar_active_background_top_gradient_colour = *wxYELLOW; // LikeSecondary(-9.7, 0.13, -0.07); m_button_bar_active_background_colour = wxColour(209,232,255); // LikeSecondary(-9.9, 0.14, -0.14); m_button_bar_active_background_gradient_colour = *wxYELLOW; // LikeSecondary(-8.7, 0.17, -0.03); m_gallery_button_disabled_background_colour = LikePrimary(-2.8, -0.46, 0.09); m_gallery_button_disabled_background_top_brush = LikePrimary(-2.8, -0.36, 0.15); m_gallery_hover_background_brush = LikePrimary(-0.8, 0.05, 0.15); m_gallery_border_pen = LikePrimary(0.7, -0.02, 0.03); m_gallery_button_background_top_brush = LikePrimary(0.8, 0.34, 0.13); m_gallery_button_background_colour = LikePrimary(1.3, 0.10, 0.08); // SetColour used so that the relevant bitmaps are generated SetColour(wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR, LikePrimary(1.4, -0.21, -0.23)); SetColour(wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR, LikePrimary(1.5, -0.24, -0.29)); SetColour(wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR, LikePrimary(1.5, -0.24, -0.29)); SetColour(wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR, LikePrimary(0.0, -1.0, 0.0)); m_gallery_button_disabled_background_gradient_colour = LikePrimary(1.5, -0.43, 0.12); m_gallery_button_background_gradient_colour = LikePrimary(1.7, 0.11, 0.09); m_gallery_item_border_pen = LikeSecondary(-3.9, -0.16, -0.14); m_gallery_button_hover_background_colour = m_button_bar_hover_background_colour; // LikeSecondary(-0.9, 0.16, -0.07); m_gallery_button_hover_background_gradient_colour = m_button_bar_hover_background_gradient_colour; // LikeSecondary(0.1, 0.12, 0.03); m_gallery_button_hover_background_top_brush = m_button_bar_hover_background_top_gradient_colour; // LikeSecondary(4.3, 0.16, 0.17); m_gallery_button_active_background_colour = LikeSecondary(-9.9, 0.03, -0.22); m_gallery_button_active_background_gradient_colour = LikeSecondary(-9.5, 0.14, -0.11); m_gallery_button_active_background_top_brush = LikeSecondary(-9.0, 0.15, -0.08); m_toolbar_border_pen = m_button_bar_hover_border_pen; // LikePrimary(1.4, -0.21, -0.16); SetColour(wxRIBBON_ART_TOOLBAR_FACE_COLOUR, LikePrimary(1.4, -0.17, -0.22)); m_tool_background_top_colour = LikePrimary(-1.9, -0.07, 0.06); m_tool_background_top_gradient_colour = LikePrimary(1.4, 0.12, 0.08); m_tool_background_colour = wxColour(232,239,247); // LikePrimary(1.4, -0.09, 0.03); m_tool_background_gradient_colour = *wxRED; // LikePrimary(1.9, 0.11, 0.09); m_tool_hover_background_top_colour = m_button_bar_hover_background_top_colour; // LikeSecondary(3.4, 0.11, 0.16); m_tool_hover_background_top_gradient_colour = m_button_bar_hover_background_top_gradient_colour; // LikeSecondary(-1.4, 0.04, 0.08); m_tool_hover_background_colour = m_button_bar_hover_background_colour; // LikeSecondary(-1.8, 0.16, -0.12); m_tool_hover_background_gradient_colour = m_button_bar_hover_background_gradient_colour; // LikeSecondary(-2.6, 0.16, 0.05); m_tool_active_background_top_colour = LikeSecondary(-9.9, -0.12, -0.09); m_tool_active_background_top_gradient_colour = LikeSecondary(-8.5, 0.16, -0.12); m_tool_active_background_colour = LikeSecondary(-7.9, 0.16, -0.20); m_tool_active_background_gradient_colour = LikeSecondary(-6.6, 0.16, -0.10); #undef LikePrimary #undef LikeSecondary // Invalidate cached tab separator m_cached_tab_separator_visibility = -1.0; }
void BBSScreenInterface::DrawBBSButton ( Button *button, bool highlighted, bool clicked ) { int index; sscanf ( button->name, "BBmessage %d", &index ); index += baseoffset; int screenheight = app->GetOptions ()->GetOptionValue ( "graphics_screenheight" ); glScissor ( button->x, screenheight - (button->y + button->height), button->width, button->height ); glEnable ( GL_SCISSOR_TEST ); clear_draw ( button->x, button->y, button->width, button->height ); // Get the text from mission number (index + baseoffset) CompanyUplink *cu = (CompanyUplink *) game->GetWorld ()->GetCompany ( "Uplink" ); UplinkAssert ( cu ); Mission *mission = cu->GetMission ( index ); if ( mission ) { if ( index == currentselect ) { glBegin ( GL_QUADS ); SetColour ( "PanelHighlightA" ); glVertex2i ( button->x, button->y ); SetColour ( "PanelHighlightB" ); glVertex2i ( button->x + button->width, button->y ); SetColour ( "PanelHighlightA" ); glVertex2i ( button->x + button->width, button->y + button->height ); SetColour ( "PanelHighlightB" ); glVertex2i ( button->x, button->y + button->height ); glEnd (); } if ( highlighted ) { SetColour ( "PanelHighlightBorder" ); border_draw ( button ); } char date [64], subject [256]; bool encrypted = ( game->GetWorld ()->GetPlayer ()->rating.uplinkrating < mission->minuplinkrating ); if ( !encrypted ) { float ratingdif = (float)(game->GetWorld ()->GetPlayer ()->rating.uplinkrating - mission->minuplinkrating); if ( ratingdif > 5.0f ) ratingdif = 5.0f; UplinkStrncpy ( subject, mission->description, sizeof ( subject ) ); UplinkStrncpy ( date, mission->createdate.GetShortString (), sizeof ( date ) ); #ifdef DEMOGAME glColor4f ( 1.0f - ratingdif * 0.2f, 1.0f - ratingdif * 0.2f, 1.0f - ratingdif * 0.2f, 1.0f ); #else glColor4f ( 1.0f - ratingdif * 0.1f, 1.0f - ratingdif * 0.1f, 1.0f - ratingdif * 0.1f, 1.0f ); #endif } else { UplinkStrncpy ( subject, "Encrypted (Insufficient Uplink Rating)", sizeof ( subject ) ); UplinkStrncpy ( date, "Unknown", sizeof ( date ) ); glColor4f ( 0.2f, 0.2f, 0.2f, 1.0f ); } GciDrawText ( button->x + 110, button->y + 10, subject ); GciDrawText ( button->x + 5, button->y + 10, date ); } glDisable ( GL_SCISSOR_TEST ); }
void Chunk::Setup() { ChunkStorageLoader* pChunkStorage = m_pChunkManager->GetChunkStorage(m_gridX, m_gridY, m_gridZ, false); for (int x = 0; x < CHUNK_SIZE; x++) { for (int z = 0; z < CHUNK_SIZE; z++) { float xPosition = m_position.x + x; float zPosition = m_position.z + z; float noise = octave_noise_2d(m_pVoxSettings->m_landscapeOctaves, m_pVoxSettings->m_landscapePersistence, m_pVoxSettings->m_landscapeScale, xPosition, zPosition); float noiseNormalized = ((noise + 1.0f) * 0.5f); float mountainNoise = octave_noise_2d(m_pVoxSettings->m_mountainOctaves, m_pVoxSettings->m_mountainPersistence, m_pVoxSettings->m_mountainScale, xPosition, zPosition); float mountainNoiseNormalise = (mountainNoise + 1.0f) * 0.5f; float mountainMultiplier = m_pVoxSettings->m_mountainMultiplier * mountainNoiseNormalise; float noiseHeight = noiseNormalized * CHUNK_SIZE; noiseHeight *= mountainMultiplier; if (m_gridY < 0) { noiseHeight = CHUNK_SIZE; } for (int y = 0; y < CHUNK_SIZE; y++) { float yPosition = m_position.y + y; if (pChunkStorage != NULL && pChunkStorage->m_blockSet[x][y][z] == true) { SetColour(x, y, z, pChunkStorage->m_colour[x][y][z]); } else { if (y + (m_gridY*CHUNK_SIZE) < noiseHeight) { float colorNoise = octave_noise_3d(4.0f, 0.3f, 0.005f, xPosition, yPosition, zPosition); float colorNoiseNormalized = ((colorNoise + 1.0f) * 0.5f); float red1 = 0.65f; float green1 = 0.80f; float blue1 = 0.00f; float red2 = 0.00f; float green2 = 0.46f; float blue2 = 0.16f; if (noise < -0.5f) { red1 = 0.10f; green1 = 0.25f; blue1 = 1.00f; red2 = 0.10f; green2 = 0.25f; blue2 = 1.00f; } else if (noise < -0.25f) { red1 = 0.94f; green1 = 0.74f; blue1 = 0.34f; red2 = 0.50f; green2 = 0.29f; blue2 = 0.20f; } else if (noise < 0.5f) { red1 = 0.65f; green1 = 0.80f; blue1 = 0.00f; red2 = 0.00f; green2 = 0.46f; blue2 = 0.16f; } else if (noise < 1.0f) { red1 = 0.85f; green1 = 0.85f; blue1 = 0.85f; red2 = 0.77f; green2 = 0.65f; blue2 = 0.80f; } float alpha = 1.0f; float r = red1 + ((red2 - red1) * colorNoiseNormalized); float g = green1 + ((green2 - green1) * colorNoiseNormalized); float b = blue1 + ((blue2 - blue1) * colorNoiseNormalized); SetColour(x, y, z, r, g, b, alpha); } } } // Tree generation if (m_gridY >= 0) // Only above ground { // Trees if ((GetRandomNumber(0, 1000) >= 1000)) { if (noiseNormalized >= 0.5f) { vec3 treePos = vec3(xPosition, noiseHeight, zPosition); m_pChunkManager->ImportQubicleBinary("media/gamedata/terrain/plains/smalltree.qb", treePos, QubicleImportDirection_Normal); } } // Scenery if ((GetRandomNumber(0, 1000) >= 995)) { if (noiseNormalized >= 0.5f) { vec3 pos = vec3(xPosition, noiseHeight, zPosition); //m_pSceneryManager->AddSceneryObject("flower", "media/gamedata/terrain/plains/flower1.qb", pos, vec3(0.0f, 0.0f, 0.0f), QubicleImportDirection_Normal, QubicleImportDirection_Normal, 0.08f, GetRandomNumber(0, 360, 2)); } } } } } // Remove the chunk storage loader since we no longer need it if (pChunkStorage != NULL) { m_pChunkManager->RemoveChunkStorageLoader(pChunkStorage); } m_setup = true; SetNeedsRebuild(true, true); }
void wxRibbonAUIArtProvider::SetColourScheme( const wxColour& primary, const wxColour& secondary, const wxColour& tertiary) { wxRibbonHSLColour primary_hsl(primary); wxRibbonHSLColour secondary_hsl(secondary); wxRibbonHSLColour tertiary_hsl(tertiary); // Map primary & secondary luminance from [0, 1] to [0.15, 0.85] primary_hsl.luminance = float(cos(primary_hsl.luminance * M_PI) * -0.35 + 0.5); secondary_hsl.luminance = float(cos(secondary_hsl.luminance * M_PI) * -0.35 + 0.5); // TODO: Remove next line once this provider stops piggybacking MSW wxRibbonMSWArtProvider::SetColourScheme(primary, secondary, tertiary); #define LikePrimary(luminance) \ wxRibbonShiftLuminance(primary_hsl, luminance ## f).ToRGB() #define LikeSecondary(luminance) \ wxRibbonShiftLuminance(secondary_hsl, luminance ## f).ToRGB() m_tab_ctrl_background_colour = LikePrimary(0.9); m_tab_ctrl_background_gradient_colour = LikePrimary(1.7); m_tab_border_pen = LikePrimary(0.75); m_tab_label_colour = LikePrimary(0.1); m_tab_hover_background_top_colour = primary_hsl.ToRGB(); m_tab_hover_background_top_gradient_colour = LikePrimary(1.6); m_tab_hover_background_brush = m_tab_hover_background_top_colour; m_tab_active_background_colour = m_tab_ctrl_background_gradient_colour; m_tab_active_background_gradient_colour = primary_hsl.ToRGB(); m_tab_active_top_background_brush = m_tab_active_background_colour; m_panel_label_colour = m_tab_label_colour; m_panel_minimised_label_colour = m_panel_label_colour; m_panel_hover_label_colour = tertiary_hsl.ToRGB(); m_page_border_pen = m_tab_border_pen; m_panel_border_pen = m_tab_border_pen; m_background_brush = primary_hsl.ToRGB(); m_page_hover_background_colour = LikePrimary(1.5); m_page_hover_background_gradient_colour = LikePrimary(0.9); m_panel_label_background_colour = LikePrimary(0.85); m_panel_label_background_gradient_colour = LikePrimary(0.97); m_panel_hover_label_background_gradient_colour = secondary_hsl.ToRGB(); m_panel_hover_label_background_colour = secondary_hsl.Lighter(0.2f).ToRGB(); m_button_bar_hover_border_pen = secondary_hsl.ToRGB(); m_button_bar_hover_background_brush = LikeSecondary(1.7); m_button_bar_active_background_brush = LikeSecondary(1.4); m_button_bar_label_colour = m_tab_label_colour; m_button_bar_label_disabled_colour = m_tab_label_colour; m_gallery_border_pen = m_tab_border_pen; m_gallery_item_border_pen = m_button_bar_hover_border_pen; m_gallery_hover_background_brush = LikePrimary(1.2); m_gallery_button_background_colour = m_page_hover_background_colour; m_gallery_button_background_gradient_colour = m_page_hover_background_gradient_colour; m_gallery_button_hover_background_brush = m_button_bar_hover_background_brush; m_gallery_button_active_background_brush = m_button_bar_active_background_brush; m_gallery_button_disabled_background_brush = primary_hsl.Desaturated(0.15f).ToRGB(); SetColour(wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR, LikePrimary(0.1)); SetColour(wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR, wxColour(128, 128, 128)); SetColour(wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR, LikeSecondary(0.1)); SetColour(wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR, LikeSecondary(0.1)); m_toolbar_border_pen = m_tab_border_pen; SetColour(wxRIBBON_ART_TOOLBAR_FACE_COLOUR, LikePrimary(0.1)); m_tool_background_colour = m_page_hover_background_colour; m_tool_background_gradient_colour = m_page_hover_background_gradient_colour; m_toolbar_hover_borden_pen = m_button_bar_hover_border_pen; m_tool_hover_background_brush = m_button_bar_hover_background_brush; m_tool_active_background_brush = m_button_bar_active_background_brush; //For highlight pages wxColour top_colour1((m_tab_active_background_colour.Red() + m_tab_hover_background_top_colour.Red())/2, (m_tab_active_background_colour.Green() + m_tab_hover_background_top_colour.Green())/2, (m_tab_active_background_colour.Blue() + m_tab_hover_background_top_colour.Blue())/2); wxColour bottom_colour1((m_tab_active_background_gradient_colour.Red() + m_tab_hover_background_top_gradient_colour.Red())/2, (m_tab_active_background_gradient_colour.Green() + m_tab_hover_background_top_gradient_colour.Green())/2, (m_tab_active_background_gradient_colour.Blue() + m_tab_hover_background_top_gradient_colour.Blue())/2); m_tab_highlight_top_colour = top_colour1; m_tab_highlight_top_gradient_colour = bottom_colour1; m_tab_highlight_colour = top_colour1; m_tab_highlight_gradient_colour = bottom_colour1; #undef LikeSecondary #undef LikePrimary }
wxPdfColour::wxPdfColour(const unsigned char grayscale) { SetColour(grayscale); }
void wxGenericPen::SetColour( const wxColour &colour ) { SetColour(wxGenericColour(colour)); }
wxPdfColour::wxPdfColour(const wxColour& colour) { SetColour(colour); }
void wxGenericBrush::SetColour( int red, int green, int blue, int alpha ) { SetColour(wxGenericColour(red, green, blue, alpha)); }
wxPdfColour::wxPdfColour(const unsigned char red, const unsigned char green, const unsigned char blue) { SetColour(red, green, blue); }
void NewsScreenInterface::DrawNewsButton ( Button *button, bool highlighted, bool clicked ) { int index; sscanf ( button->name, "news_story %d", &index ); index += baseoffset; clear_draw ( button->x, button->y, button->width, button->height ); // Get the text from news item (index + baseoffset) CompanyUplink *cu = (CompanyUplink *) game->GetWorld ()->GetCompany ( "Uplink" ); UplinkAssert ( cu ); News *news = cu->GetNews (index); if ( news ) { int screenheight = app->GetOptions ()->GetOptionValue ( "graphics_screenheight" ); glScissor ( button->x, screenheight - (button->y + button->height), button->width, button->height ); glEnable ( GL_SCISSOR_TEST ); if ( index == currentselect ) { glBegin ( GL_QUADS ); SetColour ( "PanelHighlightA" ); glVertex2i ( button->x, button->y ); SetColour ( "PanelHighlightB" ); glVertex2i ( button->x + button->width, button->y ); SetColour ( "PanelHighlightA" ); glVertex2i ( button->x + button->width, button->y + button->height ); SetColour ( "PanelHighlightB" ); glVertex2i ( button->x, button->y + button->height ); glEnd (); } else { if ( index % 2 == 0 ) { glBegin ( GL_QUADS ); SetColour ( "DarkPanelA" ); glVertex2i ( button->x, button->y + button->height ); SetColour ( "DarkPanelB" ); glVertex2i ( button->x, button->y ); SetColour ( "DarkPanelA" ); glVertex2i ( button->x + button->width, button->y ); SetColour ( "DarkPanelB" ); glVertex2i ( button->x + button->width, button->y + button->height ); glEnd (); } else { glBegin ( GL_QUADS ); SetColour ( "DarkPanelB" ); glVertex2i ( button->x, button->y + button->height ); SetColour ( "DarkPanelA" ); glVertex2i ( button->x, button->y ); SetColour ( "DarkPanelB" ); glVertex2i ( button->x + button->width, button->y ); SetColour ( "DarkPanelA" ); glVertex2i ( button->x + button->width, button->y + button->height ); glEnd (); } } if ( highlighted ) { SetColour ( "PanelHighlightBorder" ); border_draw ( button ); } // Get the date and subject char date [64]; char subject [256]; UplinkStrncpy ( subject, news->headline, sizeof ( subject ) ); UplinkStrncpy ( date, news->date.GetShortString (), sizeof ( date ) ); // Get the first line of the news story char *fulldetails = news->GetDetails (); char *firstendline = strchr ( fulldetails, '\n' ); if ( firstendline && firstendline - fulldetails > 255 ) firstendline = fulldetails + 255; char details [256]; if ( firstendline ) { strncpy ( details, news->GetDetails (), ( firstendline - fulldetails ) + 1 ); details[firstendline - fulldetails] = '\x0'; // Added by Contraband } else UplinkStrncpy ( details, " ", sizeof ( details ) ); // Draw the text items SetColour ( "DefaultText" ); GciDrawText ( button->x + 110, button->y + 10, subject ); GciDrawText ( button->x + 5, button->y + 10, date ); SetColour ( "DimmedText" ); GciDrawText ( button->x + 110, button->y + 25, details ); glDisable ( GL_SCISSOR_TEST ); } }
wxPdfColour::wxPdfColour(double cyan, double magenta, double yellow, double black) { SetColour(cyan, magenta, yellow, black); }
void CMUSHclientDoc::Hyperlink_Helper (LPCTSTR Action, LPCTSTR Text, LPCTSTR Hint, LPCTSTR TextColour, LPCTSTR BackColour, BOOL URL, BOOL NoUnderline) { // return if attempt to do tell (or note) before output buffer exists if (m_pCurrentLine == NULL || m_pLinePositions == NULL) return; // don't muck around if empty message if (Action [0] == 0) return; // If current line is not a note line, force a line change (by displaying // an empty string), so that the style change is on the note line and not // the back of the previous line. This has various implications, including // the way that "bleed colour to edge" will work. Otherwise it bleeds the // forthcoming note colour to the edge of the previous (mud) line. if ((m_pCurrentLine->flags & NOTE_OR_COMMAND) != COMMENT) DisplayMsg ("", 0, COMMENT); COLORREF forecolour = m_iHyperlinkColour, backcolour; if (m_bNotesInRGB) backcolour = m_iNoteColourBack; else { if (m_iNoteTextColour == SAMECOLOUR) { if (m_bCustom16isDefaultColour) backcolour = m_customback [15]; else backcolour = m_normalcolour [BLACK]; } // not same colour else backcolour = m_customback [m_iNoteTextColour]; } SetColour (TextColour, forecolour); SetColour (BackColour, backcolour); // change to underlined hyperlink AddStyle (COLOUR_RGB | (URL ? ACTION_HYPERLINK : ACTION_SEND) | (NoUnderline ? 0 : UNDERLINE), forecolour, backcolour, 0, GetAction (Action, Hint [0] == 0 ? Action : Hint, "")); // output the link text if (strlen (Text) > 0) AddToLine (Text, COMMENT); else AddToLine (Action, COMMENT); // add another style to finish the hyperlink if (m_bNotesInRGB) AddStyle (COLOUR_RGB, m_iNoteColourFore, m_iNoteColourBack, 0, NULL); else { if (m_iNoteTextColour == SAMECOLOUR) { if (m_bCustom16isDefaultColour) AddStyle (COLOUR_CUSTOM, 15, BLACK, 0, NULL); else AddStyle (COLOUR_ANSI, WHITE, BLACK, 0, NULL); } // not same colour else AddStyle (COLOUR_CUSTOM, m_iNoteTextColour, BLACK, 0, NULL); } // not RGB } // end of CMUSHclientDoc::Hyperlink_Helper
wxPdfColour::wxPdfColour(const wxPdfSpotColour& spot, double tint) { SetColour(spot, tint); }
void AnalyserInterface::ConnectionDraw ( Button *button, bool highlighted, bool clicked ) { int screenw = app->GetOptions ()->GetOptionValue ("graphics_screenwidth"); int screenh = app->GetOptions ()->GetOptionValue ("graphics_screenheight"); int paneltop = (int)(100.0 * ( (screenw * PANELSIZE) / 188.0 ) + 30); int panelwidth = (int)(screenw * PANELSIZE); // // Look up the remote host // VLocation *vl = game->GetWorld ()->GetVLocation ( remotehost ); UplinkAssert (vl); Computer *comp = vl->GetComputer (); UplinkAssert (comp); // // Draw the standard shaded background // glBegin ( GL_QUADS ); SetColour("PanelBackgroundA"); glVertex2i ( button->x, button->y + button->height ); SetColour("PanelBackgroundB"); glVertex2i ( button->x, button->y ); SetColour("PanelBackgroundA"); glVertex2i ( button->x + button->width, button->y ); SetColour("PanelBackgroundB"); glVertex2i ( button->x + button->width, button->y + button->height ); glEnd (); SetColour("PanelBorder"); border_draw ( button ); // // Draw connecting lines // if ( strcmp ( remotehost, IP_LOCALHOST ) != 0 ) { glColor4f ( 1.0f, 1.0f, 1.0f, 1.0f ); glLineWidth ( 2 ); glLineStipple ( 2, moving_stipplepattern ); glEnable ( GL_LINE_STIPPLE ); glBegin ( GL_LINE_STRIP ); glVertex2i ( screenw - panelwidth + 40, paneltop + 75 ); glVertex2i ( screenw - panelwidth + 40, paneltop + 160 ); glVertex2i ( screenw - 40, paneltop + 160 ); glVertex2i ( screenw - 40, paneltop + 240 ); glEnd (); glLineWidth ( 1 ); glDisable ( GL_LINE_STIPPLE ); } // // Draw boxes around any systems that are being monitored // int systemindex = 0; char name [32]; UplinkStrncpy ( name, "analyser_system 0", sizeof ( name ) ); while ( EclGetButton ( name ) ) { if ( SecurityMonitor::IsMonitored ( systemindex ) ) { Button *b = EclGetButton (name); glColor4f ( 1.0f, 0.1f, 0.1f, 1.0f ); glLineWidth ( 2 ); glLineStipple ( 2, moving_stipplepattern ); glEnable ( GL_LINE_STIPPLE ); glBegin ( GL_LINE_LOOP ); glVertex2i ( b->x - 10, b->y - 10 ); glVertex2i ( b->x + b->width + 10, b->y - 10 ); glVertex2i ( b->x + b->width + 10, b->y + b->height + 10 ); glVertex2i ( b->x - 10, b->y + b->height + 10 ); glEnd (); glLineWidth ( 1 ); glDisable ( GL_LINE_STIPPLE ); } ++systemindex; UplinkSnprintf ( name, sizeof ( name ), "analyser_system %d", systemindex ); } }
wxPdfColour::wxPdfColour(const wxPdfPattern& pattern) { SetColour(pattern); }
void LoadGameView::Draw(const bool &Initial) const { if(Initial) // First drawing - draw the general layout { SetColour(GREY, BLACK); Clear(); // Draw borders SetCursor(1, 1); for(unsigned int y=0; y<=Height; y++) { for(unsigned int x=0; x<=Width; (y==0 || y==Height)?x++:x+=Width) // Conditional logic: if we're at the top or bottom, // iterate throughthe full width, otherwise just do // the two sides. { // Position SetCursor(x+1, y+1); // Draw corners if( (y==0 && x==0) // Top left corner || (y==0 && x==Width) // Top right corner || (y==Height && x==0) // Bottom left corner || (y==Height && x==Width)) //Bottom left corner { std::cout<<"+"; } else if(y==0 || y==Height) // Top/bottom { std::cout<<"-"; } else if(x==0 || x==Width) // Sides { std::cout<<"|"; } } std::cout<<std::endl; } // Draw controls SetColour(GREY, BLACK); SetCursor(Width+7, 1); std::cout<<"Enter: Select save"; SetCursor(Width+7, 2); std::cout<<"Escape: Return to menu"; SetCursor(Width+7, 3); std::cout<<"Up/Down keys: Change selection"; // Draw files SetColour(GREY, BLACK); for(unsigned int x=0; x<FileNames.size(); x++) { SetCursor(3, 2+x); std::cout<<FileNames[x]; } } else // Subsequent drawings - draw the specific elements { // If there are any saves if(FileNames.size()>0) { // Overwrite old selection SetCursor(3, 2+LastSelected); // Place cursor inside the borders, at the correct height SetColour(GREY, BLACK); std::cout<<FileNames[LastSelected]; // Draw new selection SetCursor(3, 2+CurrentlySelected); // Place cursor inside the borders, at the correct height SetColour(GREEN, BLACK); std::cout<<FileNames[CurrentlySelected]; } } }
wxPdfColour::wxPdfColour(const wxString& name) { SetColour(name); }
//----------------------------------------------------------- //----------------------------------------------------------- void SpriteComponent::SetColour(f32 in_r, f32 in_g, f32 in_b, f32 in_a) { SetColour(Core::Colour(in_r, in_g, in_b, in_a)); }
void Unit::EndTurn(cocos2d::Color3B colour) { SetColour(colour); }