本文整理汇总了C++中menu类的典型用法代码示例。如果您正苦于以下问题:C++ menu类的具体用法?C++ menu怎么用?C++ menu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了menu类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: switch
void menu::style::draw_row_bg(menu& menu_ref, const size_t /*row_index*/, const SDL_Rect& rect, ROW_TYPE type)
{
menu_ref.bg_restore(rect);
int rgb = 0;
double alpha = 0.0;
switch(type) {
case NORMAL_ROW:
rgb = normal_rgb_;
alpha = normal_alpha_;
break;
case SELECTED_ROW:
rgb = selected_rgb_;
alpha = selected_alpha_;
break;
case HEADING_ROW:
rgb = heading_rgb_;
alpha = heading_alpha_;
break;
}
draw_solid_tinted_rectangle(rect.x, rect.y, rect.w, rect.h,
(rgb&0xff0000) >> 16,(rgb&0xff00) >> 8,rgb&0xff,alpha,
menu_ref.video().getSurface());
}
开发者ID:oys0317,项目名称:opensanguo,代码行数:26,代码来源:menu.cpp
示例2: begin
void begin(menu& m)
{
ClearDrawScreen();
const unsigned int x=0;
const unsigned int y=195;
const unsigned int Green=GetColor(0,255,0);
unsigned int counter=0;
m.load_max_v();
DrawFormatString(520,450,GetColor(255,255,255),"Loading ...");
for(unsigned int count_down=3;
!ScreenFlip()&&!ProcessMessage()&&!ClearDrawScreen()&&count_down>0;
--count_down){
m.effectiving();
DrawStringToHandle(x+260,y,boost::lexical_cast<std::string>(count_down).c_str(),
Green,m.font_Handle[1]);
std::this_thread::sleep_for(std::chrono::seconds(1));
}
std::this_thread::sleep_for(std::chrono::seconds(1));
std::chrono::system_clock::time_point start=std::chrono::system_clock::now();
while(!ScreenFlip()&&!ProcessMessage()&&!ClearDrawScreen()){
m.effectiving();
DrawStringToHandle(x+100,y,"残り",Green,m.font_Handle[0]);
DrawStringToHandle(x+235,y,boost::lexical_cast<std::string>(m.max_v-counter).c_str(),
Green,m.font_Handle[1]);
DrawStringToHandle(x,0,
(std::string("回数: ")+=boost::lexical_cast<std::string>(m.max_v)).c_str(),
Green,m.font_Handle[2]);
DrawStringToHandle(x,45,
(std::string("現在: ")+=boost::lexical_cast<std::string>(counter)).c_str(),
Green,m.font_Handle[2]);
DrawStringToHandle(x,90,
(std::string("時間: ")+=boost::lexical_cast<std::string>(
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()-start).count()
)).c_str(),
Green,m.font_Handle[2]);
DrawStringToHandle(x,135,"Q: 中止",Green,m.font_Handle[2]);
count(counter);
if(counter==m.max_v)break;
if(CheckHitKey(KEY_INPUT_Q))break;
}
Rank(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now()-start),m);
}
开发者ID:falgon,项目名称:Udetate,代码行数:49,代码来源:start.cpp
示例3: autoRestore
void autoRestore(menu m)
{
//This still needs user input.
for(unsigned i = 0; i < m.getSize(); i++)
{
FS_Archive saveArch;
if(m.optSelected(i) && openSaveArch(&saveArch, sdTitle[i], false))
restoreData(sdTitle[i], saveArch, MODE_SAVE);
FSUSER_CloseArchive(&saveArch);
FS_Archive extArch;
if(m.optSelected(i) && openExtdata(&extArch, sdTitle[i], false))
restoreData(sdTitle[i], extArch, MODE_EXTDATA);
FSUSER_CloseArchive(&extArch);
}
}
开发者ID:Shadowtrance,项目名称:JKSM,代码行数:16,代码来源:auto.cpp
示例4: autoBackup
void autoBackup(menu m)
{
showMessage("This can take a few minutes depending on how many titles are selected.");
progressBar autoDump((float)m.getSelectCount(), "Copying saves...");
//Keep track of what's done
float dumpCount = 0;
for(unsigned i = 0; i < m.getSize(); i++)
{
//This is for titles with no save archive ex. Fantasy Life
bool dumped = false;
FS_Archive saveArch;
if(m.optSelected(i) && openSaveArch(&saveArch, sdTitle[i], false))//if it's selected and we can open save archive
{
createTitleDir(sdTitle[i], MODE_SAVE);
backupData(sdTitle[i], saveArch, MODE_SAVE, true);
dumpCount++;
dumped = true;
}
FSUSER_CloseArchive(&saveArch);
FS_Archive extArch;
if(m.optSelected(i) && openExtdata(&extArch, sdTitle[i], false))
{
createTitleDir(sdTitle[i], MODE_EXTDATA);
backupData(sdTitle[i], extArch, MODE_EXTDATA, true);
//check first to make sure we don't count it twice because no save arch
if(!dumped)
dumpCount++;
}
FSUSER_CloseArchive(&extArch);
sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);
autoDump.draw(i);
sf2d_end_frame();
sf2d_swapbuffers();
}
showMessage("Complete!");
}
开发者ID:Shadowtrance,项目名称:JKSM,代码行数:42,代码来源:auto.cpp
示例5: main
int main(int argc, char** argv)
{
glutInit(&argc,argv);
glutInitWindowPosition(0,0);
glutInitWindowSize(800,600);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA);
glutCreateWindow("PewPew");
//glEnable(GL_LIGHTING);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
//glShadeModel(GL_SMOOTH);
//glEnable(GL_LIGHT0);
glMatrixMode(GL_PROJECTION);
open_joystick();
mn.add_option(std::string("INFO"),(&info_action));
mn.add_option(std::string("PLAY"),(&run));
mn.add_option(std::string("NEW GAME"),(&new_game));
mn.add_option(std::string("OPTIONS"),(&option_action));
mn.add_option(std::string("QUIT"),(&end_0));
menu_pages.push(&mn);
opt.add_option(std::string("BACK"),(&back));
opt.add_option(std::string("SCORES"),(&scores_action));
opt.add_option(std::string("SOUNDS ON"),(&sound_off),std::string("SOUNDS OFF"),(&sound_on));
scores.add_option(std::string("BACK"), (&back));
info.add_option(std::string("BACK"),(&back));
//GLfloat filter[11] = {0.3,0.28,0.26,0.24,0.22,0.20,0.22,0.24,0.26,0.28,0.3}; //GOOD
//glSeparableFilter2D(GL_SEPARABLE_2D, GL_LUMINANCE, 11, 11, GL_LUMINANCE, GL_FLOAT, filter,filter); //<< segfault !!!
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
glutReshapeFunc(reshape);
glutDisplayFunc(display);
//glutIdleFunc(mytimer);
glutTimerFunc(20,mytimer,1);
glutIgnoreKeyRepeat(1);
glutKeyboardUpFunc(kbRelF);
glutSpecialFunc(skbF);
glutKeyboardFunc(kbF);
glutPassiveMotionFunc(mIdleF);
glutMouseFunc(mF);
glutMainLoop();
return 0;
}
开发者ID:mastergreg,项目名称:pewpew,代码行数:52,代码来源:pewpew.cpp
示例6: init_speedo
void init_speedo(void) {
Millis.init();
Serial.init(USART1, 115200L);
Serial.init(USART2, 115200L);
Serial.init(USART3, 115200L);
Serial.puts_ln(USART1, "=== Speedoino ===");
Serial.puts(USART1, GIT_REV); // print Software release
Serial.puts(USART1, " HW:");
Serial.puts_ln(USART1, Config.get_hw_version()); // print Hardware release
// first, set all variables to a zero value
Sensors.init();
Speedo.clear_vars(); // refresh cycle
// read configuration file from sd card
SD.init(); // try open SD Card
SD.open();
Config.read(CONFIG_FOLDER, "BASE.TXT", READ_MODE_CONFIGFILE, ""); // load base config
Config.read(CONFIG_FOLDER, "SPEEDO.TXT", READ_MODE_CONFIGFILE, ""); // speedovalues, avg,max,time
Config.read(CONFIG_FOLDER, "GANG.TXT", READ_MODE_CONFIGFILE, ""); // gang
Config.read(CONFIG_FOLDER, "TEMPER.TXT", READ_MODE_CONFIGFILE, ""); // Temperatur
Config.read_skin(); // skinning
// check if read SD read was okay, if not: load your default backup values
Aktors.check_vars(); // check if color of outer LED are OK
Sensors.check_vars(); // check if config read was successful
Speedo.check_vars(); // rettet das Skinning wenn SD_failed von den sensoren auf true gesetzt wird
Sensors.single_read(); // read all sensor values once to ensure we are ready to show them
Aktors.init(); // Start outer LEDs // ausschlag des zeigers // Motorausschlag und block bis motor voll ausgeschlagen, solange das letzte intro bild halten
TFT.init();
// SD.prefetched_animation(37); // 37
Menu.init(); // Start butons // adds the connection between pins and vars
Menu.display(); // execute this AFTER pOLED.init_speedo!! this will show the menu and, if state==11, draws speedosymbols
Speedo.reset_bak(); // reset all storages, to force the redraw of the speedo
Config.ram_info();
Serial.puts_ln(USART1, "=== Setup finished ===");
}
开发者ID:KoljaWindeler,项目名称:speedoino,代码行数:39,代码来源:main.cpp
示例7: Setting
void Setting(menu& m)
{
unsigned int Green=GetColor(255,255,255);
int max_f=-1;
m.effectiving();
DrawStringToHandle(0,145,"測定回数設定:",Green,m.font_Handle[2]);
max_f=KeyInputNumber(0,200,640,0,false);
std::ofstream ofs("data/max_v.dat");
if(!ofs.is_open())assert(0);
ofs<<max_f;
ofs.close();
}
开发者ID:falgon,项目名称:Udetate,代码行数:15,代码来源:start.cpp
示例8: draw_row_bg
void menu::style::draw_row(menu& menu_ref, const size_t row_index, const SDL_Rect& rect, ROW_TYPE type)
{
if(rect.w == 0 || rect.h == 0) {
return;
}
draw_row_bg(menu_ref, row_index, rect, type);
SDL_Rect minirect = rect;
if(type != HEADING_ROW) {
minirect.x += thickness_;
minirect.y += thickness_;
minirect.w -= 2*thickness_;
minirect.h -= 2*thickness_;
}
menu_ref.draw_row(row_index, minirect, type);
}
开发者ID:oys0317,项目名称:opensanguo,代码行数:16,代码来源:menu.cpp
示例9: scale_surface
void menu::imgsel_style::draw_row_bg(menu& menu_ref, const size_t row_index, const SDL_Rect& rect, ROW_TYPE type)
{
if(type == SELECTED_ROW && has_background_ && !load_failed_) {
if(bg_cache_.width != rect.w || bg_cache_.height != rect.h)
{
//draw scaled background image
//scale image each time (to prevent loss of quality)
bg_cache_.surf = scale_surface(img_map_["background"], rect.w, rect.h);
bg_cache_.width = rect.w;
bg_cache_.height = rect.h;
}
SDL_Rect clip = rect;
menu_ref.video().blit_surface(rect.x,rect.y,bg_cache_.surf,nullptr,&clip);
}
else {
style::draw_row_bg(menu_ref, row_index, rect, type);
}
}
开发者ID:fluffbeast,项目名称:wesnoth-old,代码行数:18,代码来源:menu_style.cpp
示例10: while
void menu::imgsel_style::draw_row(menu& menu_ref, const size_t row_index, const SDL_Rect& rect, ROW_TYPE type)
{
if(!load_failed_) {
//draw item inside
style::draw_row(menu_ref, row_index, rect, type);
if(type == SELECTED_ROW) {
// draw border
surface image;
SDL_Rect area;
SDL_Rect clip = rect;
area.x = rect.x;
area.y = rect.y;
image = img_map_["border-top"];
area.x = rect.x;
area.y = rect.y;
do {
menu_ref.video().blit_surface(area.x,area.y,image,nullptr,&clip);
area.x += image->w;
} while( area.x < rect.x + rect.w );
image = img_map_["border-left"];
area.x = rect.x;
area.y = rect.y;
do {
menu_ref.video().blit_surface(area.x,area.y,image,nullptr,&clip);
area.y += image->h;
} while( area.y < rect.y + rect.h );
image = img_map_["border-right"];
area.x = rect.x + rect.w - thickness_;
area.y = rect.y;
do {
menu_ref.video().blit_surface(area.x,area.y,image,nullptr,&clip);
area.y += image->h;
} while( area.y < rect.y + rect.h );
image = img_map_["border-bottom"];
area.x = rect.x;
area.y = rect.y + rect.h - thickness_;
do {
menu_ref.video().blit_surface(area.x,area.y,image,nullptr,&clip);
area.x += image->w;
} while( area.x < rect.x + rect.w );
image = img_map_["border-topleft"];
area.x = rect.x;
area.y = rect.y;
menu_ref.video().blit_surface(area.x,area.y,image);
image = img_map_["border-topright"];
area.x = rect.x + rect.w - image->w;
area.y = rect.y;
menu_ref.video().blit_surface(area.x,area.y,image);
image = img_map_["border-botleft"];
area.x = rect.x;
area.y = rect.y + rect.h - image->h;
menu_ref.video().blit_surface(area.x,area.y,image);
image = img_map_["border-botright"];
area.x = rect.x + rect.w - image->w;
area.y = rect.y + rect.h - image->h;
menu_ref.video().blit_surface(area.x,area.y,image);
}
}
else {
//default drawing
style::draw_row(menu_ref, row_index, rect, type);
}
}
开发者ID:fluffbeast,项目名称:wesnoth-old,代码行数:72,代码来源:menu_style.cpp
示例11: main
int main(void) {
SystemInit(); // Quarz Einstellungen aktivieren
init_speedo();
// SD.prefetched_animation(37); // 37
// Speedo.initial_draw_screen(); // draw symbols
/******************** setup procedure ********************************************
* all initialisations must been made before the main loop, before THIS
******************** setup procedure ********************************************/
unsigned long previousMillis = 0;
#ifdef LOAD_CALC
unsigned long load_calc=0;
unsigned long lasttime_calc=0;
#endif
for (;;) {
Sensors.mCAN.check_message();
//////////////////////////////////////////////////
// Sensors.m_reset->set_deactive(false,false);
// Serial3.end();
// Serial3.begin(115200);
// while(true){
// while(Serial3.available()>0){
// Serial.print(Serial3.read(),BYTE);
// }
// while(Serial.available()>0){
// Serial3.print(Serial.read(),BYTE);
// }
// }
//////////////////////////////////////////////////
Sensors.mReset.toggle(); // toggle pin, if we don't toggle it, the ATmega8 will reset us, kind of watchdog<
Debug.speedo_loop(21, 1, 0, " "); // intensive debug= EVERY loop access reports the Menustate
Sensors.mGPS.check_flag(); // check if a GPS sentence is ready
// pAktors.check_flag(); // updated expander
Sensors.pull_values(); // very important, updates all the sensor values
/************************* timer *********************/
Timer.every_sec(); // 1000 ms
Timer.every_qsec(); // 250 ms
Timer.every_custom(); // one custom timer, redrawing the speedo, time is defined by "refresh_cycle" in the base.txt
/************************* push buttons *********************
* using true as argument, this will activate bluetooth input as well
************************* push buttons*********************/
//Menu.button_test(true,false); // important!! if we have a pushed button we will draw something, depending on the menustate
if (Menu.button_test(true, false)) { // important!! if we have a pushed button we will draw something, depending on the menustate
Serial.puts(USART1, "Menustate:");
Serial.puts_ln(USART1, Menu.state);
}
/************************ every deamon activity is clear, now draw speedo ********************
* we are round about 0000[1]1 - 0000[1]9
************************ every deamon activity is clear, now draw speedo ********************/
Sensors.mCAN.check_message();
if ((Menu.state / 10) == 1 || Menu.state == 7311111) {
Speedo.loop(previousMillis);
}
//////////////////// Sprint Speedo ///////////////////
else if (Menu.state == MENU_SPRINT * 10 + 1) {
Sprint.loop();
}
////////////////// Clock Mode ////////////////////////
else if (Menu.state == 291) {
Sensors.mClock.loop();
}
////////////////// Speed Cam Check - Mode ////////////////////////
else if (Menu.state
== BMP(0, 0, 0, 0, M_TOUR_ASSISTS,
SM_TOUR_ASSISTS_SPEEDCAM_STATUS, 1)) {
// SpeedCams.calc();
// SpeedCams.interface();
}
////////////////// race mode ////////////////////
else if (Menu.state == M_LAP_T * 100 + 11) {
LapTimer.waiting_on_speed_up();
} else if (Menu.state == M_LAP_T * 1000 + 111) {
LapTimer.race_loop();
}
////////////////// set gps point ////////////////////
else if (Menu.state == M_LAP_T * 10000L + 3111) {
LapTimer.gps_capture_loop();
}
//////////////////// voltage mode ///////////////////
else if (Menu.state == 531) {
Sensors.addinfo_show_loop();
}
//////////////////// stepper mode ///////////////////
else if (Menu.state == 541) {
// Aktors.mStepper.loop();
}
//////////////////// gps scan ///////////////////
else if (Menu.state == 511) {
Sensors.mGPS.loop();
}
//////////////////// outline scan ///////////////////
else if (Menu.state == 721) {
Sensors.mSpeed.check_umfang();
}
////////////////// gear scan ///////////////
else if (floor(Menu.state / 100) == 71) {
Sensors.mGear.calibrate();
//.........这里部分代码省略.........
开发者ID:KoljaWindeler,项目名称:speedoino,代码行数:101,代码来源:main.cpp
示例12: display
void display(void)
{
if (!ingame )
{
Menu.drawMenu();
}
else
{
//movements handling
playerMovement();//player collisons handled inside this function
enemyMovement();
//player drawing
glPushAttrib(GL_CURRENT_BIT);//keeps players color from changing
glColor4f(0.0, 1.0, 0.0,1.0);
drawPlayer();
//enemy drawing
for (int x=0; x<enemy_size; x++)
drawEnemy(enemy[x].getPosition().x, enemy[x].getPosition().y,enemy[x].getRadius());
}
glutSwapBuffers();//swap bufferes!!!! Important for animation
// glFlush();
}
开发者ID:rellena,项目名称:GERMSV1.0,代码行数:27,代码来源:GLfuncs.cpp
示例13: update
//Update() is where the magic happens,
//It Draws everything to the screen
void update(vector<character> *objects)
{
drawRect(0, 0, camera.size.x, camera.size.y, 0,150,0);
//drawRect(loc.x, loc.y, size.x, size.y, r, g, b);
SDL_Rect square;
//SDL_Rect* clip = NULL;
for(unsigned int i = 0; i < objects->size(); i++)
{
if(collide(camera, objects->at(i)))
{
//dim size = objects->at(i).size;;
dim loc = objects->at(i).loc;
loc.x-=camera.loc.x;
loc.y-=camera.loc.y;
square.x = loc.x;
square.y = loc.y;
int index = 0;
if (objects->at(i).type == green)
index = 1;
if (objects->at(i).type == blue)
index = 3;
if (objects->at(i).type == purple)
index = 5;
if (objects->at(i).selected)
index--;
if (objects->at(i).type == red)
index = 6;
if (objects->at(i).type == rock)
index = 7;
if (objects->at(i).type == rock2)
index = 8;
SDL_BlitSurface(images[index], NULL, mainframe, &square);
}
}
if (dragBox.on && (dragBox.size.x <= camera.size.x && dragBox.size.y <= camera.size.y))
drawRect(dragBox.loc.x, dragBox.loc.y, dragBox.size.x, dragBox.size.y, 0, 255, 255);
drawRect(bottomMenu.getLoc().x, bottomMenu.getLoc().y, bottomMenu.getSize().x, bottomMenu.getSize().y, 100, 100, 100);
SDL_Flip(mainframe);
return;
}
开发者ID:micahh2,项目名称:Time-Travel,代码行数:47,代码来源:game.cpp
示例14: moveCamera
void moveCamera(dim move)
{
while(camera.loc.x+camera.size.x>currentMap->length-move.x)
move.x--;
while(camera.loc.y+camera.size.y>currentMap->length-move.y+bottomMenu.getSize().y)
move.y--;
while(camera.loc.x+move.x<0)
move.x++;
while(camera.loc.y+move.y<0)
move.y++;
camera.loc.x += move.x;
camera.loc.y += move.y;
}
开发者ID:micahh2,项目名称:Time-Travel,代码行数:14,代码来源:game.cpp
注:本文中的menu类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论