Пример #1
0
void
ShowImageWindow::_ToggleFullScreen()
{
	BRect frame;
	fFullScreen = !fFullScreen;
	if (fFullScreen) {
		BScreen screen;
		fWindowFrame = Frame();
		frame = screen.Frame();
		frame.top -= fBar->Bounds().Height() + 1;
		frame.right += B_V_SCROLL_BAR_WIDTH;
		frame.bottom += B_H_SCROLL_BAR_HEIGHT;
		frame.InsetBy(-1, -1); // PEN_SIZE in ShowImageView

		SetFlags(Flags() | B_NOT_RESIZABLE | B_NOT_MOVABLE);

		Activate();
			// make the window frontmost
	} else {
		frame = fWindowFrame;

		SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE));
	}

	fToolBarView->SetActionVisible(MSG_FULL_SCREEN, fFullScreen);
	_SetToolBarVisible(!fFullScreen && fShowToolBar);

	MoveTo(frame.left, frame.top);
	ResizeTo(frame.Width(), frame.Height());

	fImageView->SetHideIdlingCursor(fFullScreen);
	fImageView->SetShowCaption(fFullScreen && fShowCaption);

	Layout(false);
		// We need to manually relayout here, as the views are layouted
		// asynchronously, and FitToBounds() would still have the wrong size
	fImageView->FitToBounds();
}
Пример #2
0
void CPolySelection::OnDraw( CImage* pImage, COLORREF color )
{
   /*CRect tmpSelection = m_rect;
   CorrectDragRect( &tmpSelection );
   BoundRect( pImage, &tmpSelection );*/

   

   auto hDC = pImage->GetDC();
   auto memoryDC = CDC::FromHandle( hDC );
   CPen    pen( PS_SOLID, 1, color );
   CPen*    pOldPen = memoryDC->SelectObject( &pen );
   //auto origColor = memoryDC->SetDCPenColor( color );

   if( m_verts.size() <= 0 )
   {
      return;
   }

   memoryDC->MoveTo( m_verts[0] );

   for( int i=1; i<(int)m_verts.size(); i++ )
   {
      auto p = m_verts[i];
      memoryDC->LineTo( p );
   }

   if( !m_bIsFinished )
   {
      memoryDC->LineTo( m_nextPoint );
   }
   else
   {
      memoryDC->LineTo( m_verts[0] );
   }

   pImage->ReleaseDC();
}
Пример #3
0
DataTranslationsWindow::DataTranslationsWindow()
	:
	BWindow(BRect(0.0f, 0.0f, 597.0f, 368.0f),
		B_TRANSLATE_SYSTEM_NAME("DataTranslations"),
		B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE
			| B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
	fRelease(NULL)
{
	MoveTo(DataTranslationsSettings::Instance()->WindowCorner());

	_SetupViews();

	// Make sure that the window isn't positioned off screen
	BScreen screen;
	BRect screenFrame = screen.Frame();
	if (!screenFrame.Contains(Frame()))
		CenterOnScreen();

	BTranslatorRoster* roster = BTranslatorRoster::Default();
	roster->StartWatching(this);

	Show();
}
Пример #4
0
bool GameDisplayDlg::ProcUserCmd(const POINT& _mp)
{
	int nShowX = _mp.x;
	int nShowY = _mp.y;
	int nClientWidth = m_rcClient.right - m_rcClient.left;
	int nClientHeight = m_rcClient.bottom - m_rcClient.top;
	nShowX += 5;
	nShowY += 5;

	if(nShowX + nClientWidth > m_nScreenWidth)
	{
		int nOffset = nShowX + nClientWidth - m_nScreenWidth;
		nShowX -= nOffset;
	}
	if(nShowY + nClientHeight > m_nScreenHeight)
	{
		int nOffset = nShowY + nClientHeight - m_nScreenHeight;
		nShowY -= nOffset;
	}
	MoveTo(nShowX, nShowY);

	return true;
}
Пример #5
0
static void updatemainwindow (void) {
	
	Rect r;
	Str255 s;
	
	r = (*mainwindow).portRect;
	
	EraseRect (&r);
	
	setfontsizestyle (helvetica, 12, 0);
	
	centerstring (r, windowmessage);
	
	NumToString (FreeMem () / 1024, s);
	
	MoveTo (r.left + 3, r.bottom - 3);
	
	setfontsizestyle (geneva, 9, 0);
	
	DrawString (s);
	
	DrawString ("\pK");
	} /*updatemainwindow*/
Пример #6
0
/*------------------------------------------------------------------------------*\
	( )
		-	
\*------------------------------------------------------------------------------*/
BRect BmTextControl::layout(BRect frame) {
	if (frame == Frame())
		return frame;
	MoveTo(frame.LeftTop());
	ResizeTo(frame.Width(),frame.Height());
#ifdef __HAIKU__
	float occupiedSpace = 3 + Divider();
	float top = mTextView->Frame().top;
	float height = mTextView->Frame().Height();
	if (mLabelIsMenu) {
		top = mMenuField->MenuBar()->Frame().top;
		height = mMenuField->MenuBar()->Frame().Height();
	}
	mTextView->MoveTo( occupiedSpace, top);
	mTextView->ResizeTo( frame.Width()-occupiedSpace-4, height);
#else
	float occupiedSpace = 3 + Divider();
	mTextView->MoveTo( occupiedSpace, 5);
	mTextView->ResizeTo( frame.Width()-occupiedSpace-4, 
								mTextView->Frame().Height());
#endif // __HAIKU__
	return frame;
}
void CalendarControl::AttachedToWindow(void)
{
 BControl::AttachedToWindow();
 
 pb->SetTarget(this);
 
 if(Parent()!=NULL) view_color=Parent()->ViewColor();
 else
  view_color.red=view_color.green=view_color.blue=view_color.alpha=255;
 
 SetViewColor(view_color); // function of CalendarControl class

#ifdef __UNIVERSAL_INTERFACE
 if(interface==CC_BEOS_INTERFACE)
#endif

#ifdef __BEOS_INTERFACE
  MakeButton(); // for BeOS interface is called only from here,
                // for Zeta interface if color is changed also (in SetViewColor)
#endif
 
 MoveTo(LT);
}
Пример #8
0
status_t
InspectorWindow::LoadSettings(const GuiTeamUiSettings& settings)
{
	AutoLocker<BLooper> lock(this);
	if (!lock.IsLocked())
		return B_ERROR;

	BMessage inspectorSettings;
	if (settings.Settings("inspectorWindow", inspectorSettings) != B_OK)
		return B_OK;

	BRect frameRect;
	if (inspectorSettings.FindRect("frame", &frameRect) == B_OK) {
		ResizeTo(frameRect.Width(), frameRect.Height());
		MoveTo(frameRect.left, frameRect.top);
	}

	_LoadMenuFieldMode(fHexMode, "Hex", inspectorSettings);
	_LoadMenuFieldMode(fEndianMode, "Endian", inspectorSettings);
	_LoadMenuFieldMode(fTextMode, "Text", inspectorSettings);

	return B_OK;
}
Пример #9
0
/**   
	* @fn void CShoot::Init (void)
	* Used when all the values are initialized by default
	* when reading the global initialization game file.
 */
void CShoot::Init (void)
{
	SubType			=	CSH_DEFAULT;
	Type			=	CHARS_MISSIL;
	Active = Alive  =	false;	///The very first time, when created at the beginning of the game, this device is not available
	
	//Space position and AABB							
	Size.v[XDIM]		=	.05f;	///Update by default the AABB relative to local coordinates
	Size.v[YDIM]		=	0.3f;
	Size.v[ZDIM]		=	0.0f;
	RenderMode		=	CHAR_2D;
	visible			=	true;
#ifdef CHAR_USE_AABB
	InitializeAABB();
#endif
	MoveTo(0.0f, 0.0f, 0.05f);
	Speed.v[YDIM] = CSH_DEFAULT_SPEED;
	Health=100;

	msgUpd = new RTDESK_CMsg;
	msgUpd->Type = RTDESKMSG_BASIC_TYPE;
	msgUpd->Propietary = true;
}
Пример #10
0
//-----------------------------------------------------------------------------
//Summary:
//		person move process in traffic system
//-----------------------------------------------------------------------------
void CFreeMovingLogic::ProcessMove( const ElapsedTime& time )
{
	ElapsedTime eTime = time;
	while(!m_routePath.empty())
	{
		LandsideTrafficGraphVertex& vertex = m_routePath.back();
		if (vertex.GetTrafficObjectType() == CLandsideWalkTrafficObjectInSim::CrossWalk_Type)
			return GenerateConflictEvent(eTime);
		else if(vertex.GetTrafficObjectType() == CLandsideWalkTrafficObjectInSim::Walkway_Type)
		{
			CWalkwayInSim* pWalkwayInSim = (CWalkwayInSim*)vertex.GetTrafficInSim();
			pWalkwayInSim->stepIt(m_pPaxLandsideBehavior,vertex,this,eTime);
		}
		else
		{
			//eTime += m_pPaxLandsideBehavior->moveTime();
			MoveTo(eTime,vertex.GetPoint());
			m_routePath.pop_back();
		}
	}

	m_pLandsideTrafficSys->LeaveTrafficSystem(m_pPaxLandsideBehavior,m_emEndState,eTime);
}
Пример #11
0
// called when a enemy is on sight 
bool CMonster::OnEnemyOnSight( CPlayer* Enemy )
{
    clock_t etime = clock() - lastSighCheck;
    if(etime<5000) return true;
    if(!IsOnBattle( ))
    {
        if(thisnpc->aggresive>1)
        {
            UINT aggro = GServer->RandNumber(2,15);
            if(thisnpc->aggresive>=aggro && !IsGhostSeed( ))
            {
                Enemy->ClearObject( this->clientid );
				SpawnMonster(Enemy, this );
                StartAction( (CCharacter*) Enemy, NORMAL_ATTACK, 0 );
            }
            else
            if(IsGhostSeed( ) || thisnpc->aggresive>5)
                MoveTo( Enemy->Position->current, true );
        }
        lastSighCheck = clock();
    }
    return true;    
}
Пример #12
0
static void calculate_lineto(void)
{
    RECT rect;
    HPEN hOldPen;
    WINT temp;
    do {
        rect.left = get_rand(0, xMax);
        rect.top = get_rand(0, yMax);
        rect.right = get_rand(0, xMax);
        rect.bottom = get_rand(0, yMax);
        hOldPen = SelectObject(hMemDC, create_pen());
        SetROP2(hMemDC, get_rand(1,17));
        MoveTo(hMemDC, rect.left, rect.top);
        LineTo(hMemDC, rect.right, rect.bottom);
        DeleteObject(SelectObject(hMemDC, hOldPen));
        if (TestSemaphore(&PainterRequired) < 0)
        {
            if (rect.left > rect.right)
            {
                temp = rect.left;
                rect.left = rect.right;
                rect.right = temp;
            }
            if (rect.top > rect.bottom)
            {
                temp = rect.top;
                rect.top = rect.bottom;
                rect.bottom = temp;
            }
            InvalidateRect(hWnd, &rect, FALSE);
            UpdateWindow(hWnd);
        }
    } while ((TestSemaphore(&DemoRun)) && (!TestSemaphore(&SingleRun)));

    if (!TestSemaphore(&SingleRun));
        Signal(&Done);
}
Пример #13
0
VirtualKeyboardWindow::VirtualKeyboardWindow(BInputServerDevice* dev)
	:
	BWindow(BRect(0,0,0,0),"Virtual Keyboard",
	B_NO_BORDER_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL,
	B_WILL_ACCEPT_FIRST_CLICK | B_AVOID_FOCUS),
	fDevice(dev)
{
	BScreen screen;
	BRect screenRect(screen.Frame());

	ResizeTo(screenRect.Width(), screenRect.Height() / 3);
	MoveTo(0,screenRect.Height() - screenRect.Height() / 3);

	SetLayout(new BGroupLayout(B_VERTICAL));

	//Add to an options window later, use as list for now
	fMapListView = new BListView("Maps");
	fFontMenu = new BMenu("Font");
	fLayoutMenu = new BMenu("Layout");

	_LoadMaps();
	_LoadLayouts(fLayoutMenu);
	_LoadFonts();

	KeymapListItem* current =
		static_cast<KeymapListItem*>(fMapListView->LastItem());
	fCurrentKeymap.Load(current->EntryRef());


	fKeyboardView = new KeyboardLayoutView("Keyboard",fDevice);
	fKeyboardView->GetKeyboardLayout()->SetDefault();
	fKeyboardView->SetEditable(false);
	fKeyboardView->SetKeymap(&fCurrentKeymap);

	AddChild(BGroupLayoutBuilder(B_VERTICAL)
		.Add(fKeyboardView));
}
Пример #14
0
void
WorkspacesWindow::Zoom(BPoint origin, float width, float height)
{
	BScreen screen;
	float screenWidth = screen.Frame().Width();
	float screenHeight = screen.Frame().Height();
	float aspectRatio = screenWidth / screenHeight;

	uint32 columns, rows;
	BPrivate::get_workspaces_layout(&columns, &rows);

	float workspaceWidth = Frame().Width() / columns;
	float workspaceHeight = workspaceWidth / aspectRatio;

	width = floor(workspaceWidth * columns);
	height = floor(workspaceHeight * rows);

	while (width + 2 * GetScreenBorderOffset() > screenWidth
		|| height + 2 * GetScreenBorderOffset() + GetTabHeight()
			> screenHeight) {
		width = floor(0.95 * width);
		height = floor(0.95 * height);
	}

	ResizeTo(width, height);

	if (fSettings->AutoRaising()) {
		// The auto-raising mode makes sense only if the window is positionned
		// exactly in the bottom-right corner. If the setting is enabled, move
		// the window there.
		origin = screen.Frame().RightBottom();
		origin.x -= GetScreenBorderOffset() + width;
		origin.y -= GetScreenBorderOffset() + height;

		MoveTo(origin);
	}
}
Пример #15
0
    void MoveSplineInit::Stop()
    {
        MoveSpline& move_spline = *unit.movespline;

        // No need to stop if we are not moving
        if (move_spline.Finalized())
            return;

        Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ(), unit.GetOrientation());


        // there is a big chance that current position is unknown if current state is not finalized, need compute it
        // this also allows calculate spline position and update map position in much greater intervals
        if (!move_spline.Finalized())
            real_position = move_spline.ComputePosition();

        if (args.path.empty())
        {
            // should i do the things that user should do?
            MoveTo(real_position);
        }

        // current first vertex
        args.path[0] = real_position;

        args.flags = MoveSplineFlag::Done;
        unit.m_movementInfo.RemoveMovementFlag(MovementFlags(MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_SPLINE_ENABLED));
        move_spline.Initialize(args);

        WorldPacket data(SMSG_MONSTER_MOVE, 64);
        data << unit.GetPackGUID();

        data << real_position.x << real_position.y << real_position.z;
        data << move_spline.GetId();
        data << uint8(MonsterMoveStop);
        unit.SendMessageToSet(&data, true);
    }
Пример #16
0
void MoveToCommand (void)
{
	char *command;
	int32_t targets[6];

	do {

		if (!(command = GetArgument ())) {
			break;
		}
		targets[0] = decatoi (command);
		if (!(command = GetArgument ())) {
			break;
		}
		targets[1] = decatoi (command);
		if (!(command = GetArgument ())) {
			break;
		}
		targets[2] = decatoi (command);
		if (!(command = GetArgument ())) {
			break;
		}
		targets[3] = decatoi (command);
		if (!(command = GetArgument ())) {
			break;
		}
		targets[4] = decatoi (command);
		if (!(command = GetArgument ())) {
			break;
		}
		targets[5] = decatoi (command);

		MoveTo (targets[0], targets[1], targets[2], targets[3], targets[4], targets[5]);

	} while (0);
}
Пример #17
0
void Game_Player::PerformTeleport() {
	if (!teleporting) return;

	teleporting = false;

	// Finish (un)boarding process
	if (location.boarding) {
		location.boarding = false;
		location.aboard = true;
	} else if (location.unboarding) {
		location.unboarding = false;
		location.aboard = false;
	}

	// Reset sprite if it was changed by a move
	// Even when target is the same map
	Refresh();

	if (Game_Map::GetMapId() != new_map_id) {
		pattern = RPG::EventPage::Frame_middle;
		Game_Map::Setup(new_map_id);
		last_pan_x = 0;
		last_pan_y = 0;
	}

	SetOpacity(255);

	MoveTo(new_x, new_y);
	if (new_direction >= 0) {
		SetDirection(new_direction);
		SetSpriteDirection(new_direction);
	}

	if (InVehicle())
		GetVehicle()->MoveTo(new_x, new_y);
}
Пример #18
0
static void DrawInstrumentName(int ch, char *comm)
{
	char		buf[80];
	RGBColor	black={0,0,0};
	Rect		box;

	SetPortWindowPort(win.ref);
	RGBForeColor(&black);
	
		//channel number
	MoveTo(2, UPPER_MERGIN+CHANNEL_HIGHT*(ch+1)-1);
	snprintf(buf, 80,"%2d", ch+1);
	DrawText(buf, 0, strlen(buf));
		
		//InstrumentName
	box.top=UPPER_MERGIN+CHANNEL_HIGHT*ch;
	box.left=20;
	box.bottom=box.top+12;
	box.right=LEFT_MERGIN-10;
	if( !comm || !*comm )
		EraseRect(&box);
	else
		TETextBox(comm, strlen(comm), &box, teFlushDefault);
}
Пример #19
0
void
SelectionWindow::MoveCloseToMouse()
{
	uint32 buttons;
	BPoint mousePosition;

	ChildAt((int32)0)->GetMouse(&mousePosition, &buttons);
	ConvertToScreen(&mousePosition);

	// Position the window centered around the mouse...
	BPoint windowPosition = BPoint(mousePosition.x - Frame().Width() / 2,
		mousePosition.y	- Frame().Height() / 2);

	// ... unless that's outside of the current screen size:
	BScreen screen;
	windowPosition.x
		= MAX(20, MIN(screen.Frame().right - 20 - Frame().Width(),
		windowPosition.x));
	windowPosition.y = MAX(20,
		MIN(screen.Frame().bottom - 20 - Frame().Height(), windowPosition.y));

	MoveTo(windowPosition);
	SetWorkspaces(1UL << current_workspace());
}
Пример #20
0
void
BTextControl::_UpdateFrame()
{
	CALLED();

	if (fLayoutData->label_layout_item && fLayoutData->text_view_layout_item) {
		BRect labelFrame = fLayoutData->label_layout_item->Frame();
		BRect textFrame = fLayoutData->text_view_layout_item->Frame();

		// update divider
		fDivider = textFrame.left - labelFrame.left;

		MoveTo(labelFrame.left, labelFrame.top);
		BSize oldSize = Bounds().Size();
		ResizeTo(textFrame.left + textFrame.Width() - labelFrame.left,
			textFrame.top + textFrame.Height() - labelFrame.top);
		BSize newSize = Bounds().Size();

		// If the size changes, ResizeTo() will trigger a relayout, otherwise
		// we need to do that explicitly.
		if (newSize != oldSize)
			Relayout();
	}
}
Пример #21
0
void Game_Player::PerformTeleport() {
	if (!teleporting) return;

	teleporting = false;

	if (Game_Map::GetMapId() != new_map_id) {
		Refresh(); // Reset sprite if it was changed by a move
		Game_Map::Update(); // Execute remaining events (e.g. ones listed after a teleport)
		Game_Map::Setup(new_map_id);
		last_pan_x = 0;
		last_pan_y = 0;
	}

	SetOpacity(255);

	MoveTo(new_x, new_y);
	if (new_direction >= 0) {
		SetDirection(new_direction);
		SetSpriteDirection(new_direction);
	}

	if (InVehicle())
		GetVehicle()->MoveTo(new_x, new_y);
}
// Loads the application settings file from (loadMsg) and resizes the interface
// to match the previously saved settings.  Because this is a non-essential
// file, errors are ignored when loading the settings.
void
ShortcutsWindow::_LoadWindowSettings(const BMessage& loadMsg)
{
	BRect frame;
	if (loadMsg.FindRect("window frame", &frame) == B_OK) {
		// Ensure the frame does not resize below the computed minimum.
		float width = max_c(Bounds().right, frame.right - frame.left);
		float height = max_c(Bounds().bottom, frame.bottom - frame.top);
		ResizeTo(width, height);

		// Ensure the frame is not placed outside of the screen.
		BScreen screen(this);
		float left = min_c(screen.Frame().right - width, frame.left);
		float top = min_c(screen.Frame().bottom - height, frame.top);
		MoveTo(left, top);
	}

	for (int i = 0; i < fColumnListView->CountColumns(); i++) {
		CLVColumn* column = fColumnListView->ColumnAt(i);
		float columnWidth;
		if (loadMsg.FindFloat("column width", i, &columnWidth) == B_OK)
			column->SetWidth(max_c(column->Width(), columnWidth));
	}
}
/**
 * HPGL polygon: fill not supported (but closed, at least)
 */
void HPGL_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
                             FILL_T aFill, int aWidth )
{
    if( aCornerList.size() <= 1 )
        return;

    SetCurrentLineWidth( aWidth );

    MoveTo( aCornerList[0] );

    for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
        LineTo( aCornerList[ii] );

    // Close polygon if filled.
    if( aFill )
    {
        int ii = aCornerList.size() - 1;

        if( aCornerList[ii] != aCornerList[0] )
            LineTo( aCornerList[0] );
    }

    PenFinish();
}
Пример #24
0
MediaAlert::MediaAlert(BRect _rect, const char* title, const char* text)
	: BWindow(_rect, title, B_MODAL_WINDOW, B_NOT_CLOSABLE | B_NOT_RESIZABLE)
{
	fTextView = NULL;

	// Set up the "_master_" view
	TAlertView* masterView = new TAlertView(Bounds());
	masterView->SetBitmap(InitIcon());
	AddChild(masterView);

	// Set up the text view
	BRect textViewRect(kTextIconOffset, kTextTopOffset,
		Bounds().right, Bounds().bottom);
	BRect rect = textViewRect;
	rect.OffsetTo(B_ORIGIN);
	rect.InsetBy(4, 2);

	fTextView = new BTextView(textViewRect, "_tv_", rect,
		B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
	fTextView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fTextView->SetText(text, strlen(text));
	fTextView->MakeEditable(false);
	fTextView->MakeSelectable(false);
	fTextView->SetWordWrap(true);
	fTextView->SetFontAndColor(be_bold_font);

	masterView->AddChild(fTextView);

	BRect screenFrame = BScreen(B_MAIN_SCREEN_ID).Frame();
	BPoint pt;
	pt.x = screenFrame.Width() / 2 - Bounds().Width() / 2;
	pt.y = screenFrame.Height() / 2 - Bounds().Height() / 2;

	if (screenFrame.Contains(pt))
		MoveTo(pt);
}
Пример #25
0
void XDrawSegments(
    Display *display,
    Drawable  d,
    GC gc,
    XSegment *segments,
    int  nsegments)
{
    MacDrawable *macWin = (MacDrawable *) d;
    CGrafPtr saveWorld;
    GWorldPtr destPort;
    GDHandle saveDevice;
    int i;

    destPort = TkMacGetDrawablePort(d);

    display->request++;

    GetGWorld(&saveWorld, &saveDevice);
    SetGWorld(destPort, NULL);
    
    TkMacSetUpClippingRgn(d);

    TkMacSetUpGraphicsPort(gc);

    ShowPen();

    PenPixPat(gPenPat);
    for (i = 0; i < nsegments; i++) {
        MoveTo((short) (macWin->xOff + segments[i].x1),
	        (short) (macWin->yOff + segments[i].y1));
	LineTo((short) (macWin->xOff + segments[i].x2),
		(short) (macWin->yOff + segments[i].y2));
    }

    SetGWorld(saveWorld, saveDevice);
}
Пример #26
0
void GameLayer::onTouchesMoved(const std::vector<Touch*>& touches, Event* event)
{
	auto planeLayer = PlaneLayer::getInstance();
	if(planeLayer->_isAlive) {
		Vec2 beginPoint = touches[0]->getLocation();
		auto planeRect = planeLayer->getChildByTag(AIRPLANE)->getBoundingBox();
		// 允许稍大一点触摸位置
		planeRect.origin.x -= 15;
		planeRect.origin.y -= 15;
		planeRect.size.width += 30;
		planeRect.size.height += 30;

		if(planeRect.containsPoint(this->getParent()->convertToNodeSpace(beginPoint))) {
			auto endPoint = touches[0]->getPreviousLocationInView();
			endPoint = Director::getInstance()->convertToGL(endPoint);

			auto offset = beginPoint -  endPoint;
			// 获取正真的移动位置
			auto toPoint = planeLayer->getChildByTag(AIRPLANE)->getPosition() + offset;
			planeLayer->MoveTo(toPoint);
		}

	}
}
void CDrawObject::MoveLineHandleToWithShift( int nHandle, CPoint point )
{
	FTLASSERT(this);

	CRect position = m_position;
	switch (nHandle)
	{
		case 1:
			{
				position.left = point.x;
				position.top = point.y;
				RegulateLine(position, PIRLEFT);
				RegulateLine(position, PIRTOP);
			}break;
		case 5:
			{
				position.right = point.x;
				position.bottom = point.y;
				RegulateLine(position, PIRRIGHT);
				RegulateLine(position, PIRBUTTOM);
			}break;
	}
	MoveTo(position);
}
Пример #28
0
void Game_Vehicle::Refresh() {
	if (driving) {
		map_id = Game_Map::GetMapId();
		SyncWithPlayer();
	}
	else if (map_id == Game_Map::GetMapId())
		MoveTo(x, y);
	switch (type) {
		case Boat:
			priority_type = RPG::EventPage::Layers_same;
			move_speed = RPG::EventPage::MoveSpeed_normal;
			break;
		case Ship:
			priority_type = RPG::EventPage::Layers_same;
			move_speed = RPG::EventPage::MoveSpeed_double;
			break;
		case Airship:
			priority_type = driving ? RPG::EventPage::Layers_above : RPG::EventPage::Layers_below;
			move_speed = RPG::EventPage::MoveSpeed_fourfold;
			break;
	}
	walk_anime = driving;
	step_anime = driving;
}
Пример #29
0
void Game_Vehicle::Refresh() {
	if (!driving && Main_Data::game_player->GetVehicle() == this)
		driving = true;

	if (driving)
		SetMapId(Game_Map::GetMapId());
	else if (IsInCurrentMap())
		MoveTo(GetX(), GetY());

	switch (type) {
		case None:
			break;
		case Boat:
		case Ship:
			SetLayer(RPG::EventPage::Layers_same);
			SetMoveSpeed(RPG::EventPage::MoveSpeed_normal);
			break;
		case Airship:
			SetLayer(driving ? RPG::EventPage::Layers_above : RPG::EventPage::Layers_below);
			SetMoveSpeed(RPG::EventPage::MoveSpeed_double);
			break;
	}
	walk_animation = (type != Airship) || driving;
}
Пример #30
0
void CWizFolder::Delete()
{
    if (IsDeletedItems())
        return;

    if (IsInDeletedItems())
    {
        //if (IDYES != WizMessageBox1(IDS_DELETE_FOLDER, GetName(), MB_YESNO | MB_ICONQUESTION))
        //    return S_FALSE;
        //
        if (!m_db.DeleteDocumentsByLocation(Location()))
        {
            TOLOG1(_T("Failed to delete documents by location; %1"), Location());
            return;
        }
        //
        m_db.LogDeletedFolder(Location());
    }
    else
    {
        CWizFolder deletedItems(m_db, m_db.GetDeletedItemsLocation());
        MoveTo(&deletedItems);
    }
}