void AGOSEngine_Feeble::oracleTextDown() { Subroutine *sub; int i = 0; changeWindow(3); _noOracleScroll = 0; if (_textWindow->scrollY > _oracleMaxScrollY) // For scroll up _oracleMaxScrollY = _textWindow->scrollY; while (1) { if (_textWindow->scrollY == 0) break; for (i = 0; i < 5; i++) { _newLines = 0; _textWindow->textColumn = 0; _textWindow->textRow = (i + 1) * 3; if (i == 4) { _textWindow->scrollY -= 1; _textWindow->textRow = 0; linksDown(); } scrollOracleDown(); setBitFlag(93, true); sub = getSubroutineByID(_variableArray[104]); if (sub) startSubroutineEx(sub); setBitFlag(93, false); } if (_currentBoxNum != 600 || !getBitFlag(89)) break; delay(100); } }
Menu::Menu(QWidget *parent) : QWidget(parent), ui(new Ui::Menu) { ui->setupUi(this); connect(ui->newGameButton, &QPushButton::clicked, this, [this]{ emit changeWindow(1); emit startGame(); }); connect(ui->controlsButton, &QPushButton::clicked, this, [this]{ emit changeWindow(2); }); connect(ui->exitButton, &QPushButton::clicked, this, [this]{ emit exitGame(); }); }
void MemberExpiration::render_main(zr_window *window) { zr_context context; zr_context layout; zr_begin(&context, window); { zr_header(&context, "Get member expiration", 0, 0, ZR_HEADER_LEFT); zr_layout_row_dynamic(&context, 30, 1); zr_label(&context, "Please select a month:", ZR_TEXT_LEFT); zr_label(&context, "Months:", ZR_TEXT_LEFT); zr_layout_row_dynamic(&context, 30, 3); zr_combo_begin(&context, &layout, patch::to_string(months[selected]).c_str(), &active); { zr_layout_row_dynamic(&layout, 25, 3); for (int i = 0; i < size; ++i) { if (selected == i) continue; if (zr_combo_item(&layout, ZR_TEXT_LEFT, patch::to_string(months[i]).c_str())) { selected = i; } } } zr_combo_end(&context, &layout, &active); for(int i = 0; i < *num_members; i++) { if(members[i]->expiration_date.month == (selected + 1)) { zr_layout_row_dynamic(&context, 30, 2); zr_label(&context, ("Member Name: " + members[i]->name).c_str(), ZR_TEXT_LEFT); if(members[i]->member_type == 1) zr_label(&context, "Renewal Cost: $111.00", ZR_TEXT_LEFT); else zr_label(&context, "Renewal Cost: $55.00", ZR_TEXT_LEFT); } } zr_layout_row_static(&context, 30, 240, 6); if (zr_button_text(&context, "Back", ZR_BUTTON_DEFAULT)) { changeWindow(MAIN);} } zr_end(&context, window); }
//---------------------------------------------------------------------------------- Gnuplot::Gnuplot() : mGnuPipe(NULL), mTerminal("X11"), mStyle("lines"), mCurrentWindowNumber(0), mMaxCommandSize(4096) { const std::string fileName = readFileName(); if (fileExists(fileName)==false) { std::cout << "\nGnuplot location was not found" << "\nTherefore, change the line in 'GnuplotLocation.txt" << "\nto your Gnuplot location.\n"; exit(1); } mGnuPipe = popen((fileName+" -persist").c_str(),"w"); if (mGnuPipe==NULL) assert(!"Couldn't open connection to gnuplot"); setLineStyles(); addWindow(); changeWindow(0); }
static int filter(const SDL_Event *event) { switch (event->type) { case SDL_KEYDOWN: switch (event->key.keysym.sym) { case SDLK_F5: savestates_job |= SAVESTATE; break; case SDLK_F7: savestates_job |= LOADSTATE; break; case SDLK_ESCAPE: stop_it(); break; case SDLK_F1: changeWindow(); break; default: keyDown(0, event->key.keysym.sym); } return 0; break; case SDL_KEYUP: switch (event->key.keysym.sym) { case SDLK_ESCAPE: break; case SDLK_F1: break; default: keyUp(0, event->key.keysym.sym); } return 0; break; default: return 1; } }
void AddItem::render_main(zr_window *window){ zr_context context; zr_context layout; zr_begin(&context, window); { if(state == 0) { zr_header(&context, "Add and Delete Item", 0, 0, ZR_HEADER_LEFT); zr_layout_row_static(&context, 30, 240, 3); if (zr_button_text(&context, "Add Item", ZR_BUTTON_DEFAULT)) { state = 1; fail = 0; } if (zr_button_text(&context, "Delete Item", ZR_BUTTON_DEFAULT)) { state = 2; fail = 0; } for (int i = 0; i < 12; i++) zr_layout_row_static(&context, 30, 240, 1); zr_layout_row_static(&context, 30, 240, 6); if (zr_button_text(&context, "Back", ZR_BUTTON_DEFAULT)) { changeWindow(MAIN);} } else if(state == 1) { zr_header(&context, "Add Item", 0, 0, ZR_HEADER_LEFT); zr_layout_row_dynamic(&context, 30, 1); if (fail == 1) zr_label(&context, "Error! Item name is empty", ZR_TEXT_LEFT); if (fail == 2) zr_label(&context, "Error! Dollar is empty (is it empty? does it contain regular characters?)", ZR_TEXT_LEFT); if (fail == 3) zr_label(&context, "Error! Cents is empty", ZR_TEXT_LEFT); if (fail == 5) zr_label(&context, "Error! Cents is longer then two characters", ZR_TEXT_LEFT); if (fail == 4) zr_label(&context, "Created Item successfully!", ZR_TEXT_LEFT); zr_layout_row_dynamic(&context, 30, 1); zr_label(&context, "Please input the necessary data to create an item:", ZR_TEXT_LEFT); zr_layout_row_static(&context, 30, 240, 3); zr_label(&context, "Item Name:", ZR_TEXT_LEFT); zr_editbox(&context, eb[ITEM]); zr_layout_row_static(&context, 30, 240, 3); zr_label(&context, "Dollars:", ZR_TEXT_LEFT); zr_editbox(&context, eb[DOLLAR]); zr_layout_row_static(&context, 30, 240, 3); zr_label(&context, "Cents:", ZR_TEXT_LEFT); zr_editbox(&context, eb[CENTS]); for (int i = 0; i < 8; i++) zr_layout_row_static(&context, 30, 240, 1); zr_layout_row_static(&context, 30, 240, 6); if (zr_button_text(&context, "Submit", ZR_BUTTON_DEFAULT)) { if (eb[ITEM]->glyphes == 0) fail = 1; else if (eb[DOLLAR]->glyphes == 0) fail = 2; else if (eb[CENTS]->glyphes == 0) fail =3; else { // Dollars char *arrD = static_cast<char* >(eb[DOLLAR]->buffer.memory.ptr); char *arrC = static_cast<char* >(eb[CENTS]->buffer.memory.ptr); int iteratorD = 0, multD = eb[DOLLAR]->glyphes - 1, retD = 0; int iteratorC = 0, multC = eb[CENTS]->glyphes - 1, retC = 0; while (iteratorD < eb[DOLLAR]->glyphes && arrD[iteratorD] >= 48 && arrD[iteratorD] <= 57) { retD += int(arrD[iteratorD] - 48) * round(pow(10, multD)); multD--; iteratorD++; } while (iteratorC < eb[CENTS]->glyphes && arrC[iteratorC] >= 48 && arrC[iteratorC] <= 57) { retC += int(arrC[iteratorC] - 48) * round(pow(10, multC)); multC--; iteratorC++; } if (eb[DOLLAR]->glyphes <= 0) { fail = 2; } else if (eb[CENTS]->glyphes <= 0) { fail = 3; } else if (eb[CENTS]->glyphes > 2) { fail = 5; } else { fail = 4; int iterator = 0; Item** temp = items; *num_items += 1; Item** temp2 = new Item*[*num_items]; for (int i = 0; i < *num_items - 1; i++){ temp2[i] = new Item(); temp2[i]->item_name = temp[i]->item_name; temp2[i]->price.cents = temp[i]->price.cents; temp2[i]->price.dollars = temp[i]->price.dollars; temp2[i]->quantity_sold = temp[i]->quantity_sold; } temp2[*num_items - 1] = new Item(); temp2[*num_items - 1]->item_name = string(static_cast<char *>(eb[ITEM]->buffer.memory.ptr)); temp2[*num_items - 1]->price.dollars = retD; temp2[*num_items - 1]->price.cents = retC; temp2[*num_items - 1]->quantity_sold = 0; for(int i = 0; i < num_days; i++) { for(int j = 0; j < purchases_a_day[i]; j++) { iterator = 0; while (iterator < *num_items && trips[i][j].item->item_name != temp2[iterator]->item_name) { iterator++; } trips[i][j].item = temp2[iterator]; } } items = temp2; for (int i = 0; i < *num_items - 1; i++) delete temp[i]; delete [] temp; issue_update(); //super important! } } } if (zr_button_text(&context, "Back", ZR_BUTTON_DEFAULT)) { state = 0; fail = 0; } } else if (state == 2) { zr_header(&context, "Delete Item", 0, 0, ZR_HEADER_LEFT); zr_layout_row_static(&context, 30, 240, 3); if (zr_button_text(&context, "Search by item name", ZR_BUTTON_DEFAULT)) { state = 3; fail = 0; } for (int i = 0; i < 12; i++) zr_layout_row_static(&context, 30, 240, 1); zr_layout_row_static(&context, 30, 240, 6); if (zr_button_text(&context, "Back", ZR_BUTTON_DEFAULT)) { state = 0; fail = 0; } } else if(state == 3) { zr_header(&context, "Delete Item", 0, 0, ZR_HEADER_LEFT); zr_layout_row_dynamic(&context, 30, 1); if (fail == 1) zr_label(&context, "Error! Empty field", ZR_TEXT_LEFT); if (fail == 2) zr_label(&context, "Error! Could not find item", ZR_TEXT_LEFT); if (fail == 3) zr_label(&context, "Success! Deleted item", ZR_TEXT_LEFT); //not really a fail zr_layout_row_dynamic(&context, 30, 1); zr_label(&context, "Please input an item:", ZR_TEXT_LEFT); zr_layout_row_static(&context, 30, 240, 3); zr_editbox(&context, eb[S_ITEM]); zr_layout_row_dynamic(&context, 30, 6); if (zr_button_text(&context, "Submit", ZR_BUTTON_DEFAULT)) { if (eb[S_ITEM]->glyphes != 0) { int iterator = 0, iterator2 = 0; char *arr = static_cast<char* >(eb[S_ITEM]->buffer.memory.ptr); while (iterator < *num_items) { if (eb[S_ITEM]->glyphes != items[iterator]->item_name.size()) { iterator++; continue; } while (iterator2 < eb[S_ITEM]->glyphes && arr[iterator2] == items[iterator]->item_name[iterator2]) iterator2++; if (iterator2 >= eb[S_ITEM]->glyphes) break; iterator2 = 0; iterator++; } if (iterator >= *num_items) { fail = 2; } else { fail = 3; items[iterator]->deleted = true; issue_update(); //super important! } } else { fail = 1; } zr_layout_row_static(&context, 30, 240, 1); zr_layout_row_static(&context, 30, 240, 6); if (zr_button_text(&context, "Back", ZR_BUTTON_DEFAULT)) { changeWindow(MAIN);} } for (int i = 0; i < 9; i++) zr_layout_row_static(&context, 30, 240, 1); zr_layout_row_static(&context, 30, 240, 6); if (zr_button_text(&context, "Back", ZR_BUTTON_DEFAULT)) { changeWindow(MAIN);} } } zr_end(&context, window); }
void event_sdl_keydown(int keysym, int keymod) { /* check for the only 2 hard-coded key commands: Alt-enter for fullscreen and 0-9 for save state slot */ if (keysym == SDLK_RETURN && keymod & (KMOD_LALT | KMOD_RALT)) { changeWindow(); } else if (keysym >= SDLK_0 && keysym <= SDLK_9) { main_state_set_slot(keysym - SDLK_0); } /* check all of the configurable commands */ else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdStop)) main_stop(); else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdFullscreen)) changeWindow(); else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdSave)) main_state_save(0, NULL); /* save in mupen64plus format using current slot */ else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdLoad)) main_state_load(NULL); /* load using current slot */ else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdIncrement)) main_state_inc_slot(); else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdReset)) { add_interupt_event(HW2_INT, 0); /* Hardware 2 Interrupt immediately */ add_interupt_event(NMI_INT, 50000000); /* Non maskable Interrupt after 1/2 second */ } else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdSpeeddown)) main_speeddown(5); else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdSpeedup)) main_speedup(5); else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdScreenshot)) main_take_next_screenshot(); /* screenshot will be taken at the end of frame rendering */ else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdPause)) main_toggle_pause(); else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdMute)) { volumeMute(); main_draw_volume_osd(); } else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdIncrease)) { volumeUp(); main_draw_volume_osd(); } else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdDecrease)) { volumeDown(); main_draw_volume_osd(); } else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdForward)) { main_set_fastforward(1); } else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdAdvance)) { main_advance_one(); } else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdGameshark)) { KbdGamesharkPressed = 1; } else { /* pass all other keypresses to the input plugin */ keyDown(keymod, keysym); } }
/********************************************************************************************************* * sdl event filter */ static int event_sdl_filter(const SDL_Event *event) { int cmd, action; switch(event->type) { // user clicked on window close button case SDL_QUIT: main_stop(); break; case SDL_KEYDOWN: event_sdl_keydown(event->key.keysym.sym, event->key.keysym.mod); return 0; case SDL_KEYUP: event_sdl_keyup(event->key.keysym.sym, event->key.keysym.mod); return 0; // if joystick action is detected, check if it's mapped to a special function case SDL_JOYAXISMOTION: case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: case SDL_JOYHATMOTION: for (cmd = 0; cmd < NumJoyCommands; cmd++) { action = MatchJoyCommand(event, (eJoyCommand) cmd); if (action == 1) /* command was just activated (button down, etc) */ { if (cmd == joyFullscreen) changeWindow(); else if (cmd == joyStop) main_stop(); else if (cmd == joyPause) main_toggle_pause(); else if (cmd == joySave) main_state_save(0, NULL); /* save in mupen64plus format using current slot */ else if (cmd == joyLoad) main_state_load(NULL); /* load using current slot */ else if (cmd == joyIncrement) main_state_inc_slot(); else if (cmd == joyScreenshot) main_take_next_screenshot(); else if (cmd == joyMute) { volumeMute(); main_draw_volume_osd(); } else if (cmd == joyDecrease) { volumeDown(); main_draw_volume_osd(); } else if (cmd == joyIncrease) { volumeUp(); main_draw_volume_osd(); } else if (cmd == joyForward) main_set_fastforward(1); } else if (action == -1) /* command was just de-activated (button up, etc) */ { if (cmd == joyForward) main_set_fastforward(0); } } return 0; break; } return 1; }
void CustomerMenuForm::on_pushButton_2_clicked() { emit getOrdersInfoSignal(); emit clearDisplaySignal(); changeWindow(CustomerMenu, CheckOrder); }
void AddUser::render_main(zr_window *window) { zr_context context; zr_begin(&context, window); { static const char *ratings[] = { "very interested", "somewhat interested", "not interested", "never call again" }; zr_header(&context, "Add Customer", 0, 0, ZR_HEADER_LEFT); zr_layout_row_dynamic(&context, 30, 1); zr_label(&context, "Note: Username and Password will be auto-generated " "upon adding customer if fields left empty", ZR_TEXT_LEFT); // name box zr_layout_row_static(&context, 30, 240, 3); zr_label(&context, "Name:", ZR_TEXT_LEFT); zr_editbox(&context, &nameBox); if (isNameDuplicate) { zr_label(&context, "Could not add: Name already exists", ZR_TEXT_LEFT); } else if (isNameEmpty) { zr_label(&context, "Could not add: Please enter a name", ZR_TEXT_LEFT); } // street box zr_layout_row_static(&context, 30, 240, 3); zr_label(&context, "Street:", ZR_TEXT_LEFT); zr_editbox(&context, &streetBox); if (isStreetEmpty) { zr_label(&context, "Could not add: Please enter an address", ZR_TEXT_LEFT); } // state zipcode box zr_layout_row_static(&context, 30, 240, 3); zr_label(&context, "State and Zip Code:", ZR_TEXT_LEFT); zr_editbox(&context, &stateZipCodeBox); if (isStateEmpty) { zr_label(&context, "Could not add: Please enter an address", ZR_TEXT_LEFT); } // username box zr_layout_row_static(&context, 30, 240, 3); zr_label(&context, "Username:"******"Could not add: Username already exists", ZR_TEXT_LEFT); } else if (isUsernameInvalid) { zr_label(&context, "Could not add: Spaces disallowed", ZR_TEXT_LEFT); } // password box zr_layout_row_static(&context, 30, 240, 3); zr_label(&context, "Password:"******"Could not add: Spaces disallowed", ZR_TEXT_LEFT); } // product spinners zr_layout_row_static(&context, 30, 240, 3); zr_label(&context, "Minimal Packages:", ZR_TEXT_LEFT); zr_spinner_int(&context, 0, &product1Value, 9999, 1, &product1State); zr_layout_row_static(&context, 30, 240, 3); zr_label(&context, "Extreme Packages:", ZR_TEXT_LEFT); zr_spinner_int(&context, 0, &product2Value, 9999, 1, &product2State); zr_layout_row_static(&context, 30, 240, 3); zr_label(&context, "Ultimate Packages:", ZR_TEXT_LEFT); zr_spinner_int(&context, 0, &product3Value, 9999, 1, &product3State); // Rating drop down menu zr_layout_row_static(&context, 30, 240, 3); zr_label(&context, "Rating: ", ZR_TEXT_LEFT); zr_combo_begin(&context, &ratingComboBox, ratings[currentRatingInt], &ratingComboBoxState); { zr_layout_row_dynamic(&ratingComboBox, 25, 1); for (int i = 0; i < 4; i++) { if (zr_combo_item(&ratingComboBox, ratings[i], ZR_TEXT_LEFT)) { currentRatingInt = i; } } } zr_combo_end(&context, &ratingComboBox, &ratingComboBoxState); // Received Pamphlet and Key Customer Box checkboxes zr_layout_row_static(&context, 30, 240, 3); zr_checkbox(&context, "Requested Pamphlet", &isPamphletBoxUnTicked); zr_checkbox(&context, "Key Customer", &isKeyBoxUnTicked); // submit box row zr_layout_row_dynamic(&context, 30, 1); if (zr_button_text(&context, "Submit", ZR_BUTTON_DEFAULT)) { // initialize isNewCustomerAdded = false; isNameDuplicate = false; isNameEmpty = false; isInvalidCustomer = false; isNameEmpty = false; isStateEmpty = false; isStreetEmpty = false; isUsernameDuplicate = false; isUsernameInvalid = false; isPasswordInvalid = false; name = ""; street = ""; stateZipCode = ""; username = ""; password = ""; // get the characters in the name box for (unsigned int i = 0; i < nameBox.glyphes; i++) { name += ((char*) nameBox.buffer.memory.ptr)[i]; } // trim spaces name = trimSpaces(name); // check if name empty if (name.length() == 0) { isNameEmpty = true; isInvalidCustomer = true; } else { // else search for duplicates SearchCustomerVector = *customers; while (!SearchCustomerVector.empty() && !isNameDuplicate) { if (SearchCustomerVector.front().GetName() == name) { isNameDuplicate = true; isInvalidCustomer = true; } else { SearchCustomerVector.erase( SearchCustomerVector.begin()); } } } // get the characters in the street box for (unsigned int i = 0; i < streetBox.glyphes; i++) { street += ((char*) streetBox.buffer.memory.ptr)[i]; } // trim spaces street = trimSpaces(street); // check if street empty if (street.length() == 0) { isStreetEmpty = true; isInvalidCustomer = true; } // get the characters in the state zip code box for (unsigned int i = 0; i < stateZipCodeBox.glyphes; i++) { stateZipCode += ((char*) stateZipCodeBox.buffer.memory.ptr)[i]; } // trim spaces stateZipCode = trimSpaces(stateZipCode); // check if state zip code empty if (stateZipCode.length() == 0) { isStateEmpty = true; isInvalidCustomer = true; } // get the characters in the username box for (unsigned int i = 0; i < usernameBox.glyphes; i++) { username += ((char*) usernameBox.buffer.memory.ptr)[i]; } // check if username empty, if so generate a default username if (username.length() == 0 && !isNameEmpty) { username = GenerateUsername(name); } else if (hasSpaces(username)) { // otherwise search for spaces isUsernameInvalid = true; isInvalidCustomer = true; } else { // otherwise search for duplicates SearchCustomerVector = *customers; while (!SearchCustomerVector.empty() && !isUsernameDuplicate) { if (SearchCustomerVector.front().GetUsername() == username) { isUsernameDuplicate = true; isInvalidCustomer = true; } else { SearchCustomerVector.erase( SearchCustomerVector.begin()); } } } // get the characters in the password box for (unsigned int i = 0; i < passwordBox.glyphes; i++) { password += ((char*) passwordBox.buffer.memory.ptr)[i]; } // check if password empty, if so generate a default password if (password.length() == 0) { password = GeneratePassword(); } else if (hasSpaces(password)) { // otherwise check for spaces isPasswordInvalid = true; isInvalidCustomer = true; } // get whether key if (!isKeyBoxUnTicked) { isKey = true; } else { isKey = false; } // get pamphlet if (!isPamphletBoxUnTicked) { isPamphletReceived = true; } else { isPamphletReceived = false; } // get rating rating = ratings[currentRatingInt]; if (!isInvalidCustomer) { newCustomer = new Customer(name, street, stateZipCode, isPamphletReceived, isKey, rating, username, password, product1Value, product2Value, product3Value); customers->push_back(*newCustomer); std::sort(customers->begin(), customers->end()); SaveCustomers(customers); issue_update(); isNewCustomerAdded = true; } } zr_layout_row_dynamic(&context, 30, 1); if (zr_button_text(&context, "Main Menu", ZR_BUTTON_DEFAULT)) { changeWindow(ADMIN); } if (isNewCustomerAdded) { newCustomerNotification = "You have added customer " + newCustomer->GetName() + " with username " + newCustomer->GetUsername(); zr_layout_row_dynamic(&context, 30, 1); zr_label(&context, newCustomerNotification.c_str(), ZR_TEXT_LEFT); } } zr_end(&context, window); }
void AGOSEngine_Waxworks::printBox() { uint16 BoxSize; *_boxBufferPtr = 0; _linePtrs[0] = _boxBuffer; if (_boxCR == 0) _boxLineCount++; stopAnimate(105); BoxSize = getBoxSize(); _variableArray[53] = BoxSize; animate(3, 1, 100, 0, 0, 0); changeWindow(5); switch (BoxSize) { case 1: _textWindow->x = 10; _textWindow->y = 163; _textWindow->width = 20; _textWindow->height = 1; _textWindow->textMaxLength = 26; break; case 2: _textWindow->x = 8; _textWindow->y = 160; _textWindow->width = 24; _textWindow->height = 2; _textWindow->textMaxLength = 32; break; case 3: _textWindow->x = 6; _textWindow->y = 156; _textWindow->width = 28; _textWindow->height = 3; _textWindow->textMaxLength = 37; break; case 4: _textWindow->x = 4; _textWindow->y = 153; _textWindow->width = 32; _textWindow->height = 4; _textWindow->textMaxLength = 42; break; case 5: _textWindow->x = 2; _textWindow->y = 150; _textWindow->width = 36; _textWindow->height = 5; _textWindow->textMaxLength = 48; break; default:_textWindow->x = 1; _textWindow->y = 147; _textWindow->width = 38; _textWindow->height = 6; _textWindow->textMaxLength = 50; break; } _textWindow->textColumn = 0; _textWindow->textRow = 0; _textWindow->textColumnOffset = 0; _textWindow->textLength = 0; justifyStart(); waitForSync(99); _boxBufferPtr = _boxBuffer; while (*_boxBufferPtr) justifyOutPut(*_boxBufferPtr++); _boxLineCount = 0; _boxBufferPtr = _boxBuffer; _lineCounts[0] = 0; _lineCounts[1] = 0; _lineCounts[2] = 0; _lineCounts[3] = 0; _lineCounts[4] = 0; _lineCounts[5] = 0; changeWindow(0); }
void CustomerListWindow::render_main(zr_window *window) { zr_context context; zr_begin(&context, window); { zr_header(&context, "Customer List", 0, 0, ZR_HEADER_LEFT); zr_layout_row_dynamic(&context, 30, 1); if (zr_button_text(&context, "Main Menu", ZR_BUTTON_DEFAULT)) { changeWindow(ADMIN); } { try { if (customers->empty()) { throw 0; } zr_checkbox(&context, "Key only", &isCheckBoxUnTicked); // need a copy of the list for output vector<Customer> CustomerOutputVector = *customers; for (int i = 0; !CustomerOutputVector.empty(); i++) { if ((isCheckBoxUnTicked == 0 && CustomerOutputVector.front().GetIsKey()) | (isCheckBoxUnTicked == 1)) { // name row zr_layout_row_dynamic(&context, 30, 2); zr_label(&context, "Name: ", ZR_TEXT_LEFT); zr_label(&context, CustomerOutputVector.front().GetName().c_str(), ZR_TEXT_LEFT); // address row zr_layout_row_dynamic(&context, 30, 2); zr_label(&context, "Address: ", ZR_TEXT_LEFT); output = CustomerOutputVector.front().GetStreet() + ", " + CustomerOutputVector.front().GetStateZipCode(); zr_label(&context, output.c_str(), ZR_TEXT_LEFT); // Pamphlet row zr_layout_row_dynamic(&context, 30, 2); zr_label(&context, "Sent Pamphlet? ", ZR_TEXT_LEFT); output = CustomerOutputVector.front().GetStreet() + ", " + CustomerOutputVector.front().GetStateZipCode(); if (CustomerOutputVector.front().GetPamphlet()) { output = "Yes"; } else { output = "No"; } zr_label(&context, output.c_str(), ZR_TEXT_LEFT); // Key row zr_layout_row_dynamic(&context, 30, 2); zr_label(&context, "Type: ", ZR_TEXT_LEFT); if (CustomerOutputVector.front().GetIsKey()) { output = "Key"; } else { output = "Nice to have"; } zr_label(&context, output.c_str(), ZR_TEXT_LEFT); // Rating row zr_layout_row_dynamic(&context, 30, 2); zr_label(&context, "Rating: ", ZR_TEXT_LEFT); zr_label(&context, CustomerOutputVector.front().GetRating().c_str(), ZR_TEXT_LEFT); // Username row zr_layout_row_dynamic(&context, 30, 2); zr_label(&context, "Username: "******"Minimum Package Purchases: ", ZR_TEXT_LEFT); productQuantityStream << CustomerOutputVector.front().GetMinimumPurchases() << " ($" << CustomerOutputVector.front().GetMinimumPurchases() * Customer::minimumPackageCost << "/Month)"; output = productQuantityStream.str(); zr_label(&context, output.c_str(), ZR_TEXT_LEFT); // Extreme Package Row zr_layout_row_dynamic(&context, 30, 2); productQuantityStream.str(""); productQuantityStream.clear(); zr_label(&context, "Extreme Package Purchases: ", ZR_TEXT_LEFT); productQuantityStream << CustomerOutputVector.front().GetExtremePurchases() << " ($" << CustomerOutputVector.front().GetExtremePurchases() * Customer::extremePackageCost << "/Month)"; output = productQuantityStream.str(); zr_label(&context, output.c_str(), ZR_TEXT_LEFT); // Ultimate Package Row productQuantityStream.str(""); productQuantityStream.clear(); zr_layout_row_dynamic(&context, 30, 2); zr_label(&context, "Ultimate Package Purchases: ", ZR_TEXT_LEFT); productQuantityStream << CustomerOutputVector.front().GetUltimatePurchases() << " ($" << CustomerOutputVector.front().GetUltimatePurchases() * Customer::ultimatePackageCost << "/Month)"; output = productQuantityStream.str(); zr_label(&context, output.c_str(), ZR_TEXT_LEFT); // Edit and Remove Button Row zr_layout_row_dynamic(&context, 30, 2); editButtonString = "Edit " + CustomerOutputVector.front().GetName(); if (zr_button_text(&context, editButtonString.c_str(), ZR_BUTTON_DEFAULT)) { *customer_index = i; issue_update(); changeWindow(EDIT_CUSTOMER); } removeButtonString = "Remove " + CustomerOutputVector.front().GetName(); if (zr_button_text(&context, removeButtonString.c_str(), ZR_BUTTON_DEFAULT)) { customers->erase(customers->begin() + i); SaveCustomers(customers); issue_update(); } } CustomerOutputVector.erase(CustomerOutputVector.begin()); } zr_layout_row_dynamic(&context, 30, 1); zr_checkbox(&context, "Key only", &isCheckBoxUnTicked); if (zr_button_text(&context, "Main Menu", ZR_BUTTON_DEFAULT)) { changeWindow(ADMIN); } } catch (...) { zr_label(&context, "There are currently no customers", ZR_TEXT_LEFT); } } } zr_end(&context, window); }
int main (int argc, char *argv[]) { char c; char plugins[100][100], s[20]; char romfile[PATH_MAX]; int old_i, i, i1, i2, i3, i4; int p, p_fullscreen = 0, p_emumode = 0, p_gfx = 0, p_audio = 0, p_input = 0, p_rsp = 0, p_help = 0, p_error = 0; int p_emumode_value=1, fileloaded = 0, p_interactive = 0; int true = 1; char *buffer, *buffer2; #if defined (__linux__) if (signal(SIGTERM, sigterm_handler) == SIG_ERR) printf("Warning: Couldn't register SIGTERM signal handler!\n"); #endif //Set working dir #ifdef WITH_HOME { char temp[PATH_MAX], orig[PATH_MAX]; FILE *src, *dest; struct dirent *entry; DIR *dir; strcpy(g_WorkingDir, getenv("HOME")); strcat(g_WorkingDir, "/.mupen64/"); strcpy(cwd, g_WorkingDir); mkdir(g_WorkingDir, 0700); strcpy(temp, g_WorkingDir); strcat(temp, "mupen64.ini"); dest = fopen(temp, "rb"); if (dest == NULL) { unsigned char byte; dest = fopen(temp, "wb"); strcpy(orig, WITH_HOME); strcat(orig, "share/mupen64/mupen64.ini"); src = fopen(orig, "rb"); while(fread(&byte, 1, 1, src)) fwrite(&byte, 1, 1, dest); fclose(src); fclose(dest); } else fclose(dest); strcpy(temp, g_WorkingDir); strcat(temp, "lang"); strcpy(orig, WITH_HOME); strcat(orig, "share/mupen64/lang"); symlink(orig, temp); /*strcpy(temp, g_WorkingDir); strcat(temp, "plugins"); strcpy(orig, WITH_HOME); strcat(orig, "share/mupen64/plugins"); symlink(orig, temp);*/ strcpy(temp, g_WorkingDir); strcat(temp, "plugins"); mkdir(temp, 0700); strcpy(orig, WITH_HOME); strcat(orig, "share/mupen64/plugins"); dir = opendir(orig); while((entry = readdir(dir)) != NULL) { if(strcmp(entry->d_name + strlen(entry->d_name) - 3, ".so")) { strcpy(orig, WITH_HOME); strcat(orig, "share/mupen64/plugins/"); strcat(orig, entry->d_name); src = fopen(orig, "rb"); if(src == NULL) continue; strcpy(temp, g_WorkingDir); strcat(temp, "plugins/"); strcat(temp, entry->d_name); dest = fopen(temp, "rb"); if(dest == NULL) { unsigned char byte; dest = fopen(temp, "wb"); while(fread(&byte, 1, 1, src)) fwrite(&byte, 1, 1, dest); fclose(src); fclose(dest); } else fclose(dest); } else { strcpy(temp, g_WorkingDir); strcat(temp, "plugins/"); strcat(temp, entry->d_name); strcpy(orig, WITH_HOME); strcat(orig, "share/mupen64/plugins/"); strcat(orig, entry->d_name); symlink(orig, temp); } } strcpy(temp, g_WorkingDir); strcat(temp, "save/"); mkdir(temp, 0700); chdir(g_WorkingDir); } #else if (argv[0][0] != '/') { getcwd(cwd, 1024); strcat(cwd, "/"); strcat(cwd, argv[0]); } else strcpy(cwd, argv[0]); while(cwd[strlen(cwd)-1] != '/') cwd[strlen(cwd)-1] = '\0'; strcpy(g_WorkingDir, cwd); #endif //read config file, read plugins config_read(); plugin_scan_directory(cwd); //get config file settings buffer = (char*)config_get_string("Gfx Plugin", ""); buffer2= plugin_name_by_filename(buffer); if(buffer2) { strcpy(plugins[100], buffer2); p_gfx = true; } else if(buffer) printf("GFX Plugin from ini-file could not be loaded\n"); buffer = (char*)config_get_string("Audio Plugin", ""); buffer2= plugin_name_by_filename(buffer); if(buffer2) { strcpy(plugins[99], buffer2); p_audio = true; } else if(buffer) printf("Audio Plugin from ini-file could not be loaded\n"); buffer = (char*)config_get_string("Input Plugin", ""); buffer2= plugin_name_by_filename(buffer); if(buffer2) { strcpy(plugins[98], buffer2); p_input = true; } else if(buffer) printf("Input Plugin from ini-file could not be loaded\n"); buffer = (char*)config_get_string("RSP Plugin", ""); buffer2= plugin_name_by_filename(buffer); if(buffer2) { strcpy(plugins[97], buffer2); p_rsp = true; } else if(buffer) printf("RSP Plugin from ini-file could not be loaded\n"); buffer = (char*)config_get_string("Core", ""); if(strcmp(buffer,"")) { p_emumode = true; p_emumode_value = buffer[0]-'0'+1; } buffer = (char*)config_get_string("Fullscreen", ""); if(strcmp(buffer,"")) { if(!strcmp(buffer, "true")) p_fullscreen = true; } buffer = (char*)config_get_string("No Ask", ""); if(strcmp(buffer,"")) { if(!strcmp(buffer, "true")) p_noask = true; } // Command Line Parameter - Parsing for(p=1; p<argc; p++) { if(argv[p][0] == '-') { if(!strcmp(argv[p], "--fullscreen")) p_fullscreen = true; else if(!strcmp(argv[p], "--help")) p_help = true; else if(!strcmp(argv[p], "--noask")) p_noask = true; else if(!strcmp(argv[p], "--interactive")) p_interactive = true; else if(!strcmp(argv[p], "--emumode")) { p++; if(p < argc) { p_emumode_value = argv[p][0]; p_emumode = true; } } else if(!strcmp(argv[p], "--gfx")) { p++; if(p < argc) { buffer = plugin_name_by_filename(argv[p]); if(buffer) { strcpy(plugins[100], buffer); p_gfx = true; } else printf("specified GFX Plugin couldn't be loaded!\n"); } } else if(!strcmp(argv[p], "--audio")) { p++; if(p < argc) { buffer = plugin_name_by_filename(argv[p]); if(buffer) { strcpy(plugins[99], buffer); p_audio = true; } else printf("specified Audio Plugin couldn't be loaded!\n"); } } else if(!strcmp(argv[p], "--input")) { p++; if(p < argc) { buffer = plugin_name_by_filename(argv[p]); if(buffer) { strcpy(plugins[98], buffer); p_input = true; } else printf("specified Input Plugin couldn't be loaded!\n"); } } else if(!strcmp(argv[p], "--rsp")) { p++; if(p < argc) { buffer = plugin_name_by_filename(argv[p]); if(buffer) { strcpy(plugins[97], buffer); p_rsp = true; } else printf("specified RSP Plugin couldn't be loaded!\n"); } } } else { strcpy(romfile, argv[p]); fileloaded = true; } } if(p_interactive) { p_emumode = 0; p_gfx = 0; p_audio = 0; p_input = 0; p_rsp = 0; } printf("\nMupen64 version : %s\n", VERSION); if (argc < 2 || p_help || p_error || fileloaded != true) { printf("\n\n" "syntax: mupen64_nogui [parameter(s)] rom\n" "\n" "Parameters:\n" " --fullscreen : turn fullscreen mode on\n" " --gfx (plugin) : set gfx plugin to (plugin)\n" " --audio (plugin) : set audio plugin to (plugin)\n" " --input (plugin) : set input plugin to (plugin)\n" " --rsp (plugin) : set rsp plugin to (plugin)\n" " --emumode (number) : set emu mode to: 1=interp./2=recomp./3=pure interp\n" " --noask : don't ask to force load on bad dumps\n" " --interactive : ask interactively for all plugins\n" "\n" "You can also use the Config-File from the Gui-Version\n" "but there are aditional Parameters for the NO-GUI Version\n" "\n"); return 0; } if (rom_read(romfile)) { if(rom) free(rom); if(ROM_HEADER) free(ROM_HEADER); return 1; } printf("Goodname:%s\n", ROM_SETTINGS.goodname); printf("16kb eeprom=%d\n", ROM_SETTINGS.eeprom_16kb); printf ("emulation mode:\n" " 1. interpreter\n" " 2. dynamic recompiler (default)\n" " 3. pure interpreter\n"); if(p_emumode) c = p_emumode_value; else c = getchar(); if (c == '1') dynacore=0; else if (c == '3') dynacore=2; else dynacore=1; SDL_Init(SDL_INIT_VIDEO); SDL_SetVideoMode(10, 10, 16, 0); SDL_ShowCursor(0); SDL_EnableKeyRepeat(0, 0); SDL_EnableUNICODE(1); init_memory(); // --------------------- loading plugins ---------------------- i=1; i1=1; printf(" Choose your gfx plugin : \n"); while(plugin_type() != -1) { if (plugin_type() == PLUGIN_TYPE_GFX) { strcpy(plugins[i], plugin_next()); printf("%s (%s)\n", plugins[i], plugin_filename_by_name(plugins[i])); i++; } else plugin_next(); } if(p_gfx) i1 = 100; else { if(p_emumode) getchar(); /*c = getchar(); s[0] = c; s[1] = 0;*/ scanf("%10s", s); i1 = atoi(s); } plugin_rewind(); old_i = i; printf(" Choose your audio plugin : \n"); while(plugin_type() != -1) { if (plugin_type() == PLUGIN_TYPE_AUDIO) { strcpy(plugins[i], plugin_next()); printf("%s (%s)\n", plugins[i], plugin_filename_by_name(plugins[i])); i++; } else plugin_next(); } /*getchar(); c = getchar(); //getchar(); s[0] = c; s[1] = 0;*/ if(p_audio) i2 = 99; else { scanf("%10s", s); i2 = old_i + atoi(s) - 1; } plugin_rewind(); old_i = i; printf(" Choose your input plugin : \n"); while(plugin_type() != -1) { if (plugin_type() == PLUGIN_TYPE_CONTROLLER) { strcpy(plugins[i], plugin_next()); printf("%s (%s)\n", plugins[i], plugin_filename_by_name(plugins[i])); i++; } else plugin_next(); } /*getchar(); c = getchar(); //getchar(); s[0] = c; s[1] = 0;*/ if(p_input) i3 = 98; else { scanf("%10s", s); i3 = old_i + atoi(s) - 1; } plugin_rewind(); old_i = i; printf(" Choose your RSP plugin : \n"); while(plugin_type() != -1) { if (plugin_type() == PLUGIN_TYPE_RSP) { strcpy(plugins[i], plugin_next()); printf("%s (%s)\n", plugins[i], plugin_filename_by_name(plugins[i])); i++; } else plugin_next(); } /*getchar(); c = getchar(); getchar(); s[0] = c; s[1] = 0;*/ if(p_rsp) i4 = 97; else { scanf("%10s", s); i4 = old_i + atoi(s) - 1; } printf("\n\nSelected Plugins: %s, %s, %s, %s\n", plugins[i1], plugins[i2], plugins[3], plugins[i4]); plugin_load_plugins(plugins[i1], plugins[i2], plugins[i3], plugins[i4]); romOpen_gfx(); romOpen_audio(); romOpen_input(); // ------------------------------------------------------------ SDL_SetEventFilter(filter); if(p_fullscreen) changeWindow(); go(); romClosed_RSP(); romClosed_input(); romClosed_audio(); romClosed_gfx(); closeDLL_RSP(); closeDLL_input(); closeDLL_audio(); closeDLL_gfx(); free(rom); free(ROM_HEADER); free_memory(); return 0; }
static int filter(const SDL_Event *event) { switch (event->type) { case SDL_KEYDOWN: switch (event->key.keysym.sym) { case SDLK_F5: savestates_job |= SAVESTATE; break; case SDLK_F7: savestates_job |= LOADSTATE; break; case SDLK_ESCAPE: stop_it(); break; case SDLK_F1: changeWindow(); break; default: switch (event->key.keysym.unicode) { case '0': savestates_select_slot(0); break; case '1': savestates_select_slot(1); break; case '2': savestates_select_slot(2); break; case '3': savestates_select_slot(3); break; case '4': savestates_select_slot(4); break; case '5': savestates_select_slot(5); break; case '6': savestates_select_slot(6); break; case '7': savestates_select_slot(7); break; case '8': savestates_select_slot(8); break; case '9': savestates_select_slot(9); break; default: keyDown(0, event->key.keysym.sym); } } return 0; break; case SDL_KEYUP: switch (event->key.keysym.sym) { case SDLK_ESCAPE: break; case SDLK_F1: break; default: keyUp(0, event->key.keysym.sym); } return 0; break; default: return 1; } }
void CustomerMenuForm::on_pushButton_3_clicked() { emit logOutSignal(); changeWindow(CustomerMenu, Login); }
void AGOSEngine::o_window() { // 102 changeWindow(getVarOrByte() & 7); }
void CustomerMenuForm::on_pushButton_clicked() { emit getProductsInfoSignal(); changeWindow(CustomerMenu, SingleOrder); }
void AGOSEngine_Simon2::os2_mouseOff() { // 181: force mouseOff scriptMouseOff(); changeWindow(1); showMessageFormat("\xC"); }
void lircCheckInput(void) { struct pollfd lircpoll; lircpoll.fd = g_lircfd; lircpoll.events = POLLIN; if(poll(&lircpoll, 1, 0) > 0) { char *code; char *c; int ret; if(lirc_nextcode(&code) == 0 && code != NULL) { while((ret = lirc_code2char(g_config, code, &c)) == 0 && c!=NULL) { char *c_ind = c; while(*c_ind != '\0') { *c_ind = toupper(*c_ind); c_ind++; } DebugMessage(M64MSG_VERBOSE, "LIRC Execing command \"%s\"", c); if(strcmp(c, "SAVE") == 0) savestates_job |= SAVESTATE; else if(strcmp(c, "LOAD") == 0) savestates_job |= LOADSTATE; else if(strcmp(c, "QUIT") == 0) main_stop(); else if(strcmp(c, "FULLSCREEN") == 0) changeWindow(); else if(strcmp(c, "MUTE") == 0) { volumeMute(); main_draw_volume_osd(); } else if(strcmp(c, "VOL+") == 0) { volumeUp(); main_draw_volume_osd(); } else if(strcmp(c, "VOL-") == 0) { volumeDown(); main_draw_volume_osd(); } else if(strcmp(c, "SCREENSHOT") == 0) main_take_next_screenshot(); else if(strcmp(c, "SPEED+") == 0) main_speedup(5); else if(strcmp(c, "SPEED-") == 0) main_speeddown(5); else if(strcmp(c, "ADVANCE") == 0) main_advance_one(); else if(strcmp(c, "PAUSE") == 0) main_toggle_pause(); else { int val = ((int)c[0])-((int) '0'); if (val >= 0 && val <= 9) savestates_select_slot( val ); } } free(code); } } }