Ticket #1029: VariableNames_Colour_to_Color_15728.diff

File VariableNames_Colour_to_Color_15728.diff, 63.1 KB (added by dan_trev, 10 years ago)

First pass / learning chance of colour to color

  • graphics/GameView.cpp

     
    481481
    482482    CheckLightEnv();
    483483
    484     m->Game->CachePlayerColours();
     484    m->Game->CachePlayerColors();
    485485}
    486486
    487487void CGameView::Render()
  • graphics/LOSTexture.cpp

     
    229257
    230258    glGenTextures(1, &m_Texture);
    231259
    232     // Initialise texture with SoD colour, for the areas we don't
     260    // Initialise texture with SoD color, for the areas we don't
    233261    // overwrite with glTexSubImage2D later
    234262    u8* texData = new u8[m_TextureSize * m_TextureSize * 4];
    235263    memset(texData, 0x00, m_TextureSize * m_TextureSize * 4);
  • graphics/Model.cpp

     
    666666        it->m_Model->SetPlayerID(id);
    667667}
    668668
    669 void CModel::SetShadingColor(const CColor& colour)
     669void CModel::SetShadingColor(const CColor& color)
    670670{
    671     CModelAbstract::SetShadingColor(colour);
     671    CModelAbstract::SetShadingColor(color);
    672672
    673673    for (std::vector<Prop>::iterator it = m_Props.begin(); it != m_Props.end(); ++it)
    674         it->m_Model->SetShadingColor(colour);
     674        it->m_Model->SetShadingColor(color);
    675675}
  • graphics/Model.h

     
    103103    // set the model's player ID, recursively through props
    104104    void SetPlayerID(player_id_t id);
    105105    // set the models mod color
    106     virtual void SetShadingColor(const CColor& colour);
     106    virtual void SetShadingColor(const CColor& color);
    107107    // get the model's material
    108108    CMaterial& GetMaterial() { return m_Material; }
    109109
  • graphics/ModelAbstract.h

     
    154154    // get the model's player ID; initial default is INVALID_PLAYER
    155155    virtual player_id_t GetPlayerID() const { return m_PlayerID; }
    156156
    157     virtual void SetShadingColor(const CColor& colour) { m_ShadingColor = colour; }
     157    virtual void SetShadingColor(const CColor& color) { m_ShadingColor = color; }
    158158    virtual CColor GetShadingColor() const { return m_ShadingColor; }
    159159
    160160protected:
  • graphics/ObjectEntry.cpp

     
    7373        str << variation.color;
    7474        int r, g, b;
    7575        if (! (str >> r >> g >> b)) // Any trailing data is ignored
    76             LOGERROR(L"Actor '%ls' has invalid RGB colour '%hs'", m_Base->m_ShortName.c_str(), variation.color.c_str());
     76            LOGERROR(L"Actor '%ls' has invalid RGB color '%hs'", m_Base->m_ShortName.c_str(), variation.color.c_str());
    7777        else
    7878            m_Color = CColor(r/255.0f, g/255.0f, b/255.0f, 1.0f);
    7979    }
  • graphics/ObjectEntry.h

     
    5555    std::vector<CObjectBase::Samp> m_Samplers;
    5656    // model name
    5757    VfsPath m_ModelName;
    58     // colour (used when doing alpha-channel colouring, but not doing player-colour)
     58    // color (used when doing alpha-channel coloring, but not doing player-color)
    5959    CColor m_Color;
    60         // (probable TODO: make colour a per-model thing, rather than per-objectEntry,
    61         // so we can have lots of colour variations without wasting memory on
     60        // (probable TODO: make color a per-model thing, rather than per-objectEntry,
     61        // so we can have lots of color variations without wasting memory on
    6262        // lots of objectEntries)
    6363
    6464    std::wstring m_ProjectileModelName;
  • graphics/ParticleEmitter.cpp

     
    151151
    152152        SColor4ub color = m_Particles[i].color;
    153153
    154         // Special case: If the blending depends on the source colour, not the source alpha,
     154        // Special case: If the blending depends on the source color, not the source alpha,
    155155        // then pre-multiply by the alpha. (This is kind of a hack.)
    156156        if (m_Type->m_BlendFuncDst == GL_ONE_MINUS_SRC_COLOR)
    157157        {
  • graphics/Terrain.cpp

     
    4141// CTerrain constructor
    4242CTerrain::CTerrain()
    4343: m_Heightmap(0), m_Patches(0), m_MapSize(0), m_MapSizePatches(0),
    44 m_BaseColour(255, 255, 255, 255)
     44m_BaseColor(255, 255, 255, 255)
    4545{
    4646}
    4747
  • graphics/Terrain.h

     
    147147     */
    148148    CBoundingBoxAligned GetVertexesBound(ssize_t i0, ssize_t j0, ssize_t i1, ssize_t j1);
    149149
    150     // get the base colour for the terrain (typically pure white - other colours
     150    // get the base color for the terrain (typically pure white - other colors
    151151    // will interact badly with LOS - but used by the Actor Viewer tool)
    152     SColor4ub GetBaseColour() const { return m_BaseColour; }
    153     // set the base colour for the terrain
    154     void SetBaseColour(SColor4ub colour) { m_BaseColour = colour; }
     152    SColor4ub GetBaseColor() const { return m_BaseColor; }
     153    // set the base color for the terrain
     154    void SetBaseColor(SColor4ub color) { m_BaseColor = color; }
    155155
    156156    const CHeightMipmap& GetHeightMipmap() const { return m_HeightMipmap; }
    157157
     
    169169    CPatch* m_Patches;
    170170    // 16-bit heightmap data
    171171    u16* m_Heightmap;
    172     // base colour (usually white)
    173     SColor4ub m_BaseColour;
     172    // base color (usually white)
     173    SColor4ub m_BaseColor;
    174174    // heightmap mipmap
    175175    CHeightMipmap m_HeightMipmap;
    176176};
  • graphics/TerrainTextureEntry.cpp

     
    174174        (*it)->RemoveTerrain(this);
    175175}
    176176
    177 // BuildBaseColor: calculate the root colour of the texture, used for coloring minimap, and store
     177// BuildBaseColor: calculate the root color of the texture, used for coloring minimap, and store
    178178// in m_BaseColor member
    179179void CTerrainTextureEntry::BuildBaseColor()
    180180{
     
    186186        return;
    187187    }
    188188
    189     // Use the texture colour if available
     189    // Use the texture color if available
    190190    if (GetTexture()->TryLoad())
    191191    {
    192         m_BaseColor = GetTexture()->GetBaseColour();
     192        m_BaseColor = GetTexture()->GetBaseColor();
    193193        m_BaseColorValid = true;
    194194    }
    195195}
     
    362362    result.m_hCompositeAlphaMap = hCompositeAlphaMap;
    363363   
    364364    m_TerrainAlpha = it;
    365 }
    366  No newline at end of file
     365}
  • graphics/TerritoryTexture.cpp

     
    183183        CColor color(1, 0, 1, 1);
    184184        CmpPtr<ICmpPlayer> cmpPlayer(m_Simulation, cmpPlayerManager->GetPlayerByID(p));
    185185        if (cmpPlayer)
    186             color = cmpPlayer->GetColour();
     186            color = cmpPlayer->GetColor();
    187187        colors.push_back(color);
    188188    }
    189189
  • graphics/TextureConverter.h

     
    5252 *
    5353 * 'normal' is 'true' or 'false'.
    5454 *
    55  * 'alpha' is 'transparency' or 'player' (it determines whether the colour value of
     55 * 'alpha' is 'transparency' or 'player' (it determines whether the color value of
    5656 * 0-alpha pixels is significant or not).
    5757 *
    5858 * 'filter' is 'box', 'triangle' or 'kaiser'.
  • graphics/TextureManager.cpp

     
    189189        size_t flags = 0;
    190190        (void)ogl_tex_get_format(h, &flags, NULL);
    191191
    192         // Initialise base colour from the texture
    193         (void)ogl_tex_get_average_colour(h, &texture->m_BaseColour);
     192        // Initialise base color from the texture
     193        (void)ogl_tex_get_average_color(h, &texture->m_BaseColor);
    194194
    195195        // Set GL upload properties
    196196        (void)ogl_tex_set_wrap(h, texture->m_Properties.m_WrapS, texture->m_Properties.m_WrapT);
     
    516516};
    517517
    518518CTexture::CTexture(Handle handle, const CTextureProperties& props, CTextureManagerImpl* textureManager) :
    519     m_Handle(handle), m_BaseColour(0), m_State(UNLOADED), m_Properties(props), m_TextureManager(textureManager)
     519    m_Handle(handle), m_BaseColor(0), m_State(UNLOADED), m_Properties(props), m_TextureManager(textureManager)
    520520{
    521521    // Add a reference to the handle (it might be shared by multiple CTextures
    522522    // so we can't take ownership of it)
     
    613613    return (flags & TEX_ALPHA) != 0;
    614614}
    615615
    616 u32 CTexture::GetBaseColour() const
     616u32 CTexture::GetBaseColor() const
    617617{
    618     return m_BaseColour;
     618    return m_BaseColor;
    619619}
    620620
    621621size_t CTexture::GetUploadedSize() const
  • graphics/TextureManager.h

     
    237237     * average of the whole texture).
    238238     * Returns 0 if the texture has no mipmaps.
    239239     */
    240     u32 GetBaseColour() const;
     240    u32 GetBaseColor() const;
    241241
    242242    /**
    243243     * Returns total number of bytes uploaded for this texture.
     
    287287    const CTextureProperties m_Properties;
    288288
    289289    Handle m_Handle;
    290     u32 m_BaseColour;
     290    u32 m_BaseColor;
    291291
    292292    enum {
    293293        UNLOADED, // loading has not started
  • gui/CGUISprite.h

     
    123123     */
    124124    GLint           m_WrapMode;
    125125
    126     // Visual effects (e.g. colour modulation)
     126    // Visual effects (e.g. color modulation)
    127127    SGUIImageEffects* m_Effects;
    128128
    129129    // Color
  • gui/GUIRenderer.cpp

     
    7979        //     "stretched:filename.ext" - stretched image
    8080        //     "stretched:grayscale:filename.ext" - stretched grayscale image
    8181        //     "cropped:(0.5, 0.25)"    - stretch this ratio (x,y) of the top left of the image
    82         //     "colour:r g b a"         - solid colour
     82        //     "color:r g b a"          - solid color
    8383        //
    8484        // and if so, try to create it as a new sprite.
    8585        if (SpriteName.substr(0, 10) == "stretched:")
     
    141141            CStrW value = wstring_from_utf8(SpriteName.substr(7));
    142142            CColor color;
    143143
    144             // Check colour is valid
     144            // Check color is valid
    145145            if (!GUI<CColor>::ParseString(value, color))
    146146            {
    147                 LOGERROR(L"GUI: Error parsing sprite 'colour' (\"%ls\")", value.c_str());
     147                LOGERROR(L"GUI: Error parsing sprite 'color' (\"%ls\")", value.c_str());
    148148                return;
    149149            }
    150150
  • gui/scripting/JSInterface_IGUIObject.cpp

     
    161161
    162162        case GUIST_CColor:
    163163            {
    164                 CColor colour;
    165                 GUI<CColor>::GetSetting(e, propName, colour);
     164                CColor color;
     165                GUI<CColor>::GetSetting(e, propName, color);
    166166                JS::RootedObject obj(cx, pScriptInterface->CreateCustomObject("GUIColor"));
    167167                vp.setObject(*obj);
    168168                JS::RootedValue c(cx);
    169169                // Attempt to minimise ugliness through macrosity
    170                 #define P(x) c = JS::NumberValue(colour.x); \
     170                #define P(x) c = JS::NumberValue(color.x); \
    171171                if (c.isNull()) \
    172172                    return false; \
    173173                JS_SetProperty(cx, obj, #x, c.address())
     
    528528            }
    529529            else if (vp.isObject() && JS_InstanceOf(cx, &vp.toObject(), &JSI_GUIColor::JSI_class, NULL))
    530530            {
    531                 CColor colour;
     531                CColor color;
    532532                JS::RootedObject (cx, &vp.toObject());
    533533                JS::RootedValue t(cx);
    534534                double s;
    535535                #define PROP(x) JS_GetProperty(cx, obj, #x, t.address()); \
    536536                                s = t.toDouble(); \
    537                                 colour.x = (float)s
     537                                color.x = (float)s
    538538                PROP(r); PROP(g); PROP(b); PROP(a);
    539539                #undef PROP
    540540
    541                 GUI<CColor>::SetSetting(e, propName, colour);
     541                GUI<CColor>::SetSetting(e, propName, color);
    542542            }
    543543            else
    544544            {
  • lib/res/graphics/ogl_tex.cpp

     
    10391039    return INFO::OK;
    10401040}
    10411041
    1042 // retrieve colour of 1x1 mipmap level
    1043 extern Status ogl_tex_get_average_colour(Handle ht, u32* p)
     1042// retrieve color of 1x1 mipmap level
     1043extern Status ogl_tex_get_average_color(Handle ht, u32* p)
    10441044{
    10451045    H_DEREF(ht, OglTex, ot);
    10461046    warn_if_uploaded(ht, ot);
    10471047
    1048     *p = ot->t.get_average_colour();
     1048    *p = ot->t.get_average_color();
    10491049    return INFO::OK;
    10501050}
    10511051
  • lib/res/graphics/ogl_tex.h

     
    408408
    409409/**
    410410 * Retrieve ARGB value of 1x1 mipmap level of the texture,
    411  * i.e. the average colour of the whole texture.
     411 * i.e. the average color of the whole texture.
    412412 *
    413413 * @param ht Texture handle
    414414 * @param p will be filled with ARGB value (or 0 if texture does not have mipmaps)
     
    416416 *
    417417 * Must be called before uploading (raises a warning if called afterwards).
    418418 */
    419 extern Status ogl_tex_get_average_colour(Handle ht, u32* p);
     419extern Status ogl_tex_get_average_color(Handle ht, u32* p);
    420420
    421421
    422422//
  • lib/sysdep/os/win/wcursor.cpp

     
    5656    // CreateBitmap; bpp/format must be checked against those of the DC.
    5757    // this is the simplest way and we don't care about slight performance
    5858    // differences because this is typically only called once.
    59     HBITMAP hbmColour = CreateBitmap(w, h, 1, 32, bgra_img);
     59    HBITMAP hbmColor = CreateBitmap(w, h, 1, 32, bgra_img);
    6060
    6161    // CreateIconIndirect doesn't access this; we just need to pass
    6262    // an empty bitmap.
     
    6969    ii.xHotspot = (DWORD)hx;
    7070    ii.yHotspot = (DWORD)hy;
    7171    ii.hbmMask  = hbmMask;
    72     ii.hbmColor = hbmColour;
     72    ii.hbmColor = hbmColor;
    7373    HICON hIcon = CreateIconIndirect(&ii);
    7474
    7575    // CreateIconIndirect makes copies, so we no longer need these.
    7676    DeleteObject(hbmMask);
    77     DeleteObject(hbmColour);
     77    DeleteObject(hbmColor);
    7878
    7979    if(!wutil_IsValidHandle(hIcon))
    8080        WARN_RETURN(ERR::FAIL);
  • lib/sysdep/os/win/wsdl.cpp

     
    330330static void video_SetPixelFormat(HDC hDC, int bpp)
    331331{
    332332    const DWORD dwFlags = PFD_SUPPORT_OPENGL|PFD_DRAW_TO_WINDOW|PFD_DOUBLEBUFFER;
    333     BYTE cColourBits = (BYTE)bpp;
     333    BYTE cColorBits = (BYTE)bpp;
    334334    BYTE cAlphaBits = 0;
    335335    if(bpp == 32)
    336336    {
    337         cColourBits = 24;
     337        cColorBits = 24;
    338338        cAlphaBits = 8;
    339339    }
    340340    const BYTE cAccumBits   = 0;
     
    348348        1,                              // version
    349349        dwFlags,
    350350        PFD_TYPE_RGBA,
    351         cColourBits, 0, 0, 0, 0, 0, 0,  // c*Bits, c*Shift are unused
     351        cColorBits, 0, 0, 0, 0, 0, 0,   // c*Bits, c*Shift are unused
    352352        cAlphaBits, 0,                  // cAlphaShift is unused
    353353        cAccumBits, 0, 0, 0, 0,         // cAccum*Bits are unused
    354354        cDepthBits,
  • lib/tex/tex.cpp

     
    637637    return p + m_Ofs;
    638638}
    639639
    640 // returns colour of 1x1 mipmap level
    641 u32 Tex::get_average_colour() const
     640// returns color of 1x1 mipmap level
     641u32 Tex::get_average_color() const
    642642{
    643643    // require mipmaps
    644644    if(!(m_Flags & TEX_MIPMAPS))
  • lib/tex/tex.h

     
    337337     *
    338338     * @return ARGB value (or 0 if texture does not have mipmaps)
    339339     **/
    340     u32 get_average_colour() const;
     340    u32 get_average_color() const;
    341341
    342342    /**
    343343     * return total byte size of the image pixels. (including mipmaps!)
  • lib/tex/tex_bmp.cpp

     
    9494}
    9595
    9696
    97 // requirements: uncompressed, direct colour, bottom up
     97// requirements: uncompressed, direct color, bottom up
    9898Status TexCodecBmp::decode(rpU8 data, size_t UNUSED(size), Tex* RESTRICT t) const
    9999{
    100100    const BmpHeader* hdr = (const BmpHeader*)data;
  • lib/tex/tex_png.cpp

     
    125125    // read header and determine format
    126126    png_read_info(png_ptr, info_ptr);
    127127    png_uint_32 w, h;
    128     int bit_depth, colour_type;
    129     png_get_IHDR(png_ptr, info_ptr, &w, &h, &bit_depth, &colour_type, 0, 0, 0);
     128    int bit_depth, color_type;
     129    png_get_IHDR(png_ptr, info_ptr, &w, &h, &bit_depth, &color_type, 0, 0, 0);
    130130    const size_t pitch = png_get_rowbytes(png_ptr, info_ptr);
    131131    const u32 bpp = (u32)(pitch/w * 8);
    132132
     
    133133    size_t flags = 0;
    134134    if(bpp == 32)
    135135        flags |= TEX_ALPHA;
    136     if(colour_type == PNG_COLOR_TYPE_GRAY)
     136    if(color_type == PNG_COLOR_TYPE_GRAY)
    137137        flags |= TEX_GREY;
    138138
    139139    // make sure format is acceptable
    140140    if(bit_depth != 8)
    141141        WARN_RETURN(ERR::TEX_NOT_8BIT_PRECISION);
    142     if(colour_type & PNG_COLOR_MASK_PALETTE)
     142    if(color_type & PNG_COLOR_MASK_PALETTE)
    143143        WARN_RETURN(ERR::TEX_INVALID_COLOR_TYPE);
    144144
    145145    const size_t img_size = pitch * h;
     
    165165    const png_uint_32 w = (png_uint_32)t->m_Width, h = (png_uint_32)t->m_Height;
    166166    const size_t pitch = w * t->m_Bpp / 8;
    167167
    168     int colour_type;
     168    int color_type;
    169169    switch(t->m_Flags & (TEX_GREY|TEX_ALPHA))
    170170    {
    171171    case TEX_GREY|TEX_ALPHA:
    172         colour_type = PNG_COLOR_TYPE_GRAY_ALPHA;
     172        color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
    173173        break;
    174174    case TEX_GREY:
    175         colour_type = PNG_COLOR_TYPE_GRAY;
     175        color_type = PNG_COLOR_TYPE_GRAY;
    176176        break;
    177177    case TEX_ALPHA:
    178         colour_type = PNG_COLOR_TYPE_RGB_ALPHA;
     178        color_type = PNG_COLOR_TYPE_RGB_ALPHA;
    179179        break;
    180180    default:
    181         colour_type = PNG_COLOR_TYPE_RGB;
     181        color_type = PNG_COLOR_TYPE_RGB;
    182182        break;
    183183    }
    184184
    185185    png_set_write_fn(png_ptr, da, io_write, io_flush);
    186     png_set_IHDR(png_ptr, info_ptr, w, h, 8, colour_type,
     186    png_set_IHDR(png_ptr, info_ptr, w, h, 8, color_type,
    187187        PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
    188188
    189189    u8* data = t->get_data();
  • lib/tex/tex_tga.cpp

     
    3434
    3535enum TgaImgType
    3636{
    37     TGA_TRUE_COLOUR = 2,    // uncompressed 24 or 32 bit direct RGB
    38     TGA_GREY        = 3     // uncompressed 8 bit direct greyscale
     37    TGA_TRUE_COLOR = 2, // uncompressed 24 or 32 bit direct RGB
     38    TGA_GREY       = 3  // uncompressed 8 bit direct greyscale
    3939};
    4040
    4141enum TgaImgDesc
     
    4747typedef struct
    4848{
    4949    u8 img_id_len;          // 0 - no image identifier present
    50     u8 colour_map_type;     // 0 - no colour map present
     50    u8 color_map_type;      // 0 - no color map present
    5151    u8 img_type;            // see TgaImgType
    52     u8 colour_map[5];       // unused
     52    u8 color_map[5];        // unused
    5353
    5454    u16 x_origin;           // unused
    5555    u16 y_origin;           // unused
     
    6262}
    6363TgaHeader;
    6464
    65 // TGA file: header [img id] [colour map] image data
     65// TGA file: header [img id] [color map] image data
    6666
    6767#pragma pack(pop)
    6868
     
    7979
    8080    // the first TGA header doesn't have a magic field;
    8181    // we can only check if the first 4 bytes are valid
    82     // .. not direct colour
    83     if(hdr->colour_map_type != 0)
     82    // .. not direct color
     83    if(hdr->color_map_type != 0)
    8484        return false;
    85     // .. wrong colour type (not uncompressed greyscale or RGB)
    86     if(hdr->img_type != TGA_TRUE_COLOUR && hdr->img_type != TGA_GREY)
     85    // .. wrong color type (not uncompressed greyscale or RGB)
     86    if(hdr->img_type != TGA_TRUE_COLOR && hdr->img_type != TGA_GREY)
    8787        return false;
    8888
    89     // note: we can't check img_id_len or colour_map[0] - they are
     89    // note: we can't check img_id_len or color_map[0] - they are
    9090    // undefined and may assume any value.
    9191
    9292    return true;
     
    127127        flags |= TEX_ALPHA;
    128128    if(bpp == 8)
    129129        flags |= TEX_GREY;
    130     if(type == TGA_TRUE_COLOUR)
     130    if(type == TGA_TRUE_COLOR)
    131131        flags |= TEX_BGR;
    132132
    133133    // sanity checks
     
    151151        img_desc |= TGA_TOP_DOWN;
    152152    if(t->m_Bpp == 32)
    153153        img_desc |= 8;  // size of alpha channel
    154     TgaImgType img_type = (t->m_Flags & TEX_GREY)? TGA_GREY : TGA_TRUE_COLOUR;
     154    TgaImgType img_type = (t->m_Flags & TEX_GREY)? TGA_GREY : TGA_TRUE_COLOR;
    155155
    156156    size_t transforms = t->m_Flags;
    157157    transforms &= ~TEX_ORIENTATION; // no flip needed - we can set top-down bit.
     
    160160    const TgaHeader hdr =
    161161    {
    162162        0,              // no image identifier present
    163         0,              // no colour map present
     163        0,              // no color map present
    164164        (u8)img_type,
    165         {0,0,0,0,0},    // unused (colour map)
     165        {0,0,0,0,0},    // unused (color map)
    166166        0, 0,           // unused (origin)
    167167        (u16)t->m_Width,
    168168        (u16)t->m_Height,
  • ps/CConsole.cpp

     
    340340        // Cursor character is chosen to be an underscore
    341341        textRenderer.Put(0.0f, 0.0f, L"_");
    342342
    343         // Revert to the standard text colour
     343        // Revert to the standard text color
    344344        textRenderer.Color(1.0f, 1.0f, 1.0f);
    345345    }
    346346}
  • ps/Game.cpp

     
    350350
    351351static CColor BrokenColor(0.3f, 0.3f, 0.3f, 1.0f);
    352352
    353 void CGame::CachePlayerColours()
     353void CGame::CachePlayerColors()
    354354{
    355     m_PlayerColours.clear();
     355    m_PlayerColors.clear();
    356356
    357357    CmpPtr<ICmpPlayerManager> cmpPlayerManager(*m_Simulation2, SYSTEM_ENTITY);
    358358    if (!cmpPlayerManager)
     
    359359        return;
    360360
    361361    int numPlayers = cmpPlayerManager->GetNumPlayers();
    362     m_PlayerColours.resize(numPlayers);
     362    m_PlayerColors.resize(numPlayers);
    363363
    364364    for (int i = 0; i < numPlayers; ++i)
    365365    {
    366366        CmpPtr<ICmpPlayer> cmpPlayer(*m_Simulation2, cmpPlayerManager->GetPlayerByID(i));
    367367        if (!cmpPlayer)
    368             m_PlayerColours[i] = BrokenColor;
     368            m_PlayerColors[i] = BrokenColor;
    369369        else
    370             m_PlayerColours[i] = cmpPlayer->GetColour();
     370            m_PlayerColors[i] = cmpPlayer->GetColor();
    371371    }
    372372}
    373373
    374374
    375 CColor CGame::GetPlayerColour(int player) const
     375CColor CGame::GetPlayerColor(int player) const
    376376{
    377     if (player < 0 || player >= (int)m_PlayerColours.size())
     377    if (player < 0 || player >= (int)m_PlayerColors.size())
    378378        return BrokenColor;
    379379
    380     return m_PlayerColours[player];
     380    return m_PlayerColors[player];
    381381}
  • ps/Game.h

     
    9393    void SetPlayerID(int playerID);
    9494
    9595    /**
    96      * Retrieving player colours from scripts is slow, so this updates an
    97      * internal cache of all players' colours.
     96     * Retrieving player colors from scripts is slow, so this updates an
     97     * internal cache of all players' colors.
    9898     * Call this just before rendering, so it will always have the latest
    99      * colours.
     99     * colors.
    100100     */
    101     void CachePlayerColours();
     101    void CachePlayerColors();
    102102
    103     CColor GetPlayerColour(int player) const;
     103    CColor GetPlayerColor(int player) const;
    104104
    105105    /**
    106106     * Get m_GameStarted.
     
    166166    void RegisterInit(const JS::HandleValue attribs, const std::string& savedState);
    167167    IReplayLogger* m_ReplayLogger;
    168168
    169     std::vector<CColor> m_PlayerColours;
     169    std::vector<CColor> m_PlayerColors;
    170170
    171171    int LoadInitialState();
    172172    std::string m_InitialSavedState; // valid between RegisterInit and LoadInitialState
  • renderer/OverlayRenderer.cpp

     
    260260    PROFILE3("prepare overlays");
    261261
    262262    // This is where we should do something like sort the overlays by
    263     // colour/sprite/etc for more efficient rendering
     263    // color/sprite/etc for more efficient rendering
    264264
    265265    for (size_t i = 0; i < m->texlines.size(); ++i)
    266266    {
  • renderer/PostprocManager.cpp

     
    3737#if !CONFIG2_GLES
    3838
    3939CPostprocManager::CPostprocManager()
    40     : m_IsInitialised(false), m_PingFbo(0), m_PongFbo(0), m_PostProcEffect(L"default"), m_ColourTex1(0), m_ColourTex2(0),
     40    : m_IsInitialised(false), m_PingFbo(0), m_PongFbo(0), m_PostProcEffect(L"default"), m_ColorTex1(0), m_ColorTex2(0),
    4141      m_DepthTex(0), m_BloomFbo(0), m_BlurTex2a(0), m_BlurTex2b(0), m_BlurTex4a(0), m_BlurTex4b(0),
    4242      m_BlurTex8a(0), m_BlurTex8b(0), m_WhichBuffer(true)
    4343{
     
    6565        if (m_BloomFbo) pglDeleteFramebuffersEXT(1, &m_BloomFbo);
    6666        m_PingFbo = m_PongFbo = m_BloomFbo = 0;
    6767       
    68         if (m_ColourTex1) glDeleteTextures(1, &m_ColourTex1);
    69         if (m_ColourTex2) glDeleteTextures(1, &m_ColourTex2);
     68        if (m_ColorTex1) glDeleteTextures(1, &m_ColorTex1);
     69        if (m_ColorTex2) glDeleteTextures(1, &m_ColorTex2);
    7070        if (m_DepthTex) glDeleteTextures(1, &m_DepthTex);
    71         m_ColourTex1 = m_ColourTex2 = m_DepthTex = 0;
     71        m_ColorTex1 = m_ColorTex2 = m_DepthTex = 0;
    7272       
    7373        if (m_BlurTex2a) glDeleteTextures(1, &m_BlurTex2a);
    7474        if (m_BlurTex2b) glDeleteTextures(1, &m_BlurTex2b);
     
    9898        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    9999   
    100100    // Two fullscreen ping-pong textures.
    101     GEN_BUFFER_RGBA(m_ColourTex1, m_Width, m_Height);
    102     GEN_BUFFER_RGBA(m_ColourTex2, m_Width, m_Height);
     101    GEN_BUFFER_RGBA(m_ColorTex1, m_Width, m_Height);
     102    GEN_BUFFER_RGBA(m_ColorTex2, m_Width, m_Height);
    103103   
    104104    // Textures for several blur sizes. It would be possible to reuse
    105105    // m_BlurTex2b, thus avoiding the need for m_BlurTex4b and m_BlurTex8b, though given
     
    134134   
    135135    pglGenFramebuffersEXT(1, &m_PingFbo);
    136136    pglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_PingFbo);
    137     pglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_ColourTex1, 0);
     137    pglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_ColorTex1, 0);
    138138    pglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_DepthTex, 0);
    139139   
    140140    GLenum status = pglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
     
    145145   
    146146    pglGenFramebuffersEXT(1, &m_PongFbo);
    147147    pglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_PongFbo);
    148     pglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_ColourTex2, 0);
     148    pglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_ColorTex2, 0);
    149149    pglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_DepthTex, 0);
    150150   
    151151    status = pglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
     
    320320        ApplyBlurGauss(tex2, temptex, width, height);
    321321   
    322322    // We do the same thing for each scale, incrementally adding more and more blur.
    323     SCALE_AND_BLUR(m_WhichBuffer ? m_ColourTex1 : m_ColourTex2, m_BlurTex2a, m_BlurTex2b);
     323    SCALE_AND_BLUR(m_WhichBuffer ? m_ColorTex1 : m_ColorTex2, m_BlurTex2a, m_BlurTex2b);
    324324    SCALE_AND_BLUR(m_BlurTex2a, m_BlurTex4a, m_BlurTex4b);
    325325    SCALE_AND_BLUR(m_BlurTex4a, m_BlurTex8a, m_BlurTex8b);
    326326   
     
    403403    // We also bind a bunch of other textures and parameters, but since
    404404    // this only happens once per frame the overhead is negligible.
    405405    if (m_WhichBuffer)
    406         shader->BindTexture(str_renderedTex, m_ColourTex1);
     406        shader->BindTexture(str_renderedTex, m_ColorTex1);
    407407    else
    408         shader->BindTexture(str_renderedTex, m_ColourTex2);
     408        shader->BindTexture(str_renderedTex, m_ColorTex2);
    409409   
    410410    shader->BindTexture(str_depthTex, m_DepthTex);
    411411   
  • renderer/PostprocManager.h

     
    2828    // Two framebuffers, that we flip between at each shader pass.
    2929    GLuint m_PingFbo, m_PongFbo;
    3030   
    31     // Unique colour textures for the framebuffers.
    32     GLuint m_ColourTex1, m_ColourTex2;
     31    // Unique color textures for the framebuffers.
     32    GLuint m_ColorTex1, m_ColorTex2;
    3333   
    3434    // The framebuffers share a depth/stencil texture.
    3535    GLuint m_DepthTex;
     
    9898    // Matching setter that calls LoadEffect.
    9999    void SetPostEffect(CStrW name);
    100100
    101     // Clears the two colour buffers and depth buffer, and redirects all rendering
     101    // Clears the two color buffers and depth buffer, and redirects all rendering
    102102    // to our textures instead of directly to the system framebuffer.
    103103    void CaptureRenderOutput();
    104104   
  • renderer/RenderModifiers.cpp

     
    117117        shader->Uniform(m_BindingShadingColor, model->GetShadingColor());
    118118
    119119    if (m_BindingPlayerColor.Active())
    120         shader->Uniform(m_BindingPlayerColor, g_Game->GetPlayerColour(model->GetPlayerID()));
     120        shader->Uniform(m_BindingPlayerColor, g_Game->GetPlayerColor(model->GetPlayerID()));
    121121}
  • renderer/Renderer.cpp

     
    13181318    // has to be done in a separate pass.
    13191319    // First we render all occluders into depth, then render all units with
    13201320    // inverted depth test so any behind an occluder will get drawn in a constant
    1321     // colour.
     1321    // color.
    13221322
    13231323    float silhouetteAlpha = 0.75f;
    13241324
     
    13691369    else
    13701370    {
    13711371        // Since we can't sort, we'll use the stencil buffer to ensure we only draw
    1372         // a pixel once (using the colour of whatever model happens to be drawn first).
     1372        // a pixel once (using the color of whatever model happens to be drawn first).
    13731373        glEnable(GL_BLEND);
    13741374        glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
    13751375        pglBlendColorEXT(0, 0, 0, silhouetteAlpha);
  • renderer/SilhouetteRenderer.cpp

     
    5555}
    5656
    5757/*
    58  * Silhouettes are the solid-coloured versions of units that are rendered when
     58 * Silhouettes are the solid-colored versions of units that are rendered when
    5959 * standing behind a building or terrain, so the player won't lose them.
    6060 *
    6161 * The rendering is done in CRenderer::RenderSilhouettes, by rendering the
  • renderer/TerrainOverlay.cpp

     
    180180#endif
    181181}
    182182
    183 void TerrainOverlay::RenderTile(const CColor& colour, bool draw_hidden)
     183void TerrainOverlay::RenderTile(const CColor& color, bool draw_hidden)
    184184{
    185     RenderTile(colour, draw_hidden, m_i, m_j);
     185    RenderTile(color, draw_hidden, m_i, m_j);
    186186}
    187187
    188 void TerrainOverlay::RenderTile(const CColor& colour, bool draw_hidden, ssize_t i, ssize_t j)
     188void TerrainOverlay::RenderTile(const CColor& color, bool draw_hidden, ssize_t i, ssize_t j)
    189189{
    190190    // TODO: if this is unpleasantly slow, make it much more efficient
    191191    // (e.g. buffering data and making a single draw call? or at least
     
    210210
    211211    CVector3D pos;
    212212    glBegin(GL_TRIANGLES);
    213         glColor4fv(colour.FloatArray());
     213        glColor4fv(color.FloatArray());
    214214        if (m_Terrain->GetTriangulationDir(i, j))
    215215        {
    216216            m_Terrain->CalcPosition(i,   j,   pos); glVertex3fv(pos.GetFloatArray());
     
    236236#endif
    237237}
    238238
    239 void TerrainOverlay::RenderTileOutline(const CColor& colour, int line_width, bool draw_hidden)
     239void TerrainOverlay::RenderTileOutline(const CColor& color, int line_width, bool draw_hidden)
    240240{
    241     RenderTileOutline(colour, line_width, draw_hidden, m_i, m_j);
     241    RenderTileOutline(color, line_width, draw_hidden, m_i, m_j);
    242242}
    243243
    244 void TerrainOverlay::RenderTileOutline(const CColor& colour, int line_width, bool draw_hidden, ssize_t i, ssize_t j)
     244void TerrainOverlay::RenderTileOutline(const CColor& color, int line_width, bool draw_hidden, ssize_t i, ssize_t j)
    245245{
    246246    if (draw_hidden)
    247247    {
     
    265265
    266266    CVector3D pos;
    267267    glBegin(GL_QUADS);
    268         glColor4fv(colour.FloatArray());
     268        glColor4fv(color.FloatArray());
    269269        m_Terrain->CalcPosition(i,   j,   pos); glVertex3fv(pos.GetFloatArray());
    270270        m_Terrain->CalcPosition(i+1, j,   pos); glVertex3fv(pos.GetFloatArray());
    271271        m_Terrain->CalcPosition(i+1, j+1, pos); glVertex3fv(pos.GetFloatArray());
  • renderer/TerrainOverlay.h

     
    128128    /**
    129129     * Draw a filled quad on top of the current tile.
    130130     *
    131      * @param colour  colour to draw. May be transparent (alpha &lt; 1)
     131     * @param color  color to draw. May be transparent (alpha &lt; 1)
    132132     * @param draw_hidden  true if hidden tiles (i.e. those behind other tiles)
    133133     * should be drawn
    134134     */
    135     void RenderTile(const CColor& colour, bool draw_hidden);
     135    void RenderTile(const CColor& color, bool draw_hidden);
    136136
    137137    /**
    138138     * Draw a filled quad on top of the given tile.
    139139     */
    140     void RenderTile(const CColor& colour, bool draw_hidden, ssize_t i, ssize_t j);
     140    void RenderTile(const CColor& color, bool draw_hidden, ssize_t i, ssize_t j);
    141141
    142142    /**
    143143     * Draw an outlined quad on top of the current tile.
    144144     *
    145      * @param colour  colour to draw. May be transparent (alpha &lt; 1)
     145     * @param color  color to draw. May be transparent (alpha &lt; 1)
    146146     * @param line_width  width of lines in pixels. 1 is a sensible value
    147147     * @param draw_hidden  true if hidden tiles (i.e. those behind other tiles)
    148148     * should be drawn
    149149     */
    150     void RenderTileOutline(const CColor& colour, int line_width, bool draw_hidden);
     150    void RenderTileOutline(const CColor& color, int line_width, bool draw_hidden);
    151151
    152152    /**
    153153     * Draw an outlined quad on top of the given tile.
    154154     */
    155     void RenderTileOutline(const CColor& colour, int line_width, bool draw_hidden, ssize_t i, ssize_t j);
     155    void RenderTileOutline(const CColor& color, int line_width, bool draw_hidden, ssize_t i, ssize_t j);
    156156   
    157157private:
    158158    // Process all tiles
  • renderer/TerrainRenderer.cpp

     
    281281    const CLightEnv& lightEnv = g_Renderer.GetLightEnv();
    282282
    283283    pglClientActiveTextureARB(GL_TEXTURE0);
    284     glEnableClientState(GL_COLOR_ARRAY); // diffuse lighting colours
     284    glEnableClientState(GL_COLOR_ARRAY); // diffuse lighting colors
    285285
    286286    // The vertex color is scaled by 0.5 to permit overbrightness without clamping.
    287287    // We therefore need to draw clamp((texture*lighting)*2.0), where 'texture'
  • tools/atlas/AtlasUI/ActorEditor/ActorEditorListCtrl.cpp

     
    3030    : DraggableListCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
    3131        wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxLC_SINGLE_SEL)
    3232{
    33     // Set colours for row backgrounds (which vary depending on what columns
     33    // Set colors for row backgrounds (which vary depending on what columns
    3434    // have some data)
    35     #define COLOUR(name, c0, c1) \
    36     m_ListItemAttr_##name[0].SetBackgroundColour(wxColour c0); \
    37     m_ListItemAttr_##name[1].SetBackgroundColour(wxColour c1)
     35    #define COLOR(name, c0, c1) \
     36    m_ListItemAttr_##name[0].SetBackgroundColor(wxColor c0); \
     37    m_ListItemAttr_##name[1].SetBackgroundColor(wxColor c1)
    3838   
    3939    const int f=0xFF, e=0xEE, c=0xCC;
    40     COLOUR(Model,   (f,f,e), (f,f,c));
    41     COLOUR(Texture, (f,e,e), (f,c,c));
    42     COLOUR(Anim,    (e,f,e), (c,f,c));
    43     COLOUR(Prop,    (e,e,f), (c,c,f));
    44     COLOUR(Colour,  (f,e,f), (f,c,f));
    45     COLOUR(None,    (f,f,f), (f,f,f));
     40    COLOR(Model,   (f,f,e), (f,f,c));
     41    COLOR(Texture, (f,e,e), (f,c,c));
     42    COLOR(Anim,    (e,f,e), (c,f,c));
     43    COLOR(Prop,    (e,e,f), (c,c,f));
     44    COLOR(Colour,  (f,e,f), (f,c,f));
     45    COLOR(None,    (f,f,f), (f,f,f));
    4646
    47     #undef COLOUR
     47    #undef COLOR
    4848
    4949    AddColumnType(_("Variant"),     90,  "@name",       new FieldEditCtrl_Text());
    5050    AddColumnType(_("Ratio"),       50,  "@frequency",  new FieldEditCtrl_Text());
     
    5252    AddColumnType(_("Textures"),        250, "textures",    new FieldEditCtrl_Dialog(&TexListEditor::Create));
    5353    AddColumnType(_("Animations"),      250, "animations",  new FieldEditCtrl_Dialog(&AnimListEditor::Create));
    5454    AddColumnType(_("Props"),       220, "props",       new FieldEditCtrl_Dialog(&PropListEditor::Create));
    55     AddColumnType(_("Colour"),      80,  "colour",      new FieldEditCtrl_Colour());
     55    AddColumnType(_("Colour"),      80,  "colour",      new FieldEditCtrl_Color());
    5656}
    5757
    5858void ActorEditorListCtrl::DoImport(AtObj& in)
     
    104104    {
    105105        AtObj row (m_ListData[item]);
    106106
    107         // Colour-code the row, depending on the first non-empty column,
     107        // Color-code the row, depending on the first non-empty column,
    108108        // and also alternate between light/dark.
    109109
    110110        if (row["mesh"].hasContent())
     
    116116        else if (row["props"].hasContent())
    117117            return const_cast<wxListItemAttr*>(&m_ListItemAttr_Prop[item%2]);
    118118        else if (row["colour"].hasContent())
    119             return const_cast<wxListItemAttr*>(&m_ListItemAttr_Colour[item%2]);
     119            return const_cast<wxListItemAttr*>(&m_ListItemAttr_Color[item%2]);
    120120    }
    121121
    122122    return const_cast<wxListItemAttr*>(&m_ListItemAttr_None[item%2]);
  • tools/atlas/AtlasUI/CustomControls/ColorDialog/ColorDialog.cpp

     
    2020#include "wx/regex.h"
    2121#include "wx/config.h"
    2222
    23 #include "ColourDialog.h"
     23#include "ColorDialog.h"
    2424
    25 ColourDialog::ColourDialog(wxWindow* parent, const wxString& customColourConfigPath, const wxColour& defaultColour)
    26 : wxColourDialog(parent), m_ConfigPath(customColourConfigPath)
     25ColorDialog::ColorDialog(wxWindow* parent, const wxString& customColorConfigPath, const wxColour& defaultColor)
     26: wxColourDialog(parent), m_ConfigPath(customColorConfigPath)
    2727{
    28     GetColourData().SetColour(defaultColour);
     28    GetColourData().SetColour(defaultColor);
    2929
    30     // Load custom colours from the config database
     30    // Load custom colors from the config database
    3131
    3232    wxRegEx re (_T("([0-9]+) ([0-9]+) ([0-9]+)"), wxRE_EXTENDED);
    3333
     
    3636    {
    3737        for (int i = 0; i < 16; ++i)
    3838        {
    39             wxString customColour;
    40             if (cfg->Read(wxString::Format(_T("%s%d"), m_ConfigPath.c_str(), i), &customColour)
    41                 && re.Matches(customColour))
     39            wxString customColor;
     40            if (cfg->Read(wxString::Format(_T("%s%d"), m_ConfigPath.c_str(), i), &customColor)
     41                && re.Matches(customColor))
    4242            {
    4343                long r, g, b;
    44                 re.GetMatch(customColour, 1).ToLong(&r);
    45                 re.GetMatch(customColour, 2).ToLong(&g);
    46                 re.GetMatch(customColour, 3).ToLong(&b);
     44                re.GetMatch(customColor, 1).ToLong(&r);
     45                re.GetMatch(customColor, 2).ToLong(&g);
     46                re.GetMatch(customColor, 3).ToLong(&b);
    4747                GetColourData().SetCustomColour(i, wxColour(r, g, b));
    4848            }
    4949        }
     
    5050    }
    5151}
    5252
    53 int ColourDialog::ShowModal()
     53int ColorDialog::ShowModal()
    5454{
    5555    int ret = wxColourDialog::ShowModal();
    5656    if (ret == wxID_OK)
    5757    {
    58         // Save all the custom colours back into the config database
     58        // Save all the custom colors back into the config database
    5959
    6060        wxConfigBase* cfg = wxConfigBase::Get(false);
    6161        if (cfg)
     
    6363            for (int i = 0; i < 16; ++i)
    6464            {
    6565                wxString name = wxString::Format(_T("%s%d"), m_ConfigPath.c_str(), i);
    66                 wxColour colour = GetColourData().GetCustomColour(i);
     66                wxColour color = GetColourData().GetCustomColour(i);
    6767
    68                 wxString customColour = wxString::Format(_T("%d %d %d"), colour.Red(), colour.Green(), colour.Blue());
    69                 cfg->Write(name, customColour);
     68                wxString customColor = wxString::Format(_T("%d %d %d"), color.Red(), color.Green(), color.Blue());
     69                cfg->Write(name, customColor);
    7070            }
    7171        }
    7272    }
  • tools/atlas/AtlasUI/CustomControls/ColorDialog/ColorDialog.h

     
    1515 * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
    1616 */
    1717
    18 #ifndef INCLUDED_COLOURDIALOG
    19 #define INCLUDED_COLOURDIALOG
     18#ifndef INCLUDED_COLORDIALOG
     19#define INCLUDED_COLORDIALOG
    2020
    2121#include <wx/colordlg.h>
    2222
    23 class ColourDialog : public wxColourDialog
     23class ColorDialog : public wxColourDialog
    2424{
    2525public:
    26     // Typical customColourConfigPath would be "Scenario Editor/LightingColour"
    27     ColourDialog(wxWindow* parent, const wxString& customColourConfigPath, const wxColour& defaultColour);
     26    // A typical customColorConfigPath would be "Scenario Editor/LightingColor"
     27    ColorDialog(wxWindow* parent, const wxString& customColorConfigPath, const wxColour& defaultColor);
    2828
    2929    int ShowModal();
    3030
     
    3232    wxString m_ConfigPath;
    3333};
    3434
    35 #endif // INCLUDED_COLOURDIALOG
     35#endif // INCLUDED_COLORDIALOG
  • tools/atlas/AtlasUI/CustomControls/ColourDialog/ColourDialog.cpp

     
    1 /* Copyright (C) 2009 Wildfire Games.
    2  * This file is part of 0 A.D.
    3  *
    4  * 0 A.D. is free software: you can redistribute it and/or modify
    5  * it under the terms of the GNU General Public License as published by
    6  * the Free Software Foundation, either version 2 of the License, or
    7  * (at your option) any later version.
    8  *
    9  * 0 A.D. is distributed in the hope that it will be useful,
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12  * GNU General Public License for more details.
    13  *
    14  * You should have received a copy of the GNU General Public License
    15  * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
    16  */
    17 
    18 #include "precompiled.h"
    19 
    20 #include "wx/regex.h"
    21 #include "wx/config.h"
    22 
    23 #include "ColourDialog.h"
    24 
    25 ColourDialog::ColourDialog(wxWindow* parent, const wxString& customColourConfigPath, const wxColour& defaultColour)
    26 : wxColourDialog(parent), m_ConfigPath(customColourConfigPath)
    27 {
    28     GetColourData().SetColour(defaultColour);
    29 
    30     // Load custom colours from the config database
    31 
    32     wxRegEx re (_T("([0-9]+) ([0-9]+) ([0-9]+)"), wxRE_EXTENDED);
    33 
    34     wxConfigBase* cfg = wxConfigBase::Get(false);
    35     if (cfg)
    36     {
    37         for (int i = 0; i < 16; ++i)
    38         {
    39             wxString customColour;
    40             if (cfg->Read(wxString::Format(_T("%s%d"), m_ConfigPath.c_str(), i), &customColour)
    41                 && re.Matches(customColour))
    42             {
    43                 long r, g, b;
    44                 re.GetMatch(customColour, 1).ToLong(&r);
    45                 re.GetMatch(customColour, 2).ToLong(&g);
    46                 re.GetMatch(customColour, 3).ToLong(&b);
    47                 GetColourData().SetCustomColour(i, wxColour(r, g, b));
    48             }
    49         }
    50     }
    51 }
    52 
    53 int ColourDialog::ShowModal()
    54 {
    55     int ret = wxColourDialog::ShowModal();
    56     if (ret == wxID_OK)
    57     {
    58         // Save all the custom colours back into the config database
    59 
    60         wxConfigBase* cfg = wxConfigBase::Get(false);
    61         if (cfg)
    62         {
    63             for (int i = 0; i < 16; ++i)
    64             {
    65                 wxString name = wxString::Format(_T("%s%d"), m_ConfigPath.c_str(), i);
    66                 wxColour colour = GetColourData().GetCustomColour(i);
    67 
    68                 wxString customColour = wxString::Format(_T("%d %d %d"), colour.Red(), colour.Green(), colour.Blue());
    69                 cfg->Write(name, customColour);
    70             }
    71         }
    72     }
    73 
    74     return ret;
    75 }
  • tools/atlas/AtlasUI/CustomControls/ColourDialog/ColourDialog.h

     
    1 /* Copyright (C) 2009 Wildfire Games.
    2  * This file is part of 0 A.D.
    3  *
    4  * 0 A.D. is free software: you can redistribute it and/or modify
    5  * it under the terms of the GNU General Public License as published by
    6  * the Free Software Foundation, either version 2 of the License, or
    7  * (at your option) any later version.
    8  *
    9  * 0 A.D. is distributed in the hope that it will be useful,
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12  * GNU General Public License for more details.
    13  *
    14  * You should have received a copy of the GNU General Public License
    15  * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
    16  */
    17 
    18 #ifndef INCLUDED_COLOURDIALOG
    19 #define INCLUDED_COLOURDIALOG
    20 
    21 #include <wx/colordlg.h>
    22 
    23 class ColourDialog : public wxColourDialog
    24 {
    25 public:
    26     // Typical customColourConfigPath would be "Scenario Editor/LightingColour"
    27     ColourDialog(wxWindow* parent, const wxString& customColourConfigPath, const wxColour& defaultColour);
    28 
    29     int ShowModal();
    30 
    31 private:
    32     wxString m_ConfigPath;
    33 };
    34 
    35 #endif // INCLUDED_COLOURDIALOG
  • tools/atlas/AtlasUI/CustomControls/EditableListCtrl/EditableListCtrl.cpp

     
    3737                                   const wxString& name)
    3838    : wxListCtrl(parent, id, pos, size, style | wxLC_VIRTUAL, validator, name)
    3939{
    40     m_ListItemAttr[0].SetBackgroundColour(wxColour(0xff, 0xff, 0xff));
    41     m_ListItemAttr[1].SetBackgroundColour(wxColour(0xee, 0xee, 0xee));
     40    m_ListItemAttr[0].SetBackgroundColor(wxColor(0xff, 0xff, 0xff));
     41    m_ListItemAttr[1].SetBackgroundColor(wxColor(0xee, 0xee, 0xee));
    4242
    4343    wxASSERT_MSG(style & wxLC_REPORT, _T("EditableListCtrl must be LC_REPORT"));
    4444    UpdateDisplay();
     
    277277    if (item >= (long)m_ListData.size())
    278278        return const_cast<wxListItemAttr*>(&m_ListItemAttr[0]);
    279279
    280     // Make the background colours of rows alternate
     280    // Make the background colors of rows alternate
    281281    else
    282282        return const_cast<wxListItemAttr*>(&m_ListItemAttr[item%2]);
    283283}
  • tools/atlas/AtlasUI/CustomControls/EditableListCtrl/EditableListCtrl.h

     
    108108
    109109    bool IsRowBlank(int n);
    110110
    111     wxListItemAttr m_ListItemAttr[2]; // standard+alternate colours
     111    wxListItemAttr m_ListItemAttr[2]; // standard+alternate colors
    112112
    113113    DECLARE_EVENT_TABLE();
    114114};
  • tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/Environment.cpp

     
    157157    void OnClick(wxCommandEvent& WXUNUSED(evt))
    158158    {
    159159        ColourDialog dlg (this, _T("Scenario Editor/LightingColour"),
    160             wxColour(m_Colour->r, m_Colour->g, m_Colour->b));
     160            wxColor(m_Color->r, m_Color->g, m_Color->b));
    161161
    162162        if (dlg.ShowModal() == wxID_OK)
    163163        {
    164             wxColour& c = dlg.GetColourData().GetColour();
    165             m_Colour = AtlasMessage::Colour(c.Red(), c.Green(), c.Blue());
     164            wxColor& c = dlg.GetColourData().GetColour();
     165            m_Color = AtlasMessage::Color(c.Red(), c.Green(), c.Blue());
    166166            UpdateButton();
    167167
    168168            g_EnvironmentSettings.NotifyObserversExcept(m_Conn);
     
    171171
    172172    void UpdateButton()
    173173    {
    174         m_Button->SetBackgroundColour(wxColour(m_Colour->r, m_Colour->g, m_Colour->b));
     174        m_Button->SetBackgroundColor(wxColor(m_Color->r, m_Color->g, m_Color->b));
    175175        m_Button->SetLabel(wxString::Format(_T("%02X %02X %02X"), m_Colour->r, m_Colour->g, m_Colour->b));
    176176
    177177        int y = 3*m_Colour->r + 6*m_Colour->g + 1*m_Colour->b;
  • tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp

     
    3333    ID_PlayerMetal,
    3434    ID_PlayerStone,
    3535    ID_PlayerPop,
    36     ID_PlayerColour,
     36    ID_PlayerColor,
    3737
    3838    ID_DefaultName,
    3939    ID_DefaultCiv,
    40     ID_DefaultColour,
     40    ID_DefaultColor,
    4141    ID_DefaultAI,
    4242    ID_DefaultFood,
    4343    ID_DefaultWood,
     
    130130            gridSizer->Add(civChoice, wxSizerFlags(1).Expand().Align(wxALIGN_RIGHT));
    131131            m_Controls.civ = civChoice;
    132132
    133             wxButton* colourButton = new wxButton(this, ID_PlayerColour);
    134             gridSizer->Add(new DefaultCheckbox(this, ID_DefaultColour, colourButton), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
     133            wxButton* colorButton = new wxButton(this, ID_PlayerColor);
     134            gridSizer->Add(new DefaultCheckbox(this, ID_DefaultColor, colorButton), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
    135135            gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Colour")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    136             gridSizer->Add(Tooltipped(colourButton,
     136            gridSizer->Add(Tooltipped(colorButton,
    137137                _("Set player colour")), wxSizerFlags(1).Expand().Align(wxALIGN_RIGHT));
    138             m_Controls.colour = colourButton;
     138            m_Controls.color = colorButton;
    139139
    140140            wxChoice* aiChoice = new wxChoice(this, wxID_ANY);
    141141            gridSizer->Add(new DefaultCheckbox(this, ID_DefaultAI, aiChoice), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
  • tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.h

     
    5454
    5555    wxTextCtrl* name;
    5656    wxChoice* civ;
    57     wxButton* colour;
     57    wxButton* color;
    5858    wxSpinCtrl* food;
    5959    wxSpinCtrl* wood;
    6060    wxSpinCtrl* stone;
  • tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/Terrain.cpp

     
    326326    {
    327327        m_ScrolledPanel = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
    328328        m_ScrolledPanel->SetScrollRate(0, 10);
    329         m_ScrolledPanel->SetBackgroundColour(wxColour(255, 255, 255));
     329        m_ScrolledPanel->SetBackgroundColor(wxColor(255, 255, 255));
    330330
    331331        wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
    332332        sizer->Add(m_ScrolledPanel, wxSizerFlags().Proportion(1).Expand());
     
    418418        g_SelectedTexture.NotifyObservers();
    419419
    420420        if (m_LastTerrainSelection)
    421             m_LastTerrainSelection->SetBackgroundColour(wxNullColour);
     421            m_LastTerrainSelection->SetBackgroundColor(wxNullColor);
    422422
    423         button->SetBackgroundColour(wxColour(255, 255, 0));
     423        button->SetBackgroundColor(wxColor(255, 255, 0));
    424424        m_LastTerrainSelection = button;
    425425
    426426        // Slight hack: Default to Paint mode because that's probably what the user wanted
     
    449449    wxString m_Name;
    450450    wxScrolledWindow* m_ScrolledPanel;
    451451    wxGridSizer* m_ItemSizer;
    452     wxButton* m_LastTerrainSelection; // button that was last selected, so we can undo its colouring
     452    wxButton* m_LastTerrainSelection; // button that was last selected, so we can undo its coloring
    453453
    454454    DECLARE_EVENT_TABLE();
    455455};
  • tools/atlas/GameInterface/ActorViewer.cpp

     
    440440    m.CurrentUnitAnim = animation;
    441441}
    442442
    443 void ActorViewer::SetBackgroundColour(const SColor4ub& colour)
     443void ActorViewer::SetBackgroundColor(const SColor4ub& color)
    444444{
    445     m.Background = colour;
    446     m.Terrain.SetBaseColour(colour);
     445    m.Background = color;
     446    m.Terrain.SetBaseColor(color);
    447447}
    448448
    449449void ActorViewer::SetWalkEnabled(bool enabled)    { m.WalkEnabled = enabled; }
  • tools/atlas/GameInterface/ActorViewer.h

     
    3737    entity_id_t GetEntity();
    3838    void SetActor(const CStrW& id, const CStrW& animation, player_id_t playerID);
    3939    void UnloadObjects();
    40     void SetBackgroundColour(const SColor4ub& colour);
     40    void SetBackgroundColor(const SColor4ub& color);
    4141    void SetWalkEnabled(bool enabled);
    4242    void SetGroundEnabled(bool enabled);
    4343    void SetWaterEnabled(bool enabled);
  • tools/atlas/GameInterface/Brushes.cpp

     
    5656    {
    5757        ssize_t i0, j0;
    5858        m_Brush->GetBottomLeft(i0, j0);
    59         // Colour this tile based on the average of the surrounding vertices
     59        // Color this tile based on the average of the surrounding vertices
    6060        float avg = (
    6161            m_Brush->Get(i-i0, j-j0)   + m_Brush->Get(i-i0+1, j-j0) +
    6262            m_Brush->Get(i-i0, j-j0+1) + m_Brush->Get(i-i0+1, j-j0+1)
  • tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp

     
    4949    s.watermurkiness = wm->m_Murkiness;
    5050    s.windangle = wm->m_WindAngle;
    5151
    52     // CColor colours
    53 #define COLOUR(A, B) A = Colour((int)(B.r*255), (int)(B.g*255), (int)(B.b*255))
    54     COLOUR(s.watercolour, wm->m_WaterColor);
    55     COLOUR(s.watertint, wm->m_WaterTint);
    56 #undef COLOUR
     52    // CColor colors
     53#define COLOR(A, B) A = Color((int)(B.r*255), (int)(B.g*255), (int)(B.b*255))
     54    COLOR(s.watercolor, wm->m_WaterColor);
     55    COLOR(s.watertint, wm->m_WaterTint);
     56#undef COLOR
    5757
    5858    float sunrotation = g_LightEnv.GetRotation();
    5959    if (sunrotation > (float)M_PI)
     
    7373    s.saturation = g_LightEnv.m_Saturation;
    7474    s.bloom = g_LightEnv.m_Bloom;
    7575
    76     // RGBColor (CVector3D) colours
    77 #define COLOUR(A, B) A = Colour((int)(B.X*255), (int)(B.Y*255), (int)(B.Z*255))
     76    // RGBColor (CVector3D) colors
     77#define COLOR(A, B) A = Color((int)(B.X*255), (int)(B.Y*255), (int)(B.Z*255))
    7878    s.sunoverbrightness = MaxComponent(g_LightEnv.m_SunColor);
    7979    // clamp color to [0..1] before packing into u8 triplet
    8080    if(s.sunoverbrightness > 1.0f)
     
    8282    // no component was above 1.0, so reset scale factor (don't want to darken)
    8383    else
    8484        s.sunoverbrightness = 1.0f;
    85     COLOUR(s.suncolour, g_LightEnv.m_SunColor);
    86     COLOUR(s.terraincolour, g_LightEnv.m_TerrainAmbientColor);
    87     COLOUR(s.unitcolour, g_LightEnv.m_UnitsAmbientColor);
    88     COLOUR(s.fogcolour, g_LightEnv.m_FogColor);
    89 #undef COLOUR
     85    COLOR(s.suncolor, g_LightEnv.m_SunColor);
     86    COLOR(s.terraincolor, g_LightEnv.m_TerrainAmbientColor);
     87    COLOR(s.unitcolor, g_LightEnv.m_UnitsAmbientColor);
     88    COLOR(s.fogcolor, g_LightEnv.m_FogColor);
     89#undef COLOR
    9090
    9191    return s;
    9292}
     
    104104    wm->m_WindAngle = s.windangle;
    105105    wm->m_WaterType = s.watertype._Unwrap();
    106106   
    107 #define COLOUR(A, B) B = CColor(A->r/255.f, A->g/255.f, A->b/255.f, 1.f)
    108     COLOUR(s.watercolour, wm->m_WaterColor);
    109     COLOUR(s.watertint, wm->m_WaterTint);
    110 #undef COLOUR
     107#define COLOR(A, B) B = CColor(A->r/255.f, A->g/255.f, A->b/255.f, 1.f)
     108    COLOR(s.watercolor, wm->m_WaterColor);
     109    COLOR(s.watertint, wm->m_WaterTint);
     110#undef COLOR
    111111
    112112    g_LightEnv.SetRotation(s.sunrotation);
    113113    g_LightEnv.SetElevation(s.sunelevation);
     
    130130    g_LightEnv.m_Saturation = s.saturation;
    131131    g_LightEnv.m_Bloom = s.bloom;
    132132
    133 #define COLOUR(A, B) B = RGBColor(A->r/255.f, A->g/255.f, A->b/255.f)
    134     COLOUR(s.suncolour, g_LightEnv.m_SunColor);
     133#define COLOR(A, B) B = RGBColor(A->r/255.f, A->g/255.f, A->b/255.f)
     134    COLOR(s.suncolor, g_LightEnv.m_SunColor);
    135135    g_LightEnv.m_SunColor *= s.sunoverbrightness;
    136     COLOUR(s.terraincolour, g_LightEnv.m_TerrainAmbientColor);
    137     COLOUR(s.unitcolour, g_LightEnv.m_UnitsAmbientColor);
    138     COLOUR(s.fogcolour, g_LightEnv.m_FogColor);
    139 #undef COLOUR
     136    COLOR(s.terraincolor, g_LightEnv.m_TerrainAmbientColor);
     137    COLOR(s.unitcolor, g_LightEnv.m_UnitsAmbientColor);
     138    COLOR(s.fogcolor, g_LightEnv.m_FogColor);
     139#undef COLOR
    140140}
    141141
    142142BEGIN_COMMAND(SetEnvironmentSettings)
  • tools/atlas/GameInterface/Handlers/MapHandlers.cpp

     
    231231        {
    232232            int offset = y * mapLineSkip + x * bytesPP;
    233233           
    234             // pick colour channel with highest value
     234            // pick color channel with highest value
    235235            u16 value = std::max(mapdata[offset+bytesPP*2], std::max(mapdata[offset], mapdata[offset+bytesPP]));
    236236           
    237237            heightmap[(terrainSize-y-1) * hmSize + x] = clamp(value * 256, 0, 65535);
  • tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp

     
    101101// Helper function to find color of player owning the given entity,
    102102//  returns white if entity has no owner. Uses caching to avoid
    103103//  expensive script calls.
    104 static CColor GetOwnerPlayerColor(PlayerColorMap& colourMap, entity_id_t id)
     104static CColor GetOwnerPlayerColor(PlayerColorMap& colorMap, entity_id_t id)
    105105{
    106106    // Default color - white
    107107    CColor color(1.0f, 1.0f, 1.0f, 1.0f);
     
    111111    if (cmpOwnership)
    112112    {
    113113        player_id_t owner = cmpOwnership->GetOwner();
    114         if (colourMap.find(owner) != colourMap.end())
    115             return colourMap[owner];
     114        if (colorMap.find(owner) != colorMap.end())
     115            return colorMap[owner];
    116116        else
    117117        {
    118118            CmpPtr<ICmpPlayerManager> cmpPlayerManager(sim, SYSTEM_ENTITY);
     
    119119            entity_id_t playerEnt = cmpPlayerManager->GetPlayerByID(owner);
    120120            CmpPtr<ICmpPlayer> cmpPlayer(sim, playerEnt);
    121121            if (cmpPlayer)
    122                 color = colourMap[owner] = cmpPlayer->GetColour();
     122                color = colorMap[owner] = cmpPlayer->GetColor();
    123123        }
    124124    }
    125125    return color;
     
    129129{
    130130    CSimulation2& sim = *g_Game->GetSimulation2();
    131131
    132     // Cache player colours for performance
     132    // Cache player colors for performance
    133133    PlayerColorMap playerColors;
    134134
    135135    // Clear old selection rings
  • tools/atlas/GameInterface/Messages.h

     
    6060MESSAGE(SetViewParamC,
    6161        ((int, view)) // eRenderView
    6262        ((std::wstring, name))
    63         ((Colour, value))
     63        ((Color, value))
    6464        );
    6565MESSAGE(SetViewParamS,
    6666        ((int, view)) // eRenderView
     
    442442    Shareable<float> watermurkiness; // range ???
    443443    Shareable<float> windangle;
    444444
    445     Shareable<Colour> watercolour;
    446     Shareable<Colour> watertint;
     445    Shareable<Color> watercolor;
     446    Shareable<Color> watertint;
    447447
    448448    Shareable<float> sunrotation; // range -pi..+pi
    449449    Shareable<float> sunelevation; // range -pi/2 .. +pi/2
    450450
    451     // emulate 'HDR' by allowing overly bright suncolour. this is
    452     // multiplied on to suncolour after converting to float
    453     // (struct Colour stores as normal u8, 0..255)
     451    // emulate 'HDR' by allowing overly bright suncolor. this is
     452    // multiplied on to suncolor after converting to float
     453    // (struct Color stores as normal u8, 0..255)
    454454    Shareable<float> sunoverbrightness; // range 1..3
    455455
    456456    // support different lighting models ("old" for the version compatible with old scenarios,
     
    459459
    460460    Shareable<std::wstring> skyset;
    461461
    462     Shareable<Colour> suncolour;
    463     Shareable<Colour> terraincolour;
    464     Shareable<Colour> unitcolour;
    465     Shareable<Colour> fogcolour;
     462    Shareable<Color> suncolor;
     463    Shareable<Color> terraincolor;
     464    Shareable<Color> unitcolor;
     465    Shareable<Color> fogcolor;
    466466   
    467467    Shareable<float> fogfactor;
    468468    Shareable<float> fogmax;
  • tools/atlas/GameInterface/SharedTypes.h

     
    6666SHAREABLE_STRUCT(Position);
    6767
    6868
    69 struct Colour
     69struct Color
    7070{
    71     Colour()
     71    Color()
    7272        : r(255), g(0), b(255)
    7373    {
    7474    }
    7575
    76     Colour(unsigned char r, unsigned char g, unsigned char b)
     76    Color(unsigned char r, unsigned char g, unsigned char b)
    7777        : r(r), g(g), b(b)
    7878    {
    7979    }
     
    8080
    8181    unsigned char r, g, b;
    8282};
    83 SHAREABLE_STRUCT(Colour);
     83SHAREABLE_STRUCT(Color);
    8484
    8585
    8686typedef unsigned int ObjectID;
  • tools/atlas/GameInterface/View.cpp

     
    5151{
    5252}
    5353
    54 void AtlasView::SetParam(const std::wstring& UNUSED(name), const AtlasMessage::Colour& UNUSED(value))
     54void AtlasView::SetParam(const std::wstring& UNUSED(name), const AtlasMessage::Color& UNUSED(value))
    5555{
    5656}
    5757
     
    151151        m_ActorViewer->SetPropPointsMode(value);
    152152}
    153153
    154 void AtlasViewActor::SetParam(const std::wstring& name, const AtlasMessage::Colour& value)
     154void AtlasViewActor::SetParam(const std::wstring& name, const AtlasMessage::Color& value)
    155155{
    156156    if (name == L"background")
    157157    {
    158         m_ActorViewer->SetBackgroundColour(SColor4ub(value.r, value.g, value.b, 255));
     158        m_ActorViewer->SetBackgroundColor(SColor4ub(value.r, value.g, value.b, 255));
    159159    }
    160160}
    161161
  • tools/atlas/GameInterface/View.h

     
    4848
    4949    virtual void SetParam(const std::wstring& name, bool value);
    5050    virtual void SetParam(const std::wstring& name, int value);
    51     virtual void SetParam(const std::wstring& name, const AtlasMessage::Colour& value);
     51    virtual void SetParam(const std::wstring& name, const AtlasMessage::Color& value);
    5252    virtual void SetParam(const std::wstring& name, const std::wstring& value);
    5353
    5454    // These always return a valid (not NULL) object
     
    139139
    140140    virtual void SetParam(const std::wstring& name, bool value);
    141141    virtual void SetParam(const std::wstring& name, int value);
    142     virtual void SetParam(const std::wstring& name, const AtlasMessage::Colour& value);
     142    virtual void SetParam(const std::wstring& name, const AtlasMessage::Color& value);
    143143
    144144    void SetSpeedMultiplier(float speedMultiplier);
    145145    ActorViewer& GetActorViewer();