void drawClock(int hours, int minutes, int seconds) { //get current cursor positon uint32_t prev_xPos = GetXPos(); uint32_t prev_yPos = GetYPos(); //move the curser to the top left GotoXY(0,0); //show hours if (hours <= 9) { DisplayInteger(0); } DisplayInteger(hours); DisplayChar(':'); //show minutes if (minutes <= 9) { DisplayInteger(0); } DisplayInteger(minutes); DisplayChar(':'); //show seconds if (seconds <= 9) { DisplayInteger(0); } DisplayInteger(seconds); //reset the cursor to it's previous position GotoXY(prev_xPos, prev_yPos); }
//----------------------------------------------------------------------------- // Purpose: Set whether the ship is exploding //----------------------------------------------------------------------------- void CShip::SetExploding( bool bExploding ) { // If we are already in the specified state, no need to do the below work if ( m_bExploding == bExploding ) return; Steamworks_TestSecret(); // Track that we are exploding, and disable collision detection m_bExploding = bExploding; SetCollisionDetectionDisabled( m_bExploding ); if ( bExploding ) { for( int i = 0; i < SHIP_DEBRIS_PIECES; ++i ) { CShipDebris * pDebris = new CShipDebris( m_pGameEngine, GetXPos(), GetYPos(), m_dwShipColor ); m_ListDebris.push_back( pDebris ); } } else { std::list<CShipDebris *>::iterator iter; for( iter = m_ListDebris.begin(); iter != m_ListDebris.end(); ++iter ) delete *iter; m_ListDebris.clear(); } }
void AllegroTextBox::Draw() { int bbx; int bby; int bbw; int bbh; QString display = m_value; if (m_passwordMode) display.fill('*'); al_get_text_dimensions(m_boxFont, display.toStdString().c_str(), &bbx, &bby, &bbw, &bbh); int x1 = GetXPos(); int y1 = GetYPos(); int x2 = x1 + GetWidth(); int y2 = y1 + GetHeight(); al_draw_filled_rectangle(x1, y1, x2, y2, m_backgroundColor); al_draw_rectangle(x1, y1, x2, y2, GetFocus() ? m_focusedBorder : m_defaultBorder, 1); bool Overflow = (bbw > GetWidth() - m_sidePadding * 2); al_set_clipping_rectangle((m_xPos+m_sidePadding), m_yPos, (GetWidth()-m_sidePadding*2), GetHeight()); al_draw_text(m_boxFont, m_textColor, Overflow ? (m_xPos+GetWidth()-m_sidePadding) : (m_xPos+m_sidePadding), (m_yPos + (GetHeight() / 2) - bbh/2), Overflow ? ALLEGRO_ALIGN_RIGHT : ALLEGRO_ALIGN_LEFT, display.toStdString().c_str()); al_reset_clipping_rectangle(); }
BOOL ClipboardCut(void) { if (!ClipboardCopy()) return (FALSE); DeleteSelected(17); GetXPos(&CurrCol); ShowEditCaret(); return (TRUE); }
void CCEtoODBView::getLayerViewData(CNamedView& namedView) { namedView.setScaleNum(ScaleNum); namedView.setScaleDenom(ScaleDenom); namedView.setScrollX(GetXPos()); namedView.setScrollY(GetYPos()); GetDocument()->getLayerViewData(namedView); }
void KinectPlayer::Render() { // if (!mPlayerPresent) { // return; // } std::vector<UserData> users; mUserTracking.GetUsers(users); if (users.empty()) { return; } al_set_target_bitmap(mBitmap); al_clear_to_color(al_map_rgb(0x00, 0x00, 0x00)); al_convert_mask_to_alpha(mBitmap, al_map_rgb(0x00, 0x00, 0x00)); xn::SceneMetaData scene_meta; mUserTracking.GetUserPixels(users[0], scene_meta); const XnRGB24Pixel* pRgbBuf = mKinect.GetImageData(); const XnLabel* pLabelBuf = scene_meta.Data(); ALLEGRO_LOCKED_REGION* lock = al_lock_bitmap(mBitmap, al_get_bitmap_format(mBitmap), ALLEGRO_LOCK_WRITEONLY); al_set_target_bitmap(mBitmap); for (int y = 0; y < mBitmapHeight; y++) { for (int x = 0; x < mBitmapWidth; x++, pLabelBuf++, pRgbBuf++) { if (*pLabelBuf == users[0].GetId()) { al_put_pixel(x, y, al_map_rgb(pRgbBuf->nRed, pRgbBuf->nGreen, pRgbBuf->nBlue)); } } } al_unlock_bitmap(mBitmap); const int screen_x_res = al_get_display_width(al_get_current_display()); const int screen_y_res = al_get_display_height(al_get_current_display()); al_set_target_bitmap(al_get_backbuffer(al_get_current_display())); al_draw_scaled_bitmap(mBitmap, 0, 0, mBitmapWidth, mBitmapHeight, GetXPos(), GetYPos(), GetWidth(), GetHeight(), 0); }
//Goto Coordinates - Goes to coordinates specified by input //Input: coordinates in x,y format (int) //Output: None int stepperDriver::GotoPos(int x, int y) { int temp = 0; //Calculate X difference and travel X coordinates int current = GetXPos(); x = x - current; temp = MoveX(x); //Calculate Y difference and travel Y coordinates current = GetYPos(); y = y - current; temp = MoveY(y); return 0; }
void nuiScrollView::OnSmoothScrolling(const nuiEvent& rEvent) { if (!mTimerOn) return; if (!mLeftClick) { float XOffset = mpHorizontal->GetRange().GetValue(); float YOffset = mpVertical->GetRange().GetValue(); float xdiff = XOffset - mXOffset; float ydiff = YOffset - mYOffset; if (xdiff > 2 || xdiff < -2) mXOffset += xdiff * NUI_SMOOTH_SCROLL_RATIO; else mXOffset = XOffset; if (ydiff > 2 || ydiff < -2) mYOffset += ydiff * NUI_SMOOTH_SCROLL_RATIO; else mYOffset = YOffset; if (mXOffset == XOffset && mYOffset == YOffset) { mTimerOn = false; } if (mSpeedX != 0) { SetXPos(GetXPos() + mSpeedX); //mXOffset = GetXPos(); mSpeedX *= 0.7; } if (mSpeedY != 0) { SetYPos(GetYPos() + mSpeedY); //mYOffset = GetYPos(); mSpeedY *= 0.7; } } UpdateLayout(); OffsetsChanged(); }
//----------------------------------------------------------------------------- // Purpose: Build the update data to send from server to clients //----------------------------------------------------------------------------- void CShip::BuildServerUpdate( ServerShipUpdateData_t *pUpdateData ) { pUpdateData->SetDisabled( BIsDisabled() ); pUpdateData->SetExploding( BIsExploding() ); pUpdateData->SetXAcceleration( GetXAccelerationLastFrame() ); pUpdateData->SetYAcceleration( GetYAccelerationLastFrame() ); pUpdateData->SetXPosition( GetXPos()/(float)m_pGameEngine->GetViewportWidth() ); pUpdateData->SetYPosition( GetYPos()/(float)m_pGameEngine->GetViewportHeight() ); pUpdateData->SetXVelocity( GetXVelocity() ); pUpdateData->SetYVelocity( GetYVelocity() ); pUpdateData->SetRotation( GetAccumulatedRotation() ); pUpdateData->SetRotationDeltaLastFrame( GetRotationDeltaLastFrame() ); pUpdateData->SetForwardThrustersActive( m_bForwardThrustersActive ); pUpdateData->SetReverseThrustersActive( m_bReverseThrustersActive ); BuildServerPhotonBeamUpdate( pUpdateData ); }
BOOL SearchAgain(WORD Flags) /*Flags: 1=Reverse (search in opposite direction) * 2=pop up dialog if not searched before */ { BOOL Return; ULONG OldLength; HideEditCaret(); if (Flags & 2 && !MatchValid) { SearchDialog(); return (TRUE); } OldLength = SelectCount; if (OldLength) { InvalidateArea(&SelectStart, SelectCount, 1); SelectCount = 0; UpdateWindow(hwndMain); } SelectStart = CurrPos; Return = SearchAndStatus(&SelectStart, (WORD)((Flags & 1) | 2)); if (Return) { if ((OldLength==0 && Mode!=InsertMode) || ComparePos(&SelectStart, &CurrPos) == 0) { if (CountBytes(&EndMatch) - CountBytes(&StartPos) == OldLength) { SelectStart = CurrPos; Return = SearchAndStatus(&SelectStart, (WORD)(Flags & 1)); } } if (Return) { NewPosition(&SelectStart); UpdateWindow(hwndMain); SelectStart = StartPos; SelectBytePos = CountBytes(&StartPos); SelectCount = CountBytes(&EndMatch) - SelectBytePos; InvalidateArea(&SelectStart, SelectCount, 0); UpdateWindow(hwndMain); } } CheckClipboard(); ShowEditCaret(); GetXPos(&CurrCol); return (Return); }
void TalkWndPaint(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { INT LinkingTime = 0; HDC Hdc; PAINTSTRUCT ps; RECT Rect; char pDateBuf[TITLE_BUF_LEN] = {0}; int xPos = 0; Hdc = BeginPaint(hWnd, &ps); GetClientRect(hWnd, &Rect); FastFillRect(Hdc, &Rect, BACKGROUND_COLOR); Hdc->bkcolor = BACKGROUND_COLOR; Hdc->textcolor = FONT_COLOR; switch(g_TalkInfo.talking.dwTalkState) { case ST_CO_WAIT_CALLOUT_ACK: case ST_CO_WAIT_PICKUP: { if (MM_TYPE_TALK_MC == g_TalkInfo.talking.bMMType) { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_CALLOUT_EN); MXDrawText_Left(Hdc, STR_CALLOUT_EN, xPos, 1); MXDrawText_Left(Hdc, STR_MC_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_MC_CN); MXDrawText_Left(Hdc, STR_CALLOUT_CN, xPos, 1); MXDrawText_Left(Hdc, STR_MC_CN, xPos, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_CALLOUT)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_CALLOUT), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_MC), xPos, 2); } } else if (MM_TYPE_TALK_GM == g_TalkInfo.talking.bMMType) { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_CALLOUT_EN); MXDrawText_Left(Hdc, STR_CALLOUT_EN, xPos, 1); MXDrawText_Left(Hdc, STR_CGM_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_MC_CN); MXDrawText_Left(Hdc, STR_CALLOUT_CN, xPos, 1); MXDrawText_Left(Hdc, STR_CGM_CN, xPos, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_CALLOUT)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_CALLOUT), xPos, 1); MXDrawText_Right(Hdc,"CGM", xPos, 2); } } else { if (SET_ENGLISH == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CALLOUT_EN, 1); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CALLOUT_CN, 1); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_CALLOUT), 1); } CodeShowFormat(Hdc, &Rect, 2); } break; } case ST_CO_TALKING: case ST_CI_TALKING: { LinkingTime = g_SysConfig.TalkTime - ((g_TalkInfo.Timer.dwCurrentTick - g_TalkInfo.Timer.dwTalkTimer) / 1000); if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_CONVERTIME_EN); MXDrawText_Left(Hdc, STR_CONVERTIME_EN, xPos, 1); MXDrawText_Left(Hdc, STR_REMAIN_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_CONVERTIME_CN); MXDrawText_Left(Hdc, STR_CONVERTIME_CN, xPos, 1); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_CONVERTIME)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_CONVERTIME), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_REMAINING), xPos, 2); } memset(pDateBuf, 0, TITLE_BUF_LEN); pDateBuf[0] = LinkingTime / 100 + 0x30; pDateBuf[1] = (LinkingTime % 100) / 10 + 0x30; pDateBuf[2] = (LinkingTime % 100) % 10 + 0x30; if (SET_ENGLISH == g_SysConfig.LangSel) { strcat(pDateBuf, STR_SEC_EN); MXDrawText_Left(Hdc, pDateBuf, xPos, 3); } else if (SET_CHINESE == g_SysConfig.LangSel) { strcat(pDateBuf, STR_SEC_CN); MXDrawText_Left(Hdc, pDateBuf, xPos, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { strcat(pDateBuf, GetHebrewStr( HS_ID_SECONDS)); MXDrawText_Right(Hdc, pDateBuf,xPos, 2); } break; } case ST_CI_WAIT_PICKUP: case ST_CI_WAIT_PICKUP_ACK: { if (MM_TYPE_TALK_MC == g_TalkInfo.talking.bMMType) { #ifdef NEW_OLED_ENABLE if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_PRESSANSWER_EN); MXDrawText_Left(Hdc, STR_MCCALL_EN, xPos, 1); MXDrawText_Left(Hdc, STR_PRESSANSWER_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_MC_CN); MXDrawText_Left(Hdc, STR_MC_CN, xPos, 0); MXDrawText_Left(Hdc, STR_CALLIN_CN, xPos, 1); MXDrawText_Left(Hdc, STR_PRESSANSWER_CN, xPos, 3); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_MCCALLIN)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_MCCALLIN), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_PRESSANSWER), xPos, 2); } #else if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_PRESSANSWER_EN); MXDrawText_Left(Hdc, STR_MCCALL_EN, xPos, 1); MXDrawText_Left(Hdc, STR_PRESSANSWER_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_MC_CN); MXDrawText_Left(Hdc, STR_MC_CN, xPos, 1); MXDrawText_Left(Hdc, STR_CALLIN_CN, xPos, 2); MXDrawText_Left(Hdc, STR_PRESSANSWER_CN, xPos, 4); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_MCCALLIN)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_MCCALLIN), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_PRESSANSWER), xPos, 2); } #endif } else if (MM_TYPE_TALK_GM == g_TalkInfo.talking.bMMType) { #ifdef NEW_OLED_ENABLE if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_PRESSANSWER_EN); MXDrawText_Left(Hdc, STR_CGMCALL_EN, xPos, 1); MXDrawText_Left(Hdc, STR_PRESSANSWER_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_CALLIN_CN); MXDrawText_Left(Hdc, STR_CGM_CN, xPos, 0); MXDrawText_Left(Hdc, STR_CALLIN_CN, xPos, 1); MXDrawText_Left(Hdc, STR_PRESSANSWER_CN, xPos, 3); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_PRESSANSWER)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_CGMCALLIN), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_PRESSANSWER), xPos, 2); } #else if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_PRESSANSWER_EN); MXDrawText_Left(Hdc, STR_CGMCALL_EN, xPos, 1); MXDrawText_Left(Hdc, STR_PRESSANSWER_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_CALLIN_CN); MXDrawText_Left(Hdc, STR_CGM_CN, xPos, 1); MXDrawText_Left(Hdc, STR_CALLIN_CN, xPos, 2); MXDrawText_Left(Hdc, STR_PRESSANSWER_CN, xPos, 4); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_PRESSANSWER)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_CGMCALLIN), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_PRESSANSWER), xPos, 2); } #endif } else { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_PRESSANSWER_EN); MXDrawText_Left(Hdc, STR_HMCALL_EN, xPos, 0); MXDrawText_Left(Hdc, STR_PRESSANSWER_EN, xPos, 1); CodeShowFormat(Hdc, &Rect, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_HVCALLIN_CN); MXDrawText_Left(Hdc, STR_HVCALLIN_CN, xPos, 0); MXDrawText_Left(Hdc, STR_PRESSANSWER_CN, xPos, 1); CodeShowFormat(Hdc, &Rect, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_HVCALLIN)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_HVCALLIN), xPos, 0); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_PRESSANSWER), xPos, 1); CodeShowFormat(Hdc, &Rect, 2); } } break; } case ST_CO_CALL_FAIL: { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_TRYAGAIN_EN); MXDrawText_Left(Hdc, STR_LINEBUSY_EN, xPos, 1); MXDrawText_Left(Hdc, STR_TRYAGAIN_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_TRYAGAIN_CN); MXDrawText_Left(Hdc, STR_LINEBUSY_CN, xPos, 1); MXDrawText_Left(Hdc, STR_TRYAGAIN_CN, xPos, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_TRYAGAIN)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_LINEBUSY), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_TRYAGAIN), xPos, 2); } break; } case ST_CI_WAIT_HANGUP_ACK: case ST_CO_WAIT_HANGUP_ACK: case ST_TALK_END: { if (!bPickUp) { if (SET_ENGLISH == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CALLEND_EN, 1); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CALLEND_CN, 1); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_CALLEND), 1); } } else { if (SET_ENGLISH == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CONVEREND_EN, 1); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CONVEREND_CN, 1); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr( HS_ID_CONVEREND), 1); } } break; } case ST_CO_NO_ANSWER: { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_TRYAGAIN_EN); MXDrawText_Left(Hdc, STR_NOANSWER_EN, xPos, 1); MXDrawText_Left(Hdc, STR_TRYAGAIN_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_TRYAGAIN_CN); MXDrawText_Left(Hdc, STR_NOANSWER_CN, xPos, 1); MXDrawText_Left(Hdc, STR_ANSWERLATER_CN, xPos, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_ANSWERLATER)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_NOANSWER), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_ANSWERLATER), xPos, 2); } break; } case ST_TALK_LEAVEPHOTO: case ST_TALK_WAIT_LEAVEPHOTO: { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_TRYLATER_EN); MXDrawText_Left(Hdc, STR_IMGCAP_EN, xPos, 1); MXDrawText_Left(Hdc, STR_TRYLATER_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_ANSWERLATER_CN); MXDrawText_Left(Hdc, STR_IMGCAP_CN, xPos, 1); MXDrawText_Left(Hdc, STR_ANSWERLATER_CN, xPos, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_ANSWERLATER)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_IMGCAP), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_ANSWERLATER), xPos, 2); } break; } case ST_CO_CALL_CODE_INEXIST: { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_RESINUM_EN); MXDrawText_Left(Hdc, STR_RESINUM_EN, xPos, 1); MXDrawText_Left(Hdc, STR_NOTREGISTER_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_ROOMNUMERROR_CN, 1); } else if(SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_NOTREGISTER)); MXDrawText_Right(Hdc, GetHebrewStr(HS_ID_NOTREGISTER), xPos, 1); } break; } default: break; } EndPaint(hWnd, &ps); }
/*hdr ** Copyright Mox Products, Australia ** ** FUNCTION NAME: AsAlarmWndPaint ** AUTHOR: Jeff Wang ** DATE: 05 - May - 2009 ** ** DESCRIPTION: ** ** ** ARGUMENTS: ARGNAME DRIECTION TYPE DESCRIPTION ** None ** RETURNED VALUE: ** None ** NOTES: ** */ static void AsAlarmWndPaint(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { HDC Hdc; PAINTSTRUCT ps; RECT Rect; CHAR pDateBuf[TITLE_BUF_LEN] = {0}; INT xPos = 0; Hdc = BeginPaint(hWnd, &ps); GetClientRect(hWnd, &Rect); FastFillRect(Hdc, &Rect, BACKGROUND_COLOR); Hdc->bkcolor = BACKGROUND_COLOR; Hdc->textcolor = FONT_COLOR; switch(AsAlarmStep) { case STEP_GATEOPENOVERTIME_ALARM: { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_ETRPWD_EN); MXDrawText_Left(Hdc, STR_GATEOPEN_EN, xPos, 0); MXDrawText_Left(Hdc, STR_OVERTIMEALARM_EN, xPos, 1); MXDrawText_Left(Hdc, STR_ETRPWD_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_GATEOVERTIMEALARM_CN); MXDrawText_Left(Hdc, STR_GATEOVERTIMEALARM_CN, xPos, 1); MXDrawText_Left(Hdc, STR_ETRPWD_CN, xPos, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_GATEOVERTIMEALARM)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_GATEOVERTIMEALARM), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_ETRPWD), xPos, 2); } memset(pDateBuf, 42, 19); MulLineDisProc(Hdc, pDateBuf, g_KeyInputBufferLen, 3); } break; case STEP_IVDCARD_ALARM: { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_ETRPWD_EN); MXDrawText_Left(Hdc, STR_INVALIDCARD_EN, xPos, 0); MXDrawText_Left(Hdc, STR_SWIPEALARM_EN, xPos, 1); MXDrawText_Left(Hdc, STR_ETRPWD_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_INVALIDCARDSWIPEALARM_CN); MXDrawText_Left(Hdc, STR_INVALIDCARDSWIPEALARM_CN, xPos, 1); MXDrawText_Left(Hdc, STR_ETRPWD_CN, xPos, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_INVALIDCARDSWIPEALARM)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_INVALIDCARDSWIPEALARM), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_ETRPWD), xPos, 2); } memset(pDateBuf, 42, 19); MulLineDisProc(Hdc, pDateBuf, g_KeyInputBufferLen, 3); } break; case STATUS_INFRARED_ALARM: { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_ETRPWD_EN); MXDrawText_Left(Hdc, STR_INFRAREDALARM_EN, xPos, 1); MXDrawText_Left(Hdc, STR_ETRPWD_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_ETRPWD_CN); MXDrawText_Left(Hdc, STR_INFRAREDALARM_CN, xPos, 1); MXDrawText_Left(Hdc, STR_ETRPWD_CN, xPos, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_INFRAREDALARM)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_INFRAREDALARM), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_ETRPWD), xPos, 2); } memset(pDateBuf, 42, 19); MulLineDisProc(Hdc, pDateBuf, g_KeyInputBufferLen, 3); } break; case STEP_ALARM_CANCEL: { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_ALARMCANCEL_EN); MXDrawText_Left(Hdc, STR_ALARMCANCEL_EN, xPos, 3); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_ALARMCANCEL_CN); MXDrawText_Left(Hdc, STR_ALARMCANCEL_CN, xPos, 3); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_ALARMCANCEL), 3); } } break; case STEP_PWD_ERROR: { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_PWDIS_EN); MXDrawText_Left(Hdc, STR_PWDIS_EN, xPos, 1); MXDrawText_Left(Hdc, STR_INCORRECT_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_PWDINCORRECT_CN, 1); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_PWDINCORRECT), 1); } } break; default: break; } EndPaint(hWnd, &ps); }
/*hdr ** Copyright Mox Products, Australia ** ** FUNCTION NAME: IPSetWndPaint ** AUTHOR: Jeff Wang ** DATE: 21 - Aug - 2008 ** ** DESCRIPTION: ** ** ** ARGUMENTS: ARGNAME DRIECTION TYPE DESCRIPTION ** None ** RETURNED VALUE: ** None ** NOTES: ** */ static VOID DelCardModeWndPaint(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { HDC Hdc; PAINTSTRUCT ps; RECT Rect; INT xPos = 0; Hdc = BeginPaint(hWnd, &ps); GetClientRect(hWnd, &Rect); FastFillRect(Hdc, &Rect, BACKGROUND_COLOR); Hdc->bkcolor = BACKGROUND_COLOR; Hdc->textcolor = FONT_COLOR; switch(DelCardModeStep) { case STEP_STAMPCARD: { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_SWIPECARD_EN); MXDrawText_Left(Hdc, STR_SWIPECARD_EN, xPos, 1); MXDrawText_Left(Hdc, STR_PRESSEXIT_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_PRESSEXIT_CN); MXDrawText_Left(Hdc, STR_SWIPECARD_CN, xPos, 1); MXDrawText_Left(Hdc, STR_PRESSEXIT_CN, xPos, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_SWIPECARD)); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_SWIPECARD), xPos, 1); MXDrawText_Right(Hdc,GetHebrewStr(HS_ID_PRESSEXIT), xPos, 2); } } break; case STEP_CARDHASDEL: { if (SET_ENGLISH == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CARDHASDELETED_EN, 1); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CARDHASDELETED_CN, 1); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_CARDHASDELETED), 1); } } break; case STEP_CONFIRM: { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_AREYOUSURE_EN); MXDrawText_Left(Hdc, STR_AREYOUSURE_EN, xPos, 1); MXDrawText_Left(Hdc, STR_TODELETE_EN, xPos, 2); // MXDrawText_Center(Hdc, STR_CONFDELETE_EN, 1); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CONFDELETE_CN, 1); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_CONFDELETE), 1); } } break; case STEP_CARDDELSUCCESS: { if (SET_ENGLISH == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CARDDELETED_EN, 1); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CARDDELETED_CN, 1); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_CARDDELETED), 1); } } break; default: break; } EndPaint(hWnd, &ps); }
BOOL ClipboardPaste(void) { HGLOBAL hMem = 0; LPSTR lpMem; UINT uFormat = CharSet == CS_OEM ? CF_OEMTEXT : CF_TEXT; LONG lSize; MODEENUM SaveMode; BOOL FreeConversionMemory = FALSE; if (IsViewOnly()) return(FALSE); /*prepare resources...*/ if (!OpenClipboard(hwndMain)) { ErrorBox(MB_ICONEXCLAMATION, 302); return (FALSE); } /*first check for binary data containing null bytes...*/ if (UtfEncoding != 16 && (hMem = GetClipboardData(uFormat)) != 0) { lSize = GlobalSize(hMem); if ((lpMem = GlobalLock(hMem)) != NULL) { LPSTR lp; LONG lRemain; lp = _fmemchr(lpMem, '\0', (size_t)lSize); if (lp != NULL && (lp-lpMem+sizeof(BinaryPart)) <= (size_t)lSize && lp[1]==BinaryFormat[0] && _fmemchr(lp+1, '\0', lSize-(lp+1-lpMem)) != NULL && _fmemcmp(lp+1, BinaryFormat, 10) == 0) { /*insert first part of null containing binary data...*/ SaveMode = Mode; if (Mode != InsertMode && Mode != ReplaceMode) { StartUndoSequence(); Mode = InsertMode; } if (SelectCount) DeleteSelected(17); else EnterDeleteForUndo(&CurrPos, 0, 1); /*force new undo elem*/ Mode = SaveMode; HideEditCaret(); if (*lpMem) InsertBuffer(lpMem, (UINT)(lp-lpMem), 0); lRemain = strtoul(lp+11, &lp, 10); if (*lp != ':') lSize = 0; else { if (lSize >= (lp - lpMem) + lRemain) lSize = lRemain; else lSize = 0; lpMem = lp + 1; } if (lSize) InsertBuffer(lpMem, (UINT)lSize, 1); GetXPos(&CurrCol); ShowEditCaret(); /*clean up...*/ GlobalUnlock(hMem); CloseClipboard(); return (TRUE); } GlobalUnlock(hMem); hMem = 0; } } /*then, if running on Windows NT, try to get wide chars...*/ if (!(GetVersion() & 0x80000000U) && CharSet != CS_EBCDIC) { UINT Cp; if (UtfEncoding == 8) Cp = CP_UTF8; else if (CharSet == CS_ANSI) Cp = AnsiCodePage; else Cp = OemCodePage; if (Cp) { HGLOBAL hWideCharMem = GetClipboardData(CF_UNICODETEXT); WCHAR *lpWideCharMem; if (hWideCharMem) { lSize = GlobalSize(hWideCharMem); lpWideCharMem = GlobalLock(hWideCharMem); if (lpWideCharMem != NULL) { INT nSizeRequired; PWCHAR wp; lSize >>= 1; wp = wmemchr(lpWideCharMem, '\0', lSize); if (wp != NULL) lSize = wp - lpWideCharMem; if (UtfEncoding == 16) { lSize <<= 1; if (UtfLsbFirst) { hMem = hWideCharMem; lpMem = (LPSTR)lpWideCharMem; } else { hMem = GlobalAlloc(GMEM_MOVEABLE, lSize); if (hMem) { lpMem = GlobalLock(hMem); if (lpMem != NULL) { INT i = 0; while ((i += 2) <= lSize) { lpMem[i-2] = *lpWideCharMem >> 8; lpMem[i-1] = *lpWideCharMem++ & 255; } FreeConversionMemory = TRUE; } else { GlobalFree(hMem); hMem = 0; } } } } else {
void Undo(WORD Flags) /* Flags: 0 = called as vi-like undo: * undo of whole last operation, * a second undo reverts the undo operation, * entered as character 'u'; * 1 = called as Windows-like undo: * undo last change at one position, * repeated undos go further back in history, * entered as <Alt+Bksp>, menu, or tool button; * 2 = repeated vi-like undo ('.'): * can repeat both undo and redo; * 4 = vi-like undo of whole line: * not yet implemented, * entered as character 'U'; */ { LPUNDO lpUndo; BOOL fUndone = FALSE; ULONG StartSkip = (ULONG)-1; extern INT HexEditFirstNibble; if (Flags & 3) lpUndo = NextSequenceUndo; else { lpUndo = NextSequenceUndo = LastUndo; if (LastUndo != NULL) { LastUndo->Flags |= UD_START; if (LastUndo->Flags & UD_BYUNDO) { if (Redoing && LastUndo->UndoRef!=NULL) lpUndo = LastUndo->UndoRef; Redoing ^= TRUE^FALSE; } else Redoing = FALSE; } } if (lpUndo==NULL || (Redoing && !(lpUndo->Flags & UD_BYUNDO))) { Error(219); return; } if (IsViewOnly()) return; if (UtfEncoding == 16) { /*any undo ops must be double-byte, check before doing anything...*/ LPUNDO lp = lpUndo; ULONG Skip; while (lp != NULL) { if ((Skip = lpUndo->Pos) != (ULONG)-1) { if (lp->DelFill & 1 || lp->Inserted & 1) { ErrorBox(MB_ICONSTOP, 260); return; } if (StartSkip == (ULONG)-1) StartSkip = Skip; if (Flags & 1) break; } if (lp->Flags & UD_NEWOP && StartSkip != (ULONG)-1) break; lp = lp->Prev; } StartSkip = (ULONG)-1; } HideEditCaret(); wsprintf(QueryString, "%s %s, used mem %lu", Redoing ? "redoing" : "undoing", lpUndo->Flags & UD_BYUNDO ? "undo" : "non-undo", UndoMemUsed); QueryTime = GetTickCount(); GlobalUndoFlags |= UD_BYUNDO; StartWithRemove = lpUndo->Flags & UD_START; StartUndoSequence(); if (FirstUndo == NULL || (FirstUndo->Next == NULL && FirstUndo != lpUndo)) lpUndo = NULL; StartWithRemove = TRUE; HexEditFirstNibble = -1; while (lpUndo != NULL) { POSITION Pos; ULONG Skip; if ((Skip = lpUndo->Pos) != (ULONG)-1) { if (StartSkip == (ULONG)-1) StartSkip = Skip; Pos.p = FirstPage; while (Skip >= Pos.p->Fill) { if (!Pos.p->Next) { if (Skip != Pos.p->Fill) { /*must not occur*/ assert(Skip == Pos.p->Fill); /*!?*/ return; } break; } Skip -= Pos.p->Fill; Pos.p = Pos.p->Next; } if (SelectCount) { InvalidateArea(&SelectStart, SelectCount, 1); SelectCount = 0; UpdateWindow(hwndMain); } Pos.i = (UINT)Skip; Pos.f = 0; /*TODO: check flags to be filled here*/ if (lpUndo->Inserted) { SelectStart = Pos; SelectCount = lpUndo->Inserted; SelectBytePos = CountBytes(&SelectStart); DeleteSelected(3); fUndone = TRUE; Indenting = FALSE; } if (lpUndo->DelFill) { LPSTR Buf; LONG ByteCount = CountBytes(&Pos); if (lpUndo->Flags & UD_GLOBALMEM) Buf = GlobalLock(lpUndo->DelMem); else Buf = (LPBYTE)lpUndo + sizeof(UNDO); if (Buf != NULL) { NewPosition(&Pos); InsertBuffer(Buf, lpUndo->DelFill, 0); fUndone = TRUE; if (lpUndo->Flags & UD_GLOBALMEM) GlobalUnlock(lpUndo->DelMem); /*reposition to current position...*/ Pos.p = FirstPage; Pos.i = 0; Advance(&Pos, ByteCount); if (lpUndo->Flags & UD_SELECT && Flags & 1) { SelectStart = Pos; SelectCount = lpUndo->DelFill; SelectBytePos = CountBytes(&SelectStart); InvalidateArea(&SelectStart, SelectCount, 0); CheckClipboard(); } } else ErrorBox(MB_ICONSTOP, 313); } if (Flags & 1) break; } if (lpUndo->Flags & UD_NEWOP && StartSkip != (ULONG)-1) break; lpUndo = lpUndo->Prev; } GlobalUndoFlags = 0; if (lpUndo != NULL) { if (lpUndo->Flags & UD_SAFE) { EnableToolButton(IDB_SAVE, FALSE); SetSafe(FALSE); GlobalUndoFlags = UD_SAFE; } else if (fUndone) SetUnsafe(); LastUndo->UndoRef = NextSequenceUndo = lpUndo->Prev; #if 0 // if (NextSequenceUndo!=NULL && lpUndo->Flags & UD_BYUNDO // && !(NextSequenceUndo->Flags&UD_BYUNDO)) // NextSequenceUndo->Flags &= ~UD_START; #endif } else { if (fUndone) SetUnsafe(); NextSequenceUndo = NULL; } if (Redoing) CheckForUndoneToRelease(FALSE); /*...undo information about redo and previous undo is not needed anymore * because the original undo information will be used instead. */ if (StartSkip != (ULONG)-1) { CurrPos.p = FirstPage; CurrPos.i = 0; Advance(&CurrPos, StartSkip); FindValidPosition(&CurrPos, (WORD)(Mode==InsertMode || Mode==ReplaceMode)); GetXPos(&CurrCol); } if (lpUndo==NULL || NextSequenceUndo==NULL) EnableToolButton(IDB_UNDO, FALSE); ShowEditCaret(); }
/*hdr ** Copyright Mox Products, Australia ** ** FUNCTION NAME: MainMenuWndPaint ** AUTHOR: Jeff Wang ** DATE: 21 - Aug - 2008 ** ** DESCRIPTION: ** ** ** ARGUMENTS: ARGNAME DRIECTION TYPE DESCRIPTION ** None ** RETURNED VALUE: ** None ** NOTES: ** */ static VOID GateParaSetWndPaint(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { HDC Hdc; PAINTSTRUCT ps; RECT Rect; int i = 0; INT xPos = 0; char pDateBuf[TITLE_BUF_LEN] = {0}; Hdc = BeginPaint(hWnd, &ps); GetClientRect(hWnd, &Rect); FastFillRect(Hdc, &Rect, BACKGROUND_COLOR); Hdc->bkcolor = BACKGROUND_COLOR; #ifdef NEW_OLED_ENABLE for(i = 0; i < GATEPARASETDEPTH; i++) { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(" Open Overtime"); /* if (g_GateParaSetting[i].bSelected) { memset(pDateBuf, '*',1); } else { memset(pDateBuf, ' ',1); } */ memset(pDateBuf, ' ',2); strcpy(&pDateBuf[2],g_GateParaSetting[i].MenuEnglishName); MXDrawText_Left(Hdc, pDateBuf, xPos, i); if (g_GateParaSetting[i].bSelected) { DrawEnglishCur(Hdc,xPos,i); } } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_OPENOVERTIME)); memset(pDateBuf, ' ',2); strcpy(&pDateBuf[2],GetHebrewStr(g_GateParaSetting[i].HebrewStrID) ); MXDrawText_Right(Hdc, pDateBuf, xPos, i +1); if (g_GateParaSetting[i].bSelected) { DrawHebrewCur(Hdc,xPos,i); } } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(" 门磁脉冲宽度"); /* if (g_GateParaSetting[i].bSelected) { memset(pDateBuf, '*',1); } else { memset(pDateBuf, ' ',1); } */ memset(pDateBuf, ' ',2); strcpy(&pDateBuf[2],g_GateParaSetting[i].MenuChineseName); MXDrawText_Left(Hdc, pDateBuf, xPos, i); if (g_GateParaSetting[i].bSelected) { DrawChineseCur(Hdc,xPos,i); } } } #else for(i = 0; i < GATEPARASETDEPTH; i++) { if (g_GateParaSetting[i].bSelected) { Hdc->textcolor = FONT_COLOR_SEL; } else { Hdc->textcolor = FONT_COLOR; } if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos("Open Overtime"); MXDrawText_Left(Hdc, g_GateParaSetting[i].MenuEnglishName, xPos, i); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos("门磁脉冲宽度"); MXDrawText_Left(Hdc, g_GateParaSetting[i].MenuChineseName, xPos, i); } else if (SET_HEBREW == g_SysConfig.LangSel) { xPos = HebrewGetXPos(Hdc,GetHebrewStr(HS_ID_OPENOVERTIME)); MXDrawText_Right(Hdc, GetHebrewStr(g_GateParaSetting[i].HebrewStrID), xPos, i+2); } } #endif EndPaint(hWnd, &ps); }
//----------------------------------------------------------------------------- // Purpose: Run a frame for the ship //----------------------------------------------------------------------------- void CShip::RunFrame() { if ( m_bDisabled ) return; const uint64 ulCurrentTickCount = m_pGameEngine->GetGameTickCount(); // Look for expired photon beams int nNextAvailablePhotonBeamSlot = -1; // Track next available slot for use spawning new beams below for( int i=0; i < MAX_PHOTON_BEAMS_PER_SHIP; ++i ) { if ( m_rgPhotonBeams[i] ) { if ( m_rgPhotonBeams[i]->BIsBeamExpired() ) { delete m_rgPhotonBeams[i]; m_rgPhotonBeams[i] = NULL; } } if ( !m_rgPhotonBeams[i] && nNextAvailablePhotonBeamSlot == -1 ) nNextAvailablePhotonBeamSlot = i; } // run all the photon beams we have outstanding for( int i=0; i < MAX_PHOTON_BEAMS_PER_SHIP; ++i ) { if ( m_rgPhotonBeams[i] ) m_rgPhotonBeams[i]->RunFrame(); } // run all the space debris { std::list<CShipDebris *>::iterator iter; for( iter = m_ListDebris.begin(); iter != m_ListDebris.end(); ++iter ) (*iter)->RunFrame(); } if ( m_bIsLocalPlayer ) { m_SpaceWarClientUpdateData.SetTurnLeftPressed( false ); m_SpaceWarClientUpdateData.SetTurnRightPressed( false ); if ( m_pGameEngine->BIsKeyDown( m_dwVKLeft ) ) { m_SpaceWarClientUpdateData.SetTurnLeftPressed( true ); } if ( m_pGameEngine->BIsKeyDown( m_dwVKRight ) ) { m_SpaceWarClientUpdateData.SetTurnRightPressed( true ); } } else if ( m_bIsServerInstance ) { // Server side float flRotationDelta = 0.0f; if ( m_SpaceWarClientUpdateData.GetTurnLeftPressed() ) { flRotationDelta += (PI_VALUE/2.0f) * -1.0f * (float)m_pGameEngine->GetGameTicksFrameDelta()/400.0f; } if ( m_SpaceWarClientUpdateData.GetTurnRightPressed() ) { flRotationDelta += (PI_VALUE/2.0f) * (float)m_pGameEngine->GetGameTicksFrameDelta()/400.0f; } SetRotationDeltaNextFrame( flRotationDelta ); } // Compute acceleration if ( m_bIsLocalPlayer ) { // client side m_SpaceWarClientUpdateData.SetReverseThrustersPressed( false ); m_SpaceWarClientUpdateData.SetForwardThrustersPressed( false ); if ( m_pGameEngine->BIsKeyDown( m_dwVKForwardThrusters ) || m_pGameEngine->BIsKeyDown( m_dwVKReverseThrusters ) ) { if ( m_pGameEngine->BIsKeyDown( m_dwVKReverseThrusters ) ) { m_SpaceWarClientUpdateData.SetReverseThrustersPressed( true ); } else { m_SpaceWarClientUpdateData.SetForwardThrustersPressed( true ); } } } else if ( m_bIsServerInstance ) { // Server side float xThrust = 0; float yThrust = 0; m_bReverseThrustersActive = false; m_bForwardThrustersActive = false; if ( m_SpaceWarClientUpdateData.GetReverseThrustersPressed() || m_SpaceWarClientUpdateData.GetForwardThrustersPressed() ) { float flSign = 1.0f; if ( m_SpaceWarClientUpdateData.GetReverseThrustersPressed() ) { m_bReverseThrustersActive = true; flSign = -1.0f; } else { m_bForwardThrustersActive = true; } if ( m_ulLastThrustStartedTickCount == 0 ) m_ulLastThrustStartedTickCount = ulCurrentTickCount; // You have to hold the key for a second to reach maximum thrust float factor = MIN( ((float)(ulCurrentTickCount - m_ulLastThrustStartedTickCount) / 500.0f) + 0.2f, 1.0f ); xThrust = flSign * (float)(MAXIMUM_SHIP_THRUST * factor * sin( GetAccumulatedRotation() ) ); yThrust = flSign * -1.0f * (float)(MAXIMUM_SHIP_THRUST * factor * cos( GetAccumulatedRotation() ) ); } else { m_ulLastThrustStartedTickCount = 0; } SetAcceleration( xThrust, yThrust ); } // We'll use these values in a few places below to compute positions of child objects // appropriately given our rotation float sinvalue = (float)sin( GetAccumulatedRotation() ); float cosvalue = (float)cos( GetAccumulatedRotation() ); if ( m_bIsLocalPlayer ) { // client side if ( m_pGameEngine->BIsKeyDown( m_dwVKFire ) ) { m_SpaceWarClientUpdateData.SetFirePressed( true ); } } else if ( m_bIsServerInstance ) { // server side if ( nNextAvailablePhotonBeamSlot != -1 && !m_bExploding && m_SpaceWarClientUpdateData.GetFirePressed() && ulCurrentTickCount - PHOTON_BEAM_FIRE_INTERVAL_TICKS > m_ulLastPhotonTickCount ) { m_ulLastPhotonTickCount = ulCurrentTickCount; float xVelocity = GetXVelocity() + ( sinvalue * 275 ); float yVelocity = GetYVelocity() - ( cosvalue * 275 ); // Offset 12 points up from the center of the ship, compensating for rotation float xPos = GetXPos() - sinvalue*-12.0f; float yPos = GetYPos() + cosvalue*-12.0f; m_rgPhotonBeams[nNextAvailablePhotonBeamSlot] = new CPhotonBeam( m_pGameEngine, xPos, yPos, m_dwShipColor, GetAccumulatedRotation(), xVelocity, yVelocity ); } } CSpaceWarEntity::RunFrame(); // Finally, update the thrusters ( we do this after the base class call as they rely on our data being fully up-to-date) m_ForwardThrusters.RunFrame(); m_ReverseThrusters.RunFrame(); }
/*hdr ** Copyright Mox Products, Australia ** ** FUNCTION NAME: IPSetWndPaint ** AUTHOR: Jeff Wang ** DATE: 27 - April - 2009 ** ** DESCRIPTION: ** ** ** ARGUMENTS: ARGNAME DRIECTION TYPE DESCRIPTION ** None ** RETURNED VALUE: ** None ** NOTES: ** */ static VOID DelRdModeWndPaint(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { HDC Hdc; PAINTSTRUCT ps; RECT Rect; INT xPos = 0; Hdc = BeginPaint(hWnd, &ps); GetClientRect(hWnd, &Rect); FastFillRect(Hdc, &Rect, BACKGROUND_COLOR); Hdc->bkcolor = BACKGROUND_COLOR; Hdc->textcolor = FONT_COLOR; switch(DelRdModeStep) { case STEP_ETR_RDNUM: { #ifdef NEW_OLED_ENABLE if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_ENTERNUM_EN); MXDrawText_Left(Hdc, STR_ENTERRES_EN, xPos, 0); MXDrawText_Left(Hdc, STR_ENTERNUM_EN, xPos, 1); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_ENTERRESNUM_CN); MXDrawText_Left(Hdc, STR_ENTERRESNUM_CN, xPos, 0); MXDrawText_Left(Hdc, STR_PRESSENTER_CN, xPos, 1); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_ENTERRESNUM), 1); } MulLineDisProc(Hdc, g_KeyInputBuffer, g_KeyInputBufferLen, 2); #else if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_ENTERNUM_EN); MXDrawText_Left(Hdc, STR_ENTERRES_EN, xPos, 1); MXDrawText_Left(Hdc, STR_ENTERNUM_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { xPos = GetXPos(STR_ENTERRESNUM_CN); MXDrawText_Left(Hdc, STR_ENTERRESNUM_CN, xPos, 1); MXDrawText_Left(Hdc, STR_PRESSENTER_CN, xPos, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_ENTERRESNUM), 2); } MulLineDisProc(Hdc, g_KeyInputBuffer, g_KeyInputBufferLen, 3); #endif } break; case STEP_CONFIRM: { if (SET_ENGLISH == g_SysConfig.LangSel) { // MXDrawText_Center(Hdc, STR_CONFDELETE_EN, 1); xPos = GetXPos(STR_AREYOUSURE_EN); MXDrawText_Left(Hdc, STR_AREYOUSURE_EN, xPos, 1); MXDrawText_Left(Hdc, STR_TODELETE_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CONFDELETE_CN, 1); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_CONFDELETE), 1); } } break; case STEP_DEL_SUCCESS: { if (SET_ENGLISH == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CARDDELETED_EN, 1); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_CARDDELETED_CN, 1); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_CARDDELETED), 1); } } break; case STEP_DEL_FAIL: { if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_RDNUMNTEX_EN); MXDrawText_Left(Hdc, STR_RDNUM_EN, xPos, 1); MXDrawText_Left(Hdc, STR_RDNUMNTEX_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_RDNUMNTEX_CN, 2); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_RDNUMNTEX), 2); } /* if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_RESINUM_EN); MXDrawText_Left(Hdc, STR_RESINUM_EN, xPos, 1); MXDrawText_Left(Hdc, STR_NOTREGISTER_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_ROOMNUMERROR_CN, 1); } */ } break; case STEP_DEL_NO_CARD: { /* if (SET_ENGLISH == g_SysConfig.LangSel) { xPos = GetXPos(STR_RDNUMNTEX_EN); MXDrawText_Left(Hdc, STR_RDNUM_EN, xPos, 1); MXDrawText_Left(Hdc, STR_RDNUMNTEX_EN, xPos, 2); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, STR_RDNUMNTEX_CN, 2); } */ if (SET_ENGLISH == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, PMT_ROOMCODE_NO_CARD_EN, 1); } else if (SET_CHINESE == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, PMT_ROOMCODE_NO_CARD_CN, 1); } else if (SET_HEBREW == g_SysConfig.LangSel) { MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_ROOMCODE_NO_CARD), 1); } } break; default: break; } EndPaint(hWnd, &ps); }
/** \param TileNum The tilenumber to use from the used tileset (see Sprite for more details). \param name The name of the Actor. \param XPos The x-coordinate at which the actor will be created. \param YPos the y-coordinate at which the actor will be created. */ void Actor::CreateActor(char TileNum, const std::string & name, long XPos, long YPos) { Create(TileNum, name, XPos, YPos); SetSpeed(7); // For most humans, the feet can be placed at the bottom-middle of the sprite. SetFootXYPos(GetXPos() + GetWidth()/2, GetYPos() + GetHeight()); }