void chatinit::on_beginb_clicked() { std::vector<std::string> email_list; email_list.clear(); QList<QListWidgetItem*> recipients = ui->chatlist->findItems("",Qt::MatchContains); std::cout << recipients.size() << std::endl; for (int i=0; i < recipients.count(); ++i) { std::cout << "here's one" << std::endl; QListWidgetItem* item = recipients[i]; email_list.push_back( item->toolTip().toStdString()); } std::sort(email_list.begin(), email_list.end()); QString salt = ui->chatsalt->text(); QString title = ui->chattitle->text(); if (salt.isEmpty() ) { salt="a38e48f821"; } if (title.isEmpty() ) { ui->warn_notitle->show(); } else { std::cout << email_list.size() << std::endl; chatconvo->add(email_list, salt.toStdString(), title.toStdString()); emit regen(); close(); } }
static void run(int dir) { int i; i = 1; while (i) { i = moveplayer(dir); if (i > 0) { if (c[HASTEMONST]) { movemonst(); } movemonst(); randmonst(); regen(); } if (hitflag) { i = 0; } if (i != 0) { showcell(playerx,playery); } } }
// 主窗口的消息处理函数 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { switch (message) { case WM_ERASEBKGND: // 不清除背景,避免闪烁 break; case WM_PAINT: // 重绘主窗口 ondraw(hwnd); break; case WM_SIZE: // 改变窗口大小 regen(hwnd); break; case WM_DESTROY: // 退出 PostQuitMessage(0); break; case WM_LBUTTONDBLCLK: // 双击切换测试图形 switchTest(hwnd); break; case WM_MOUSEMOVE: // 鼠标移动 _pt = MAKEPOINTS(lparam); InvalidateRect(hwnd, NULL, FALSE); break; default: return DefWindowProc(hwnd, message, wparam, lparam); } return 0; }
int TetrominoRandomizer::getTetrominoType() { nbTetrominoReserve--; int val = randTetrominoType[nbTetrominoReserve]; if (nbTetrominoReserve == 0) regen(); return val; }
// Called every frame void UAbsorber::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) { Super::TickComponent(DeltaTime, TickType, ThisTickFunction); if (time<0) time += DeltaTime; else regen(DeltaTime); // ... }
void parse2(void) { if (c[HASTEMONST]) movemonst(); movemonst(); /* move the monsters */ randmonst(); regen(); }
void MainWindow::on_chatstart_pressed() { chat = new chatinit(mainconvos); chat->show(); connect(chat, SIGNAL(regen()), this, SLOT(anger())); chat->raise(); chat->activateWindow(); }
/* * function to adjust time when time warping and taking courses in school */ void adjusttime(long tim) { int j; for (j=0; j<IVENSIZE; j++) /* adjust time related parameters */ if (c[time_change[j]]) { if (c[time_change[j]] < tim+1) c[time_change[j]] = 1; else c[time_change[j]] -= tim; } regen(); }
void parse2(void) { /* move the monsters */ if (c[HASTEMONST]) { movemonst(); } movemonst(); randmonst(); regen(); }
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { current_type =1; clicked = false; ui->setupUi(this); ui->stackedWidget->setCurrentIndex(0); scene=new QGraphicsScene(0,0,ui->graphicsView->width(),ui->graphicsView->height()); ui->graphicsView->setScene(scene); world = new b2World(b2Vec2(0.0f, -9.8f)); GameItem::setGlobalSize(QSizeF(32,18),size()); //Land *myland=new Land(16,1.5,32,3,QPixmap("ground.png").scaled(width(),height()/6.0),world,scene); itemList.push_back(new Land(16,1.5,32,3,QPixmap("./GROUND.png").scaled(width(),height()/6.0),world,scene)); itemList.push_back(new Y_wood(4,10,0,0,QPixmap("./YY.png").scaled(100,300),world,scene)); //scene->addItem(myland); // Create bird (You can edit here) startX = 5.0; startY = 10.0; CurrentBird = new Bird(startX,startY,0.27f,&timer,QPixmap("Normal_Bird_1.png").scaled(height()/10.0,height()/10.0),world,scene,current_type); Fake = new Bird(0,0,0.0f,&timer,QPixmap("Normal_Bird_1.png").scaled(height()/10.0,height()/10.0),world,scene,current_type); FlyingBird = Fake; // Setting the Velocity //birdie->setLinearVelocity(b2Vec2(8,8)); itemList.push_back(CurrentBird); nobird = false; //scene->addItem(birdie); connect(&timer,SIGNAL(timeout()),this,SLOT(tick())); connect(this,SIGNAL(quitGame()),this,SLOT(QUITSLOT())); connect(&Re_gen,SIGNAL(timeout()),this,SLOT(regen())); }
void switchTest(HWND hwnd) { int a[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 | 0x40 | 0x02, 0x100, 0x200, 0x400 }; int n = sizeof(a)/sizeof(a[0]); int i = n; while (--i > 0 && a[i] != _tests) ; _tests = a[(i + 1) % n]; regen(hwnd); GiGdipCanvas canvas; if (canvas.beginPaintBuffered(1024, 768)) { TestCanvas::test(&canvas, _tests); WCHAR filename[MAX_PATH]; GetModuleFileNameW(NULL, filename, MAX_PATH); wcscpy_s(wcsrchr(filename, L'.'), 5, L".png"); canvas.save(filename); canvas.endPaint(); } }
TetrominoRandomizer::TetrominoRandomizer() { regen(); }