本文整理汇总了C++中COLOR函数的典型用法代码示例。如果您正苦于以下问题:C++ COLOR函数的具体用法?C++ COLOR怎么用?C++ COLOR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COLOR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Paint
void Devildog::Paint(MATRIX3X2 matView)
{
int width = m_BmpDevildogPtr->GetWidth()/6;
int height = m_BmpDevildogPtr->GetHeight()/4;
RECT clip;
clip.left = width * m_MoveTick;
clip.right = clip.left + width;
clip.top = height * m_StartLine;
clip.bottom = clip.top + height;
MATRIX3X2 matDirection, matPos;
if(m_Direction == 1) matPos.SetAsTranslate(m_Pos);
else matPos.SetAsTranslate(m_Pos.x + width, m_Pos.y);
matDirection.SetAsScale(m_Direction,1);
GAME_ENGINE->SetTransformMatrix(matDirection * matPos * matView);
GAME_ENGINE->DrawBitmap(m_BmpDevildogPtr,0,0,clip);
GAME_ENGINE->SetColor(COLOR(255,0,0,125));
}
示例2: session_get_line
void session_get_line(t_client *client)
{
char *conf;
if (!client->session->conf.file)
{
if (file_exists(client->session->host))
conf = client->session->host;
else
conf = "default";
client->session->conf.file = fopen(conf, "r");
VERBOSE(printf("\033[%d;1m<%03d> - conf : %s\033[m\n",
COLOR(client->session->id), client->session->id, conf));
}
if (!fgets(client->session->conf.line, BUF_SIZE, client->session->conf.file))
{
fclose(client->session->conf.file);
client->session->conf.file = 0;
session_get_line(client);
}
else if (client->session->conf.line[strlen(client->session->conf.line) - 1]
== '\n')
client->session->conf.line[strlen(client->session->conf.line) - 1] = 0;
}
示例3: f
/*
y = f(x) + g(x);
*/
// === EXCEPTION 1 =============================================================
// Macros is not bad for concatenation and stringification
enum Color { Color_Red, Color_Green, Color_Blue };
static const struct {
enum Color color;
const char *name;
} colors[] = {
#define COLOR(color) { Color_ ## color, #color }
COLOR(Red), COLOR(Green), COLOR(Blue)
};
// === EXCEPTION 2 =============================================================
// Macros is not bad for yield a compile-time constants
#define ADD_M(a, b) ((a) + (b))
static inline int add_f(int a, int b) {
return a + b;
}
/* === OTHER EXCEPTIONS ========================================================
* Macros is not bad for:
*
* 3. implement type-generic functions
示例4: c_str
//.........这里部分代码省略.........
case mnemocode::fnstcw : return "fnstcw";
case mnemocode::fldcw : return "fldcw";
case mnemocode::fclex : return "fclex";
case mnemocode::fnclex : return "fnclex";
case mnemocode::fsave : return "fsave";
case mnemocode::fnsave : return "fnsave";
case mnemocode::frstor : return "frstor";
case mnemocode::fstenv : return "fstenv";
case mnemocode::fnstenv : return "fnstenv";
case mnemocode::fldenv : return "fldenv";
case mnemocode::ffree : return "ffree";
case mnemocode::ffreep : return "ffreep";
case mnemocode::fdecstp : return "fdecstp";
case mnemocode::fincstp : return "fincstp";
case mnemocode::fld : return "fld";
case mnemocode::fst : return "fst";
case mnemocode::fstp : return "fstp";
case mnemocode::fxch : return "fxch";
case mnemocode::fcmovb : return "fcmovb";
case mnemocode::fcmove : return "fcmove";
case mnemocode::fcmovbe : return "fcmovbe";
case mnemocode::fcmovu : return "fcmovu";
case mnemocode::fcmovnb : return "fcmovnb";
case mnemocode::fcmovne : return "fcmovne";
case mnemocode::fcmovnbe : return "fcmovnbe";
case mnemocode::fcmovnu : return "fcmovnu";
case mnemocode::fldz : return "fldz";
case mnemocode::fld1 : return "fld1";
case mnemocode::fldpi : return "fldpi";
case mnemocode::fldl2e : return "fldl2e";
case mnemocode::fldl2t : return "fldl2t";
case mnemocode::fldlg2 : return "fldlg2";
case mnemocode::fldln2 : return "fldln2";
case mnemocode::fild : return "fild";
case mnemocode::fist : return "fist";
case mnemocode::fistp : return "fistp";
case mnemocode::fisttp : return "fisttp";
case mnemocode::fbld : return "fbld";
case mnemocode::fbstp : return "fbstp";
case mnemocode::fcom : return "fcom";
case mnemocode::fcomi : return "fcomi";
case mnemocode::fcomip : return "fcomip";
case mnemocode::fcomp : return "fcomp";
case mnemocode::fcompp : return "fcompp";
case mnemocode::ficom : return "ficom";
case mnemocode::ficomp : return "ficomp";
case mnemocode::ftst : return "ftst";
case mnemocode::fucom : return "fucom";
case mnemocode::fucomi : return "fucomi";
case mnemocode::fucomip : return "fucomip";
case mnemocode::fucomp : return "fucomp";
case mnemocode::fucompp : return "fucompp";
case mnemocode::fxam : return "fxam";
case mnemocode::fabs : return "fabs";
case mnemocode::fadd : return "fadd";
case mnemocode::faddp : return "faddp";
case mnemocode::fchs : return "fchs";
case mnemocode::fdiv : return "fdiv";
case mnemocode::fdivp : return "fdivp";
case mnemocode::fdivr : return "fdivr";
case mnemocode::fdivrp : return "fdivrp";
case mnemocode::fmul : return "fmul";
case mnemocode::fmulp : return "fmulp";
case mnemocode::frndint : return "frndint";
case mnemocode::fsqrt : return "fsqrt";
case mnemocode::fsub : return "fsub";
case mnemocode::fsubp : return "fsubp";
case mnemocode::fsubr : return "fsubr";
case mnemocode::fsubrp : return "fsubrp";
case mnemocode::fiadd : return "fiadd";
case mnemocode::fidiv : return "fidiv";
case mnemocode::fidivr : return "fidivr";
case mnemocode::fimul : return "fimul";
case mnemocode::fisub : return "fisub";
case mnemocode::fisubr : return "fisubr";
case mnemocode::fcos : return "fcos";
case mnemocode::fpatan : return "fpatan";
case mnemocode::fptan : return "fptan";
case mnemocode::fsin : return "fsin";
case mnemocode::fsincos : return "fsincos";
case mnemocode::f2xm1 : return "f2xm1";
case mnemocode::fscale : return "fscale";
case mnemocode::fyl2x : return "fyl2x";
case mnemocode::fyl2xp1 : return "fyl2xp1";
case mnemocode::fnop : return "fnop";
case mnemocode::fprem : return "fprem";
case mnemocode::fprem1 : return "fprem1";
case mnemocode::fxtract : return "fxtract";
case mnemocode::trunc : return "trunc";
case mnemocode::sp_inc : return COLOR(3, "sp_inc");
case mnemocode::sp_dec : return COLOR(3, "sp_dec");
case mnemocode::bra : return COLOR(2, "bra" );
case mnemocode::ket : return COLOR(2, "ket" );
case mnemocode::endl : return COLOR(4, "endl" );
case mnemocode::alloca_ : return COLOR(7, "alloca");
case mnemocode::call : return COLOR(1, "call" );
case mnemocode::ret : return COLOR(1, "ret" );
case mnemocode::sahf : return "sahf";
}
}
示例5: grey
inline COLOR grey(double g) { return COLOR(g,g,g); }
示例6: color_ub
//! \brief create a COLOR from unsigned bytes r, g, b
inline COLOR color_ub(unsigned char r, unsigned char g, unsigned char b) {
return COLOR(r/255.0, g/255.0, b/255.0);
}
示例7: get_var_color
// Given a Config variable name and a default COLOR value,
// return the corresponding COLOR if the variable is defined,
// otherwise return the default value:
inline CCOLOR get_var_color(const string& var_name, CCOLOR& default_val) {
string col_str = Config::get_var_str(var_name, color_to_str(default_val));
double r, g, b;
sscanf(col_str.c_str(), "%lf%lf%lf", &r, &g, &b);
return COLOR(r,g,b);
}
示例8:
CAMERA::CAMERA(void){
color=COLOR(0,0,0,0);
min=0.001f,max=1000,fovh=angle2rad(60),fovv=angle2rad(60.0f*0.75f);
}
示例9: main
void main() {
while (1) {
COLOR(RND());
draw_circle(RND() & 0xff, RND() & 0xff, (RND() & 0x1f) + 16);
}
}
示例10: _tnl_Color4fv
static void
_tnl_Color4fv( const GLfloat *v )
{
GET_IMMEDIATE;
COLOR( IM, v[0], v[1], v[2], v[3] );
}
示例11: _tnl_Color4f
static void
_tnl_Color4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
{
GET_IMMEDIATE;
COLOR( IM, red, green, blue, alpha );
}
示例12: _tnl_Color3f
static void
_tnl_Color3f( GLfloat red, GLfloat green, GLfloat blue )
{
GET_IMMEDIATE;
COLOR( IM, red, green, blue, 1.0 );
}
示例13: config_string_cb
//.........这里部分代码省略.........
case '1':
config.modifier = Mod1Mask;
return 1;
case '2':
config.modifier = Mod2Mask;
return 1;
case '3':
config.modifier = Mod3Mask;
return 1;
/*
case '4':
config.modifier = Mod4Mask;
return 1;
*/
case '5':
config.modifier = Mod5Mask;
return 1;
}
}
config.modifier = Mod4Mask;
return 1;
}
if (!strcmp(cur_key, "wheel_up_cmd")) {
DLOG("wheel_up_cmd = %.*s\n", len, val);
FREE(config.wheel_up_cmd);
sasprintf(&config.wheel_up_cmd, "%.*s", len, val);
return 1;
}
if (!strcmp(cur_key, "wheel_down_cmd")) {
DLOG("wheel_down_cmd = %.*s\n", len, val);
FREE(config.wheel_down_cmd);
sasprintf(&config.wheel_down_cmd, "%.*s", len, val);
return 1;
}
if (!strcmp(cur_key, "position")) {
DLOG("position = %.*s\n", len, val);
config.position = (len == 3 && !strncmp((const char *)val, "top", strlen("top")) ? POS_TOP : POS_BOT);
return 1;
}
if (!strcmp(cur_key, "status_command")) {
DLOG("command = %.*s\n", len, val);
sasprintf(&config.command, "%.*s", len, val);
return 1;
}
if (!strcmp(cur_key, "font")) {
DLOG("font = %.*s\n", len, val);
sasprintf(&config.fontname, "%.*s", len, val);
return 1;
}
if (!strcmp(cur_key, "outputs")) {
DLOG("+output %.*s\n", len, val);
int new_num_outputs = config.num_outputs + 1;
config.outputs = srealloc(config.outputs, sizeof(char *) * new_num_outputs);
sasprintf(&config.outputs[config.num_outputs], "%.*s", len, val);
config.num_outputs = new_num_outputs;
return 1;
}
if (!strcmp(cur_key, "tray_output")) {
DLOG("tray_output %.*s\n", len, val);
FREE(config.tray_output);
sasprintf(&config.tray_output, "%.*s", len, val);
return 1;
}
#define COLOR(json_name, struct_name) \
do { \
if (!strcmp(cur_key, #json_name)) { \
DLOG(#json_name " = " #struct_name " = %.*s\n", len, val); \
sasprintf(&(config.colors.struct_name), "%.*s", len, val); \
return 1; \
} \
} while (0)
COLOR(statusline, bar_fg);
COLOR(background, bar_bg);
COLOR(separator, sep_fg);
COLOR(focused_workspace_border, focus_ws_border);
COLOR(focused_workspace_bg, focus_ws_bg);
COLOR(focused_workspace_text, focus_ws_fg);
COLOR(active_workspace_border, active_ws_border);
COLOR(active_workspace_bg, active_ws_bg);
COLOR(active_workspace_text, active_ws_fg);
COLOR(inactive_workspace_border, inactive_ws_border);
COLOR(inactive_workspace_bg, inactive_ws_bg);
COLOR(inactive_workspace_text, inactive_ws_fg);
COLOR(urgent_workspace_border, urgent_ws_border);
COLOR(urgent_workspace_bg, urgent_ws_bg);
COLOR(urgent_workspace_text, urgent_ws_fg);
printf("got unexpected string %.*s for cur_key = %s\n", len, val, cur_key);
return 0;
}
示例14: switch
//------------------------------------------------------------------------------
// ゲームの初期化
//------------------------------------------------------------------------------
// 引数
// なし
// 戻り値
// なし
//------------------------------------------------------------------------------
void CGame::Init(void)
{
gamePhase = PHASE_3;
gamePhaseCnt = 0;
gameEndCount = 0;
CSoundAL::Play(CSoundAL::BGM_GAME);
//地形生成
Ground = nullptr;
Ground = CMeshGround::Create(VECTOR3(0.0f,0.0f,0.0f),VECTOR2(FIELD_PANEL_SIZE,FIELD_PANEL_SIZE),VECTOR2(0,0),1.5f);
Ground->SetTex(CTexture::Texture(TEX_FIELD));
// 空生成
Sky = nullptr;
Sky = CMeshSphere::Create(VECTOR3(0.0f,0.0f,0.0f),VECTOR2(16.0f,8.0f),RADIUS_SKY);
Sky->SetTex(CTexture::Texture(TEX_SKY));
// 境界線生成
CylinderArea = nullptr;
CylinderArea = CBattleAreaCylinder::Create(VECTOR3(0.0f,0.0f,0.0f),HEIGHT_WALL,VECTOR2(64.0f,1.0f),RADIUS_AREA_BATTLE,VECTOR2(1,-0.5f));
CylinderArea->SetTex(CTexture::Texture(TEX_WALL));
CylinderArea->SetAlpha(0.5f);
Player = new CPlayer*[PLAYER_MAX];
// プレイヤー生成
for (int i = 0; i < PLAYER_MAX; i++)
{
if (i % 2 == 1)
Player[i] = CPlayer::Create(CModel::RINCHAN,PLAYER_POSITION_LIST[i],i);
else
Player[i] = CPlayer::Create(CModel::YOUJO,PLAYER_POSITION_LIST[i],i);
Player[i]->SetTex(CTexture::Texture(TEX_YOUJO_RED + i));
Player[i]->SetDestRot(PLAYER_ROTATION_LIST[i]);
Player[i]->SetRot(PLAYER_ROTATION_LIST[i]);
Player[i]->setBarrelTex(TEX_YOUJO_RED + i);
if (i == CManager::netData.charNum)
{
Player[i]->SetPlayerFlag(true);
Player[i]->CreateBallistic();
}
}
//プレイヤーカメラ生成
CPlayerCamera::Create(Player[CManager::netData.charNum],35.0f);
// 【テスト】各プレイヤーの色をセット
for(int i = 0; i < PLAYER_MAX; i++)
{
switch(i)
{
// 赤
case 0:
Player[i]->SetPlayerColor(RED(0.5f));
break;
// 青
case 1:
Player[i]->SetPlayerColor(BLUE(0.5f));
break;
// 水
case 2:
Player[i]->SetPlayerColor(CYAN(0.5f));
break;
// 橙
case 3:
Player[i]->SetPlayerColor(COLOR(1.0f, 0.7f, 0.0f, 0.5f));
break;
// 白
case 4:
Player[i]->SetPlayerColor(WHITE(0.5f));
break;
// P
case 5:
Player[i]->SetPlayerColor(YELLOW(0.5f));
break;
default:
break;
}
}
// プレイヤーの入力を止める
for (int i = 0; i < PLAYER_MAX; i++){
Player[i]->SetInputFlag(false);
}
//.........这里部分代码省略.........
示例15: InitMenu
void InitMenu()
{
/* Reset variables */
TabIndex = TAB_ABOUT;
Background = NULL;
/* Initialize paths */
sprintf(SaveStatePath, "%ssavedata/", pl_psp_get_app_directory());
sprintf(ScreenshotPath, "%sscreenshot/", pl_psp_get_app_directory());
sprintf(GamePath, "%s", pl_psp_get_app_directory());
if (!pl_file_exists(SaveStatePath))
pl_file_mkdir_recursive(SaveStatePath);
/* Initialize options */
LoadOptions();
InitEmulator();
/* Load the background image */
pl_file_path background;
snprintf(background, sizeof(background) - 1, "%sbackground.png",
pl_psp_get_app_directory());
Background = pspImageLoadPng(background);
//Background = pspImageLoadPng("background.png");
/* Init NoSaveState icon image */
NoSaveIcon = pspImageCreate(136, 114, PSP_IMAGE_16BPP);
pspImageClear(NoSaveIcon, RGB(0x0c,0,0x3f));
/* Initialize state menu */
int i;
pl_menu_item *item;
for (i = 0; i < 10; i++)
{
item = pl_menu_append_item(&SaveStateGallery.Menu, i, NULL);
pl_menu_set_item_help_text(item, EmptySlotText);
}
/* Initialize menus */
pl_menu_create(&SystemUiMenu.Menu, SystemMenuDef);
pl_menu_create(&OptionUiMenu.Menu, OptionMenuDef);
pl_menu_create(&ControlUiMenu.Menu, ControlMenuDef);
/* Load default configuration */
LoadButtonConfig();
/* Initialize UI components */
UiMetric.Background = Background;
UiMetric.Font = &PspStockFont;
UiMetric.Left = 16;
UiMetric.Top = 48;
UiMetric.Right = 944;
UiMetric.Bottom = 500;
UiMetric.OkButton = (!Options.ControlMode) ? PSP_CTRL_CROSS : PSP_CTRL_CIRCLE;
UiMetric.CancelButton = (!Options.ControlMode) ? PSP_CTRL_CIRCLE : PSP_CTRL_CROSS;
UiMetric.ScrollbarColor = PSP_COLOR_GRAY;
UiMetric.ScrollbarBgColor = 0x44ffffff;
UiMetric.ScrollbarWidth = 10;
UiMetric.TextColor = PSP_COLOR_GRAY;
UiMetric.SelectedColor = PSP_COLOR_YELLOW;
UiMetric.SelectedBgColor = COLOR(0xff,0xff,0xff,0x44);
UiMetric.StatusBarColor = PSP_COLOR_WHITE;
UiMetric.BrowserFileColor = PSP_COLOR_GRAY;
UiMetric.BrowserDirectoryColor = PSP_COLOR_YELLOW;
UiMetric.GalleryIconsPerRow = 5;
UiMetric.GalleryIconMarginWidth = 8;
UiMetric.MenuItemMargin = 20;
UiMetric.MenuSelOptionBg = PSP_COLOR_BLACK;
UiMetric.MenuOptionBoxColor = PSP_COLOR_GRAY;
UiMetric.MenuOptionBoxBg = COLOR(0, 0, 33, 0xBB);
UiMetric.MenuDecorColor = PSP_COLOR_YELLOW;
UiMetric.DialogFogColor = COLOR(0, 0, 0, 88);
UiMetric.TitlePadding = 4;
UiMetric.TitleColor = PSP_COLOR_WHITE;
UiMetric.MenuFps = 30;
UiMetric.TabBgColor = COLOR(0x74,0x74,0xbe,0xff);
UiMetric.BrowserScreenshotPath = ScreenshotPath;
UiMetric.BrowserScreenshotDelay = 30;
}