void Sudoku::loadGame(const QString& num) { board->clear(); clearWindow(); QString fileName = Path + QString("/puzzles/puzzle_%1.sp").arg(num); board->readGame(fileName); setWindowTitle(tr("Sudoku - #%1").arg(num)); setWindowModified(false); }
void loopMainMenu(Inputs input, Map *map, Map *menu) { updateMenu(&input, &map); if (isOnMenu() != IS_IN_PRINCIPAL_MENU) clearWindow(); else drawMenu(menu); }
void Sudoku::createAGame() { if (okToContinue()) { board->clear(); clearWindow(); creationMode = true; setWindowTitle(tr("Sudoku - Creation Mode")); setWindowModified(false); } }
Sudoku::Sudoku(QWidget *parent) : QMainWindow(parent) { board = new Board; connect(board, SIGNAL(modified()), this, SLOT(boardModified())); clearWindow(); createActions(); createMenus(); createButtons(); createLayout(); readSettings(); }
virtual void draw(GLfloat deltaTime){ if(window->isKeyDown(SDLK_a)) cam->processKeyboard(chaos::LEFT, deltaTime*moveSpeed); if(window->isKeyDown(SDLK_d)) cam->processKeyboard(chaos::RIGHT, deltaTime*moveSpeed); if(window->isKeyDown(SDLK_w)) cam->processKeyboard(chaos::FORWARD, deltaTime*moveSpeed); if(window->isKeyDown(SDLK_s)) cam->processKeyboard(chaos::BACKWARD, deltaTime*moveSpeed); renderer->setCamCombined(cam->getProjectionMatrix()*cam->getViewMatrix()); actModel->setRotY(SDL_GetTicks()/2000.f); clearWindow(0.2, 0.2, 0.2, 1.0); spriteBackground->draw(); if(actModel != nullptr){ if(renderMode==0){ actModel->setShader("Shader_Mesh3d"); actTexture->bind(); actModel->draw(); } if(renderMode == 1){ GLfloat currTime = window->getRunningTimeAsSeconds(); actModel->setShader("Shader_Mesh3d#Explosion"); actModel->getShader()->run(); actModel->getShader()->setUniform("time", currTime); actTexture->bind(); actModel->draw(); } if(renderMode == 2){ renderer->setCamCombined(cam->getProjectionMatrix()*cam->getViewMatrix()); actTexture->bind(); actModel->setShader("Shader_Mesh3d#Normals"); actModel->getShader()->run(); actModel->getShader()->setUniform("mxViewModel", cam->getViewMatrix()*actModel->getGlobalTransformMatrix()); actModel->draw(); renderer->setCamCombined(cam->getProjectionMatrix()*cam->getViewMatrix()); actModel->setShader("Shader_Mesh3d"); actModel->draw(); } if(renderMode == 3){ GLfloat currTime = window->getRunningTimeAsSeconds(); actModel->setShader("Shader_Mesh3d#Random"); actModel->getShader()->run(); actModel->getShader()->setUniform("time", currTime); actTexture->bind(); actModel->draw(); } textLeft->draw(); textRight->draw(); } }
Window *newWindowWithSizeAndBuffer(uint32_t window_size, uint32_t buffer_size) { Window *window = malloc(sizeof(Window)); window->base_seq_num = START_SEQ_NUM; window->window_size = window_size; window->block_size = buffer_size; window->buffer_size = window_size * buffer_size; window->registry = malloc(window_size); window->buffer = malloc(window_size * buffer_size); window->data_len = window->block_size * window->window_size; clearWindow(window); return window; }
void AGOSEngine::resetNameWindow() { WindowBlock *window; if (getGameType() == GType_SIMON2 && getBitFlag(79)) return; window = _windowArray[1]; if (window != NULL && window->textColor != 0) clearWindow(window); _lastNameOn = NULL; _lastVerbOn = NULL; }
void AGOSEngine::openTextWindow() { if (_textWindow) { if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) { if (_textWindow->flags & 0x80) clearWindow(_textWindow); } return; } if (getGameType() == GType_FF || getGameType() == GType_PP) _textWindow = openWindow(64, 96, 384, 172, 1, 0, 15); else _textWindow = openWindow(8, 144, 24, 6, 1, 0, 15); }
DrawWindow(int w, int h, std::string name) { // constructor width=w; height=h; window_name = name; cv::namedWindow(window_name, CV_WINDOW_AUTOSIZE ); winx=0; winy=0; grid = cv::Mat( height, width, CV_8UC3 ); // 3 channel color setLineType("solid"); setLineThickness(2); setPenColor(0,0,0); clearWindow(255,255,255); }
void handle_708_CLW_ClearWindows (cc708_service_decoder *decoder, int windows_bitmap) { if (windows_bitmap==0) ;//ccx_common_logging.debug_ftn(CCX_DMT_708, "None\n"); else { for (int i=0; i<8; i++) { if (windows_bitmap & 1) { clearWindow (decoder, i); } windows_bitmap>>=1; } } }
void handle_708_CLW_ClearWindows (cc708_service_decoder *decoder, int windows_bitmap) { printf (" Entry in handle_708_CLW_ClearWindows, windows: "); if (windows_bitmap==0) printf ("None\n"); else { for (int i=0; i<8; i++) { if (windows_bitmap & 1) { printf ("[Window %d] ",i ); clearWindow (decoder, i); } windows_bitmap>>=1; } } printf ("\n"); }
void SfmlHandler::animationLogo(void) { int y = _h; int opacity = 0; while (y > _h / 3) { clearWindow(); _drawBackground(); _window->draw(_logoSprite); show(); _logoSprite.setPosition(_w / 2, y); if (opacity < 255){ _logoSprite.setColor(sf::Color(255, 255, 255, opacity)); opacity++; } y--; usleep(5000); } }
void Sudoku::save() { if (creationMode == false) { QMessageBox::warning(this, tr("Sudoku"), tr("<p>You are not in creation mode. " "<p>If you want to create a game, click <em>Creation/Create a Game</em> first.")); return; } if (board->isValid()) { gameCount++; QString fileName = Path + QString("/puzzles/puzzle_%1.sp").arg(gameCount); board->writeGame(fileName); QMessageBox::information(this, tr("Sudoku"), tr("<p>You successfully add one more puzzle. This puzzle is assigned as #%1.").arg(gameCount)); board->clear(); clearWindow(); setWindowModified(false); } else { QMessageBox::information(this, tr("Sudoku"), tr("<p>This is not a valid Sudoku!")); } }
MainWindow::MainWindow() { setWindowTitle(tr("Peanuts")); currentLiveState = false; livescreen = new LiveScreen; QShortcut *quitShortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this); QPushButton *settingsButton = new QPushButton("Settings"); QFrame *divider = new QFrame(); divider->setFrameShape(QFrame::VLine); clearButton = new QPushButton("Clear"); clearButton->setCheckable(true); blackoutButton = new QPushButton("Blackout"); blackoutButton->setCheckable(true); goLiveButton = new QPushButton("Go Live"); goLiveButton->setCheckable(true); QVBoxLayout *layout = new QVBoxLayout(this); QHBoxLayout *toolBar = new QHBoxLayout(); toolBar->addWidget(settingsButton); toolBar->addWidget(divider); toolBar->addWidget(clearButton); toolBar->addWidget(blackoutButton); toolBar->addWidget(goLiveButton); liveSelectButtons = new QHBoxLayout(); liveSelectGroup = new QButtonGroup(); QHBoxLayout *mainArea = new QHBoxLayout(); tehTabs = new QTabWidget(); mainArea->addWidget(tehTabs); addModule(new ScoresModule); addModule(new PrizeBoardModule); addModule(new SongsModule); addModule(new BalloonsModule); addModule(new NumberChoiceModule); addModule(new ThemeCutModule); addModule(new QuestionsModule); addModule(new BuzzerModule); liveSelectButtons->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding)); layout->addLayout(toolBar); layout->addLayout(liveSelectButtons); layout->addLayout(mainArea); setLayout(layout); /*QPixmap *tehballon = new QPixmap("BalloonRed.png"); QWidget *balloons = new QWidget(); balloons->render(tehballon); balloons->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::SplashScreen); balloons->show(); QPushButton *buttonthing = new QPushButton("Stuff", balloons); buttonthing->show();*/ // Decided that this stuff is best down here as things go wrong if objects haven't been created before I try to connect them connect(goLiveButton, SIGNAL(clicked()), this, SLOT(toggleLiveScreen())); connect(blackoutButton, SIGNAL(clicked()), livescreen, SLOT(blackoutWindow())); connect(clearButton, SIGNAL(clicked()), livescreen, SLOT(clearWindow())); connect(this, SIGNAL(isLiveSignal(bool)), goLiveButton, SLOT(setChecked(bool))); connect(livescreen, SIGNAL(liveClosed()), this, SLOT(closeLiveScreen())); connect(quitShortcut, SIGNAL(activated()), this, SLOT(closeLiveScreen())); connect(liveSelectGroup, SIGNAL(buttonClicked(int)), livescreen, SLOT(switchLivescreen(int))); }
// Exit compare session // - Clear results // - Delete objects // - Restore previous NP++ appearance (markers, highlight, ...) void reset() { if (active == true) { LRESULT RODoc1; LRESULT RODoc2; // Remove read-only attribute if ((RODoc1 = SendMessage(nppData._scintillaMainHandle, SCI_GETREADONLY, 0, 0)) == 1) SendMessage(nppData._scintillaMainHandle, SCI_SETREADONLY, false, 0); if ((RODoc2 = SendMessage(nppData._scintillaSecondHandle, SCI_GETREADONLY, 0, 0)) == 1) SendMessage(nppData._scintillaSecondHandle, SCI_SETREADONLY, false, 0); int doc1 = SendMessageA(nppData._scintillaMainHandle, SCI_GETDOCPOINTER, 0, 0); int doc2 = SendMessageA(nppData._scintillaSecondHandle, SCI_GETDOCPOINTER, 0, 0); int doc1Index = getCompare(doc1); int doc2Index = getCompare(doc2); int win = 3; ::SendMessage(nppData._nppHandle, NPPM_GETCURRENTSCINTILLA, 0, (LPARAM)&win); HWND window = getCurrentHScintilla(win); if(doc1Index != -1) { clearWindow(nppData._scintillaMainHandle, true); } if(doc2Index != -1) { clearWindow(nppData._scintillaSecondHandle, true); } ::SendMessageA(window, SCI_GRABFOCUS, 0, (LPARAM)1); ::SendMessage(nppData._nppHandle, WM_COMMAND, MAKELONG(IDM_VIEW_SYNSCROLLV, 0), 0); ::SendMessage(nppData._nppHandle, WM_COMMAND, MAKELONG(IDM_VIEW_SYNSCROLLH, 0), 0); if(panelsOpened) { ::SendMessageA(nppData._scintillaSecondHandle, SCI_GRABFOCUS, 0, (LPARAM)0); SendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_GOTO_ANOTHER_VIEW, 0); } if(tempWindow!=-1) { ::SendMessage(nppData._nppHandle, NPPM_SWITCHTOFILE, 0, (LPARAM)compareFilePath); window = getCurrentWindow(); int tempPointer = SendMessageA(window, SCI_GETDOCPOINTER, 0, 0); if(tempPointer == tempWindow) { SendMessageA(window,SCI_EMPTYUNDOBUFFER,0,0); SendMessage(nppData._nppHandle, WM_COMMAND, IDM_FILE_CLOSE, 0); } tempWindow = -1; LRESULT ROTemp = RODoc1; RODoc1 = RODoc2; RODoc2 = ROTemp; } // Remove margin mask ::SendMessage(nppData._scintillaMainHandle, SCI_SETMARGINMASKN, (WPARAM)4, (LPARAM)0); ::SendMessage(nppData._scintillaSecondHandle, SCI_SETMARGINMASKN, (WPARAM)4, (LPARAM)0); // Remove margin ::SendMessage(nppData._scintillaMainHandle, SCI_SETMARGINWIDTHN, (WPARAM)4, (LPARAM)0); ::SendMessage(nppData._scintillaSecondHandle, SCI_SETMARGINWIDTHN, (WPARAM)4, (LPARAM)0); removeCompare(doc1); removeCompare(doc2); panelsOpened = false; active = false; // Close NavBar NavDlg.doDialog(false); // Disable Prev/Next menu entry HMENU hMenu = ::GetMenu(nppData._nppHandle); ::EnableMenuItem(hMenu, funcItem[CMD_PREV]._cmdID, MF_BYCOMMAND | MF_GRAYED); ::EnableMenuItem(hMenu, funcItem[CMD_NEXT]._cmdID, MF_BYCOMMAND | MF_GRAYED); ::EnableMenuItem(hMenu, funcItem[CMD_FIRST]._cmdID, MF_BYCOMMAND | MF_GRAYED); ::EnableMenuItem(hMenu, funcItem[CMD_LAST]._cmdID, MF_BYCOMMAND | MF_GRAYED); // Restore side bar item entry state (because tick has been removed by the docked window) CheckMenuItem(hMenu, funcItem[CMD_USE_NAV_BAR]._cmdID, MF_BYCOMMAND | (Settings.UseNavBar ? MF_CHECKED : MF_UNCHECKED)); // Restore previous read-only attribute if (RODoc1 == 1) SendMessage(nppData._scintillaMainHandle, SCI_SETREADONLY, true, 0); if (RODoc2 == 1) SendMessage(nppData._scintillaSecondHandle, SCI_SETREADONLY, true, 0); } }
eChoice SfmlHandler::drawMenu(void) { _isMenu = true; eChoice choice = eChoice::QUIT; eChoice newChoice = eChoice::HUMAN; // Loop until a choice is made while (_isMenu) { // Get the pressed Key obviously eKeys key = getKeyPressed(); // Handle the key if (key == eKeys::ESC) return eChoice::QUIT; else if (key == eKeys::DOWN || key == eKeys::UP) newChoice = (newChoice == eChoice::HUMAN ? eChoice::IA : eChoice::HUMAN); else if (key == eKeys::RETURN){ return choice; } // If choice has changed, we cacn draw if (choice != newChoice){ // Draw the background clearWindow(); _drawBackground(); _window->draw(_logoSprite); // Configure first choice sf::Text choice_1; choice_1.setFont(_font); choice_1.setString("1 - Human vs Human"); choice_1.setCharacterSize(54); choice_1.setColor(sf::Color(255, 255, 255)); choice_1.setPosition(_w / 3, _h / 2); // Configure second choice sf::Text choice_2; choice_2.setFont(_font); choice_2.setString("2 - Human vs AI"); choice_2.setCharacterSize(54); choice_2.setColor(sf::Color(255, 255, 255)); choice_2.setPosition(_w / 3, (_h / 2) + SPACING_RATIO); // Draw choices _window->draw(choice_1); _window->draw(choice_2); // Draw the line pointing on the selected choice if (newChoice == eChoice::HUMAN) _drawSelectedChoice(choice_1); else _drawSelectedChoice(choice_2); // Display our beautiful drawings show(); // Update choice value to the actual value choice = newChoice; } } return eChoice::QUIT; }
void AGOSEngine_PN::opn_opcode14() { clearWindow(_windowArray[_curWindow]); pcf((uint8)255); setScriptReturn(true); }
bool compareNew() { clearWindow(nppData._scintillaMainHandle, true); clearWindow(nppData._scintillaSecondHandle, true); active = true; int doc1Length; int *lineNum1; char **doc1 = getAllLines(nppData._scintillaMainHandle, &doc1Length, &lineNum1); if(doc1Length < 1) { return true; } int doc2Length; int *lineNum2; char **doc2 = getAllLines(nppData._scintillaSecondHandle, &doc2Length, &lineNum2); if(doc2Length < 1) { return true; } int doc1Changed = 0; int doc2Changed = 0; diff_edit *doc1Changes = NULL; diff_edit *doc2Changes = NULL; unsigned int *doc1Hashes = computeHashes(doc1, doc1Length, Settings.IncludeSpace); unsigned int *doc2Hashes = computeHashes(doc2, doc2Length, Settings.IncludeSpace); /* make diff */ int sn; struct varray *ses = varray_new(sizeof(struct diff_edit), NULL); int result = (diff(doc1Hashes, 0, doc1Length, doc2Hashes, 0, doc2Length, (idx_fn)(getLineFromIndex), (cmp_fn)(compareLines), NULL, 0, ses, &sn, NULL)); int changeOffset = 0; shift_boundries(ses, sn, doc1Hashes, doc2Hashes, doc1Length, doc2Length); find_moves(ses, sn, doc1Hashes, doc2Hashes, Settings.DetectMove); /* * - insert empty lines * - count changed lines */ doc1Changed = 0; doc2Changed = 0; for (int i = 0; i < sn; i++) { struct diff_edit *e =(diff_edit*) varray_get(ses, i); if(e->op == DIFF_DELETE) { e->changeCount = 0; doc1Changed += e->len; struct diff_edit *e2 =(diff_edit*) varray_get(ses, i+1); e2->changeCount = 0; if(e2->op == DIFF_INSERT) { //see if the DELETE/INSERT COMBO includes changed lines or if its a completely new block if(compareWords(e, e2, doc1, doc2, Settings.IncludeSpace)) { e->op = DIFF_CHANGE1; e2->op = DIFF_CHANGE2; doc2Changed += e2->len; } } } else if(e->op == DIFF_INSERT) { e->changeCount = 0; doc2Changed += e->len; } } int doc1CurrentChange = 0; int doc2CurrentChange = 0; changeOffset = 0; doc1Changes = new diff_edit[doc1Changed]; doc2Changes = new diff_edit[doc2Changed]; int doc1Offset = 0; int doc2Offset = 0; //switch from blocks of lines to one change per line. Change CHANGE to DELETE or INSERT if there are no changes on that line int added; for (int i = 0; i < sn; i++) { struct diff_edit *e =(diff_edit*) varray_get(ses, i); e->set = i; switch(e->op) { case DIFF_CHANGE1: case DIFF_DELETE: added = setDiffLines(e, doc1Changes, &doc1CurrentChange, DIFF_DELETE, e->off + doc2Offset); doc2Offset -= added; doc1Offset += added; break; case DIFF_INSERT: case DIFF_CHANGE2: added = setDiffLines(e, doc2Changes, &doc2CurrentChange, DIFF_INSERT, e->off + doc1Offset); doc1Offset -= added; doc2Offset += added; break; } } if (result != -1) { int textIndex; different = (doc1Changed > 0) || (doc2Changed > 0); for(int i = 0; i < doc1Changed; i++) { switch(doc1Changes[i].op) { case DIFF_DELETE: markAsRemoved(nppData._scintillaMainHandle, doc1Changes[i].off); break; case DIFF_CHANGE1: markAsChanged(nppData._scintillaMainHandle, doc1Changes[i].off); textIndex = lineNum1[doc1Changes[i].off]; for(int k = 0; k < doc1Changes[i].changeCount; k++) { struct diff_change *change = (diff_change*)varray_get(doc1Changes[i].changes, k); markTextAsChanged(nppData._scintillaMainHandle, textIndex + change->off, change->len); } break; case DIFF_MOVE: markAsMoved(nppData._scintillaMainHandle, doc1Changes[i].off); break; } } for(int i = 0; i < doc2Changed; i++) { switch(doc2Changes[i].op) { case DIFF_INSERT: markAsAdded(nppData._scintillaSecondHandle, doc2Changes[i].off); break; case DIFF_CHANGE2: markAsChanged(nppData._scintillaSecondHandle, doc2Changes[i].off); textIndex = lineNum2[doc2Changes[i].off]; for(int k = 0; k < doc2Changes[i].changeCount; k++) { struct diff_change *change=(diff_change*)varray_get(doc2Changes[i].changes, k); markTextAsChanged(nppData._scintillaSecondHandle, textIndex+change->off, change->len); } break; case DIFF_MOVE: markAsMoved(nppData._scintillaSecondHandle,doc2Changes[i].off); break; } } doc1Offset = 0; doc2Offset = 0; if(Settings.AddLine) { int length = 0; int off = -1; for(int i = 0; i < doc1Changed; i++) { switch(doc1Changes[i].op) { case DIFF_DELETE: case DIFF_MOVE: if(doc1Changes[i].altLocation == off) { length++; } else { addEmptyLines(nppData._scintillaSecondHandle, off + doc2Offset, length); doc2Offset += length; off = doc1Changes[i].altLocation; length = 1; } break; } } addEmptyLines(nppData._scintillaSecondHandle, off + doc2Offset, length); if(doc2Offset > 0) { clearUndoBuffer(nppData._scintillaSecondHandle); } length = 0; off = 0; doc1Offset = 0; for(int i = 0; i < doc2Changed; i++) { switch(doc2Changes[i].op) { case DIFF_INSERT: case DIFF_MOVE: if(doc2Changes[i].altLocation == off) { length++; } else { addEmptyLines(nppData._scintillaMainHandle, off + doc1Offset, length); doc1Offset += length; off = doc2Changes[i].altLocation; length = 1; } break; } } addEmptyLines(nppData._scintillaMainHandle, off + doc1Offset, length); if(doc1Offset > 0) { clearUndoBuffer(nppData._scintillaMainHandle); } } //clean up resources #if CLEANUP for(int i = 0; i < doc1Length; i++) { if(*doc1[i] != 0) { delete[] doc1[i]; } } delete[] doc1; delete[] lineNum1; for(int i = 0; i < doc2Length; i++) { if(*doc2[i] != 0) { delete[] doc2[i]; } } delete[] doc2; delete lineNum2; delete[] doc1Hashes; delete[] doc2Hashes; clearEdits(ses, sn); for(int i = 0; i < doc1Changed; i++) { clearEdit(doc1Changes + (i)); } delete[] doc1Changes; for(int i = 0; i < doc2Changed; i++) { clearEdit(doc2Changes+(i)); } delete[] doc2Changes; #endif // CLEANUP if(!different) { ::MessageBox(nppData._nppHandle, TEXT("Files Match"), TEXT("Results :"), MB_OK); return true; } ::SendMessageA(nppData._scintillaMainHandle, SCI_SHOWLINES, 0, (LPARAM)1); ::SendMessageA(nppData._scintillaSecondHandle, SCI_SHOWLINES, 0, (LPARAM)1); return false; } return false; }
void drawScene(void) { clearWindow(); // clear the last scene setColor(RED); drawFilledCircle(100,100,50); glutSwapBuffers(); // double buffering control }
// clears window and set pixels to r g b void clearWindow(int r, int g, int b) { setCanvasColor(r,g,b); clearWindow(); }
void AGOSEngine::windowPutChar(WindowBlock *window, byte c, byte b) { byte width = 6; if (c == 12) { clearWindow(window); } else if (c == 13 || c == 10) { windowNewLine(window); } else if ((c == 1 && _language != Common::HE_ISR) || (c == 8)) { if (_language == Common::HE_ISR) { if (b >= 64 && b < 91) width = _hebrewCharWidths [b - 64]; if (window->textLength != 0) { window->textLength--; window->textColumnOffset += width; if (window->textColumnOffset >= 8) { window->textColumnOffset -= 8; window->textColumn--; } } } else { int8 val = (c == 8) ? 6 : 4; if (window->textLength != 0) { window->textLength--; window->textColumnOffset -= val; if ((int8)window->textColumnOffset < val) { window->textColumnOffset += 8; window->textColumn--; } } } } else if (c >= 32) { if (getGameType() == GType_FF || getGameType() == GType_PP) { // Ignore invalid characters if (c - 32 > 195) return; windowDrawChar(window, window->textColumn + window->x, window->textRow + window->y, c); window->textColumn += getFeebleFontSize(c); return; } // Ignore invalid characters if (c - 32 > 98) return; if (window->textLength == window->textMaxLength) { windowNewLine(window); } else if (window->textRow == window->height) { windowNewLine(window); window->textRow--; } if (_language == Common::HE_ISR) { if (c >= 64 && c < 91) width = _hebrewCharWidths [c - 64]; window->textColumnOffset -= width; if (window->textColumnOffset >= width) { window->textColumnOffset += 8; window->textColumn++; } windowDrawChar(window, (window->width + window->x - window->textColumn) * 8, window->textRow * 8 + window->y, c); window->textLength++; } else { windowDrawChar(window, (window->textColumn + window->x) * 8, window->textRow * 8 + window->y, c); window->textLength++; window->textColumnOffset += 6; if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { if (c == 'i' || c == 'l') window->textColumnOffset -= 2; } if (window->textColumnOffset >= 8) { window->textColumnOffset -= 8; window->textColumn++; } } } }
void drawScene(void) { clearWindow(); grid.draw(); glutSwapBuffers(); }
// Elvira 1 specific void AGOSEngine::drawMenuStrip(uint windowNum, uint menuNum) { WindowBlock *window = _windowArray[windowNum % 8]; mouseOff(); byte *srcPtr = _menuBase; int menu = (menuNum != 0) ? menuNum * 4 + 1 : 0; while (menu--) { if (READ_LE_UINT16(srcPtr) != 0xFFFF) { srcPtr += 2; while (*srcPtr != 0) srcPtr++; srcPtr++; } else { srcPtr += 2; } } clearWindow(window); int newline = 0; while (READ_LE_UINT16(srcPtr) != 0xFFFF) { byte *tmp = srcPtr; srcPtr += 2; if (newline != 0) { windowPutChar(window, 10); } uint len = 0; while (*srcPtr != 0 && *srcPtr != 1) { len++; srcPtr++; } if (*srcPtr == 1) srcPtr++; uint maxLen = window->textMaxLength - len; if (window->flags & 1) window->textColumnOffset += 4; maxLen /= 2; while (maxLen--) windowPutChar(window, 32); srcPtr = tmp; uint verb = READ_BE_UINT16(srcPtr); srcPtr += 2; while (*srcPtr != 0) { windowPutChar(window, *srcPtr++); } srcPtr++; if (verb != 0xFFFE) { HitArea *ha = findEmptyHitArea(); ha->x = window->x * 8 + 3; ha->y = window->textRow * 8 + window->y; ha->data = menuNum; ha->width = window->width * 8 - 6; ha->height = 7; ha->flags = kBFBoxInUse | kBFInvertTouch; ha->id = 30000; ha->priority = 1; ha->verb = verb; } newline = 0xFFFF; } mouseOn(); }
void drawScene(void) { clearWindow(); // clear the window table.draw(); // redraw the table glutSwapBuffers(); // swap buffers when double buffered }
void rcopy_runloop(char *server_host, uint16_t server_port, char *remote_file_name, char *output_file_name, uint32_t buf_size, uint32_t window_size) { int output_fd = -1; int select_count = 0; int state = STATE_FILENAME; Window *window = NULL; while (state != STATE_DONE) { switch (state) { case STATE_FILENAME: if (connectToServer(server_host, server_port, &server)) { perror("ERROR: unable to connect to host"); exit(1); } state = filename(remote_file_name, buf_size, window_size); if (state == STATE_FILENAME) { close(server.socket_num); } select_count++; if (select_count >= MAX_RETRIES) { fprintf(stderr, "Ten failed filename tries: unable to reach server\n"); exit(1); } break; case STATE_FILE_OK: select_count = 0; if((output_fd = open(output_file_name, O_WRONLY|O_CREAT|O_TRUNC, 0600)) < 0 ) { perror("Open local_file"); exit(1); } window = newWindowWithSizeAndBuffer(window_size, buf_size); state = STATE_RECV_DATA; break; case STATE_RECV_DATA: state = recv_data(window); break; case STATE_WINDOW_FULL: state = window_full(window, output_fd); clearWindow(window); window->base_seq_num += window->window_size; window->buffer_size = 0; break; case STATE_EOF: if (select_count == 0) { window_full(window, output_fd); } select_count++; if (select_count >= MAX_RETRIES) { fprintf(stderr, "Ten failed EOF acks: file is ok but server doesn't know\n"); state = STATE_DONE; } else { state = recv_eof(window, output_fd); } break; case STATE_DONE: default: break; } } if (window != NULL) { destroyWindow(window); window = NULL; } close(output_fd); }
void Form::acceptForm() { QStringList studentList, studentList2; if(ui->lineAppNumber->text() == "" || ui->lineSurname->text() == "" || ui->lineOthernames->text() == "" || ui->lineExamNumber->text() == "" || ui->lineAddress->text() == "") { QMessageBox::critical(this, "Error", "You cannot leave column(s) blankly", QMessageBox::Ok); } else { if(ui->lineExamNumber->text() != ""){ if(ui->listWidget->count() < 5){ QMessageBox::critical(this, tr("Error!"), tr("You must have at least 5 O'Level subjects"), QMessageBox::Ok); viewDialog(); return; } } if(ui->checkBoxTwoSittings->isChecked()){ if(ui->lineExamNumber2->text() == "" || ui->listWidget_2->count() < 5){ QMessageBox::critical(this, windowTitle(), tr("Make sure you fill in the exam year" " and at least 5 subjects are chosen"), QMessageBox::Ok); return; } else { int allStudentsCount = ui->listWidget_2->count(); for(int i = 0; i != allStudentsCount; ++i) { studentList2.append(ui->listWidget_2->item(i)->text()); } studentList2.insert(studentList2.begin(), ui->lineExamNumber2->text()); } } QStringList databaseList; databaseList << ui->lineAppNumber->text().trimmed() << ui->lineSurname->text().trimmed() << ui->lineOthernames->text().trimmed() << ui->lineAddress->text().trimmed() << ui->comboBoxSex->currentText() << ui->comboBoxLevel->currentText() << ui->comboBoxSession->currentText() << ui->comboBoxMaritalStatus->currentText() << ui->comboBoxReligion->currentText() << ui->comboBoxState->currentText() << ui->comboBoxDepartment->currentText() << ui->dateDOB->text() << ui->lineExamNumber->text().trimmed() << ui->lineExamNumber2->text().trimmed() << ui->comboBoxExamType->currentText() << ui->comboBoxExamType2->currentText() << ui->spinBoxYear->text() << ui->spinBoxYear2->text(); int allStudentsCounter = ui->listWidget->count(); for(int i = 0; i != allStudentsCounter; ++i) { studentList.append(ui->listWidget->item(i)->text()); } studentList.insert(studentList.begin(), ui->lineExamNumber->text()); if(database){ if(database.addNewStudent(databaseList, studentList, studentList2) && generatePassword(databaseList[0])) { switch(QMessageBox::information(this, "Sucess", "New Record Saved Successfully! Add more?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) { case QMessageBox::No: this->close(); break; case QMessageBox::Yes: clearWindow(); break; default: this->close(); break; } } else { QMessageBox::information(this, tr("Error"), tr("There was an error trying to save the record into the database. Please" " check all inputs"), QMessageBox::Ok); } } } }
void AGOSEngine_PN::clearInputLine() { _inputting = false; _inputReady = false; clearWindow(_windowArray[2]); }