OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4StartupPlrSelDlg.cpp File Reference
#include "C4Include.h"
#include <utility>
#include "gui/C4StartupPlrSelDlg.h"
#include "gui/C4StartupMainDlg.h"
#include "lib/C4Random.h"
#include "game/C4Game.h"
#include "c4group/C4Language.h"
#include "gui/C4FileSelDlg.h"
#include "lib/C4Log.h"
#include "graphics/C4GraphicsResource.h"
#include "graphics/C4Draw.h"
#include "player/C4RankSystem.h"
#include "gui/C4MouseControl.h"
#include "lib/StdColors.h"
#include <cctype>
#include <algorithm>
Include dependency graph for C4StartupPlrSelDlg.cpp:

Go to the source code of this file.

Classes

struct  C4StartupPlrSelDlg_CrewSortDataEntry
 
class  C4StartupPlrSelDlg_CrewSortDataMatchType
 
class  C4StartupPlrColorPickerDlg
 

Typedefs

typedef std::vector
< C4StartupPlrSelDlg_CrewSortDataEntry
C4StartupPlrSelDlg_CrewSortData
 

Functions

StdStrBuf TimeString (int iSeconds)
 
StdStrBuf DateString (int iTime)
 
bool IsColorConflict (DWORD dwClr1, DWORD dwClr2)
 

Variables

const uint32_t ClrPlayerItem = 0xffffffff
 
const uint32_t PlayerColorValueLowBound = 64
 

Typedef Documentation

Function Documentation

StdStrBuf DateString ( int  iTime)

Definition at line 56 of file C4StartupPlrSelDlg.cpp.

References FormatString().

Referenced by C4StartupPlrSelDlg::PlayerListItem::SetSelectionInfo().

57 {
58  if (!iTime) return StdStrBuf("", true);
59  time_t tTime = iTime;
60  struct tm *pLocalTime;
61  pLocalTime=localtime(&tTime);
62  return FormatString( "%02d.%02d.%d %02d:%02d",
63  pLocalTime->tm_mday,
64  pLocalTime->tm_mon+1,
65  pLocalTime->tm_year+1900,
66  pLocalTime->tm_hour,
67  pLocalTime->tm_min);
68 }
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:277

Here is the call graph for this function:

Here is the caller graph for this function:

bool IsColorConflict ( DWORD  dwClr1,
DWORD  dwClr2 
)

Definition at line 40 of file C4PlayerInfoConflicts.cpp.

References RGB2rgb(), rgb2xyY(), and xy2upvp().

41 {
42  // NEW COLOR CONFLICT METHOD: u'v'-distance
43  int R1 = 0xff & (dwClr1 >> 16);
44  int G1 = 0xff & (dwClr1 >> 8);
45  int B1 = 0xff & (dwClr1 );
46  int R2 = 0xff & (dwClr2 >> 16);
47  int G2 = 0xff & (dwClr2 >> 8);
48  int B2 = 0xff & (dwClr2 );
49  double r1=0,g1=0,b1=0,r2=0,g2=0,b2=0,x1=0,y1=0,Y1=0,x2=0,y2=0,Y2=0,u1=0,v1=0,u2=0,v2=0;
50  RGB2rgb(R1, G1, B1, &r1, &g1, &b1);
51  RGB2rgb(R2, G2, B2, &r2, &g2, &b2);
52  rgb2xyY(r1, g1, b1, &x1, &y1, &Y1);
53  rgb2xyY(r2, g2, b2, &x2, &y2, &Y2);
54  xy2upvp(x1, y1, &u1, &v1);
55  xy2upvp(x2, y2, &u2, &v2);
56  double Y = (Y1+Y2)/2.0;
57  double clrdiff = sqrt((u2-u1)*(u2-u1) + (v2-v1)*(v2-v1)) * Y*Y * 150;
58  double lumdiff = (Abs<double>(Y2-Y1) / std::max<double>(Y*Y*5, 0.5)) / 0.10;
59  return clrdiff + lumdiff < 1.0;
60 }
bool xy2upvp(double x, double y, double *pu, double *pv)
Definition: StdColors.h:166
bool rgb2xyY(double r, double g, double b, double *px, double *py, double *pY)
Definition: StdColors.h:148
bool RGB2rgb(int R, int G, int B, double *pr, double *pg, double *pb, double gamma=2.2)
Definition: StdColors.h:175

Here is the call graph for this function:

StdStrBuf TimeString ( int  iSeconds)

Definition at line 49 of file C4StartupPlrSelDlg.cpp.

References FormatString().

Referenced by C4StartupPlrSelDlg::PlayerListItem::GetDelWarning(), and C4StartupPlrSelDlg::PlayerListItem::SetSelectionInfo().

50 {
51  int iHours = iSeconds / 3600; iSeconds -= 3600*iHours;
52  int iMinutes = iSeconds / 60; iSeconds -= 60*iMinutes;
53  return FormatString("%02d:%02d:%02d",iHours,iMinutes,iSeconds);
54 }
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:277

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const uint32_t ClrPlayerItem = 0xffffffff
const uint32_t PlayerColorValueLowBound = 64

Definition at line 45 of file C4StartupPlrSelDlg.cpp.