本文整理汇总了C++中mazewarinstance::Ptr::peeking方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::peeking方法的具体用法?C++ Ptr::peeking怎么用?C++ Ptr::peeking使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mazewarinstance::Ptr
的用法示例。
在下文中一共展示了Ptr::peeking方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoViewUpdate
void DoViewUpdate()
{
mws_render_wipe(M->state);
mws_render_draw(M->state);
/* XXX: Hack. I don't want to deal with setting updateView in
* the mws_* methods, thus just always update view, even
* if it is unnecessary.
*/
updateView = TRUE;
if (updateView) { /* paint the screen */
/* XXX: I don't think this is necessary anymore as the
* mws_render_* functions take care of it.
ShowPosition(MY_X_LOC, MY_Y_LOC, MY_DIR);
*/
if (M->peeking())
ShowView(M->xPeek(), M->yPeek(), M->dirPeek());
else
ShowView(MY_X_LOC, MY_Y_LOC, MY_DIR);
updateView = FALSE;
}
}
示例2: DoViewUpdate
void DoViewUpdate()
{
if (updateView) { /* paint the screen */
ShowPosition(MY_X_LOC, MY_Y_LOC, MY_DIR);
if (M->peeking())
ShowView(M->xPeek(), M->yPeek(), M->dirPeek());
else
ShowView(MY_X_LOC, MY_Y_LOC, MY_DIR);
updateView = FALSE;
}
}
示例3:
void
play(void)
{
MWEvent event;
MW244BPacket incoming;
event.eventDetail = &incoming;
while (TRUE) {
NextEvent(&event, M->theSocket());
if (!M->peeking())
switch(event.eventType) {
case EVENT_A:
aboutFace();
break;
case EVENT_S:
leftTurn();
break;
case EVENT_D:
forward();
break;
case EVENT_F:
rightTurn();
break;
case EVENT_BAR:
backward();
break;
case EVENT_LEFT_D:
peekLeft();
break;
case EVENT_MIDDLE_D:
shoot();
break;
case EVENT_RIGHT_D:
peekRight();
break;
case EVENT_NETWORK:
processPacket(&event);
break;
case EVENT_INT:
quit(0);
break;
}
else
switch (event.eventType) {
case EVENT_RIGHT_U:
case EVENT_LEFT_U:
peekStop();
break;
case EVENT_NETWORK:
processPacket(&event);
break;
}
ratStates(); /* clean house */
manageMissiles();
DoViewUpdate();
mws_update(M->state);
/* Any info to send over network? */
}
}
示例4: play
/* ----------------------------------------------------------------------- */
void play(void)
{ // initialisation
cout << "Starting Play" << endl;
//SetRatPosition(7,1,5,0);
proj.present = false;
proj.prev_x = proj.prev_y = proj.x = proj.y = 1;
int turn = 0;
updateSeqNo = true;
join = false;
for (int k = 0; k < 8; k++)
participants[k] = prevseq_a[k] = 0;
for (int k = 0; k < 8; k++)
expected_seqno[k] = k+1;
GLOBAL_ID = 0;
checking = 1;
checkingzero=1;
MWEvent event;
MW244BPacket incoming;
event.eventDetail = &incoming;
while (TRUE) {
turn ++;
NextEvent(&event, M->theSocket());
if (!M->peeking())
switch(event.eventType) {
case EVENT_A:
aboutFace();
break;
case EVENT_S:
leftTurn();
break;
case EVENT_D:
forward();
break;
case EVENT_F:
rightTurn();
break;
case EVENT_LEFT_D:
peekLeft();
break;
case EVENT_BAR:
shoot();
break;
case EVENT_RIGHT_D:
peekRight();
break;
case EVENT_NETWORK:
processPacket(&event);
break;
case EVENT_TIMEOUT:
checking = (++checking) % 25;
if (checking == 0 && !join){
cout << "Setting ID to zero" << endl;
join = true;
setMapping();
}
else {cout << "TIMEOUT" << endl;
participation = (++participation) % 30;
manageMissiles();
if (participation == 29)
{ ratStates(); /* clean house */
for (int i = 0 ; i < 8 ; i++)
participants[i] = 0;
}
}
break;
case EVENT_INT:
quit(0);
break;
}
else
switch (event.eventType) {
case EVENT_RIGHT_U:
case EVENT_LEFT_U:
peekStop();
break;
case EVENT_NETWORK:
processPacket(&event);
break;
}
DoViewUpdate();
checking ++;
manageMissiles();
//.........这里部分代码省略.........