public static bool IsPortrait(this CCDisplayOrientation orientation) { orientation = orientation & CCDisplayOrientation.Portrait; orientation = orientation & CCDisplayOrientation.PortraitDown; return(orientation != CCDisplayOrientation.Default); }
internal CCDrawManager(GraphicsDeviceManager deviceManager, CCSize proposedScreenSize, CCDisplayOrientation supportedOrientations) { Renderer = new CCRenderer(this); graphicsDeviceMgr = deviceManager; depthTest = true; allowNonPower2Textures = true; hasStencilBuffer = true; currBlend = CCBlendFunc.AlphaBlend; platformDepthFormat = CCDepthFormat.Depth24; transform = Matrix.Identity; TmpVertices = new CCRawList <CCV3F_C4B_T2F>(); matrixStack = new Matrix[100]; blendStates = new Dictionary <CCBlendFunc, BlendState>(); effectStack = new Stack <Effect>(); rasterizerStatesCache = new List <RasterizerState>(); hasStencilBuffer = (deviceManager.PreferredDepthStencilFormat == DepthFormat.Depth24Stencil8); if (deviceManager.GraphicsDevice == null) { initialProposedScreenSizeInPixels = proposedScreenSize; graphicsDeviceMgr.PreferredBackBufferWidth = (int)initialProposedScreenSizeInPixels.Width; graphicsDeviceMgr.PreferredBackBufferHeight = (int)initialProposedScreenSizeInPixels.Height; graphicsDeviceMgr.SupportedOrientations = (DisplayOrientation)supportedOrientations; graphicsDeviceMgr.DeviceCreated += GraphicsDeviceCreated; graphicsDeviceMgr.PreparingDeviceSettings += PreparingDeviceSettings; } }
internal void Update(float deltaTime) { Stats.UpdateStart(); if (EventDispatcher.IsEventListenersFor(EVENT_AFTER_UPDATE)) { EventDispatcher.DispatchEvent(eventAfterUpdate); } CCDisplayOrientation orientation = CurrentDisplayOrientation; CCSize landscapeWindowSize = LandscapeWindowSizeInPixels; foreach (CCDirector director in sceneDirectors) { if (director.NextScene != null) { director.NextScene.Viewport.DisplayOrientation = orientation; director.NextScene.Viewport.LandscapeScreenSizeInPixels = landscapeWindowSize; if (director.NextScene.Window == null) { director.NextScene.Window = this; } director.SetNextScene(); } } Stats.UpdateEnd(deltaTime); }
internal CCViewport( CCRect exactFitLandscapeRatioIn, CCDisplayOrientation supportedDisplayOrientationIn, CCDisplayOrientation currentDisplayOrientationIn) : this(exactFitLandscapeRatioIn, currentDisplayOrientationIn) { }
public CCViewport( CCRect exactFitLandscapeRatioIn, CCViewportResolutionPolicy resolutionPolicyIn = CCViewportResolutionPolicy.ExactFit, CCDisplayOrientation displayOrientationIn = CCDisplayOrientation.LandscapeLeft) : this(exactFitLandscapeRatioIn, exactFitLandscapeRatioIn, resolutionPolicyIn, displayOrientationIn) { }
void InitializeMainWindow(CCSize windowSizeInPixels, bool isFullscreen = false, CCDisplayOrientation supportedOrientations = CCDisplayOrientation.Default) { if (isFullscreen) { #if NETFX_CORE // GraphicsAdapter values are not set correctly when it gets to here so we used the // DeviceManager values. //if (xnaDeviceManager.GraphicsDevice.DisplayMode.) if (xnaGame.Window.CurrentOrientation == DisplayOrientation.Portrait || xnaGame.Window.CurrentOrientation == DisplayOrientation.PortraitDown) { windowSizeInPixels.Width = xnaDeviceManager.PreferredBackBufferHeight; windowSizeInPixels.Height = xnaDeviceManager.PreferredBackBufferWidth; } else { windowSizeInPixels.Width = xnaDeviceManager.PreferredBackBufferWidth; windowSizeInPixels.Height = xnaDeviceManager.PreferredBackBufferHeight; } #else windowSizeInPixels.Width = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; windowSizeInPixels.Height = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; #endif } xnaDeviceManager.IsFullScreen = isFullscreen; if (CCDrawManager.SharedDrawManager == null) { CCDrawManager.SharedDrawManager = new CCDrawManager(xnaDeviceManager, windowSizeInPixels, supportedOrientations); } }
internal CCViewport( CCRect exactFitLandscapeRatioIn, CCDisplayOrientation displayOrientationIn = CCDisplayOrientation.LandscapeLeft) : this(exactFitLandscapeRatioIn, displayOrientationIn.IsLandscape() ? CCViewportResolutionPolicy.AspectFitLandscape : CCViewportResolutionPolicy.AspectFitPortrait, displayOrientationIn) { }
void UpdateDisplayOrientation() { // Make sure chosen orientation is supported if ((currentDisplayOrientation & SupportedDisplayOrientations) != currentDisplayOrientation) { currentDisplayOrientation = CCDisplayOrientation.Default; } }
internal CCApplication(CCGame game, bool isFullScreen = true, CCSize?mainWindowSizeInPixels = null, CCDisplayOrientation supportedOrientations = CCDisplayOrientation.Default) : base(game) { GameTime = new CCGameTime(); xnaGame = game; Scheduler = new CCScheduler(); ActionManager = new CCActionManager(); Scheduler.Schedule(ActionManager, CCSchedulePriority.System, false); priorGamePadState = new Dictionary <PlayerIndex, GamePadState>(); gamePadConnection = new CCEventGamePadConnection(); gamePadButton = new CCEventGamePadButton(); gamePadDPad = new CCEventGamePadDPad(); gamePadStick = new CCEventGamePadStick(); gamePadTrigger = new CCEventGamePadTrigger(); IGraphicsDeviceService service = (IGraphicsDeviceService)Game.Services.GetService(typeof(IGraphicsDeviceService)); if (service == null) { service = new GraphicsDeviceManager(game); // if we still do not have a service after creating the GraphicsDeviceManager // we need to stop somewhere and issue a warning. if (Game.Services.GetService(typeof(IGraphicsDeviceService)) == null) { Game.Services.AddService(typeof(IGraphicsDeviceService), service); } } xnaDeviceManager = (GraphicsDeviceManager)service; Content = game.Content; HandleMediaStateAutomatically = true; game.IsFixedTimeStep = true; TouchPanel.EnabledGestures = GestureType.Tap; game.Activated += GameActivated; game.Deactivated += GameDeactivated; game.Exiting += GameExiting; game.Window.OrientationChanged += OrientationChanged; game.Components.Add(this); gameWindows = new List <CCWindow>(); InitializeMainWindow((mainWindowSizeInPixels.HasValue) ? mainWindowSizeInPixels.Value : CCSize.Zero, isFullScreen, supportedOrientations); }
public CCViewport( CCRect exactFitLandscapeRatioIn, CCRect exactFitPortraitRatioIn, CCDisplayOrientation displayOrientationIn = CCDisplayOrientation.LandscapeLeft) { if (exactFitPortraitRatioIn == default(CCRect)) { exactFitPortraitRatioIn = exactFitLandscapeRatioIn; } displayOrientation = displayOrientationIn; exactFitLandscapeRatio = exactFitLandscapeRatioIn; exactFitPortraitRatio = exactFitPortraitRatioIn; }
public CCViewport( CCRect exactFitLandscapeRatioIn, CCRect exactFitPortraitRatioIn, CCViewportResolutionPolicy resolutionPolicyIn = CCViewportResolutionPolicy.ExactFit, CCDisplayOrientation displayOrientationIn = CCDisplayOrientation.LandscapeLeft) { if (exactFitPortraitRatioIn == default(CCRect)) { exactFitPortraitRatioIn = exactFitLandscapeRatioIn; } resolutionPolicy = resolutionPolicyIn; displayOrientation = displayOrientationIn; exactFitLandscapeRatio = exactFitLandscapeRatioIn; exactFitPortraitRatio = exactFitPortraitRatioIn; }
void InitializeMainWindow(CCSize windowSizeInPixels, bool isFullscreen = false, CCDisplayOrientation supportedOrientations = CCDisplayOrientation.Default) { if (isFullscreen) { windowSizeInPixels.Width = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; windowSizeInPixels.Height = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; } xnaDeviceManager.IsFullScreen = isFullscreen; if (CCDrawManager.SharedDrawManager == null) { CCDrawManager.SharedDrawManager = new CCDrawManager(xnaDeviceManager, windowSizeInPixels, supportedOrientations); } }
public CCViewport( CCRect exactFitLandscapeRatioIn, CCViewportResolutionPolicy resolutionPolicyIn=CCViewportResolutionPolicy.ExactFit, CCDisplayOrientation displayOrientationIn=CCDisplayOrientation.LandscapeLeft) : this (exactFitLandscapeRatioIn, exactFitLandscapeRatioIn, resolutionPolicyIn, displayOrientationIn) { }
public CCViewport( CCRect exactFitLandscapeRatioIn, CCRect exactFitPortraitRatioIn, CCViewportResolutionPolicy resolutionPolicyIn=CCViewportResolutionPolicy.ExactFit, CCDisplayOrientation displayOrientationIn=CCDisplayOrientation.LandscapeLeft) { if(exactFitPortraitRatioIn == default(CCRect)) { exactFitPortraitRatioIn = exactFitLandscapeRatioIn; } resolutionPolicy = resolutionPolicyIn; displayOrientation = displayOrientationIn; exactFitLandscapeRatio = exactFitLandscapeRatioIn; exactFitPortraitRatio = exactFitPortraitRatioIn; }
public CCViewport( CCRect exactFitLandscapeRatioIn, CCRect exactFitPortraitRatioIn, CCDisplayOrientation displayOrientationIn=CCDisplayOrientation.LandscapeLeft) { if(exactFitPortraitRatioIn == default(CCRect)) { exactFitPortraitRatioIn = exactFitLandscapeRatioIn; } displayOrientation = displayOrientationIn; exactFitLandscapeRatio = exactFitLandscapeRatioIn; exactFitPortraitRatio = exactFitPortraitRatioIn; }
public CCViewport( CCRect exactFitLandscapeRatioIn, CCDisplayOrientation displayOrientationIn = CCDisplayOrientation.LandscapeLeft) : this(exactFitLandscapeRatioIn, exactFitLandscapeRatioIn, displayOrientationIn) { }
public CCViewport( CCRect exactFitLandscapeRatioIn, CCDisplayOrientation displayOrientationIn=CCDisplayOrientation.LandscapeLeft) : this (exactFitLandscapeRatioIn, exactFitLandscapeRatioIn, displayOrientationIn) { }
CCApplication(CCGame game, bool isFullScreen = true, CCSize? mainWindowSizeInPixels = null, CCDisplayOrientation supportedOrientations = CCDisplayOrientation.Default) : base(game) { GameTime = new CCGameTime(); xnaGame = game; Scheduler = new CCScheduler(); ActionManager = new CCActionManager(); Scheduler.Schedule(ActionManager, CCSchedulePriority.System, false); priorGamePadState = new Dictionary<PlayerIndex, GamePadState>(); gamePadConnection = new CCEventGamePadConnection(); gamePadButton = new CCEventGamePadButton(); gamePadDPad = new CCEventGamePadDPad(); gamePadStick = new CCEventGamePadStick(); gamePadTrigger = new CCEventGamePadTrigger(); IGraphicsDeviceService service = (IGraphicsDeviceService)Game.Services.GetService(typeof(IGraphicsDeviceService)); if (service == null) { service = new GraphicsDeviceManager(game); // if we still do not have a service after creating the GraphicsDeviceManager // we need to stop somewhere and issue a warning. if (Game.Services.GetService(typeof(IGraphicsDeviceService)) == null) { Game.Services.AddService(typeof(IGraphicsDeviceService), service); } } xnaDeviceManager = (GraphicsDeviceManager)service; Content = game.Content; HandleMediaStateAutomatically = true; game.IsFixedTimeStep = true; TouchPanel.EnabledGestures = GestureType.Tap; game.Activated += GameActivated; game.Deactivated += GameDeactivated; game.Exiting += GameExiting; game.Window.OrientationChanged += OrientationChanged; game.Components.Add(this); gameWindows = new List<CCWindow>(); InitializeMainWindow((mainWindowSizeInPixels.HasValue) ? mainWindowSizeInPixels.Value : CCSize.Zero, isFullScreen, supportedOrientations); }
public static bool IsLandscape(this CCDisplayOrientation orientation) { orientation = orientation & (CCDisplayOrientation.LandscapeLeft | CCDisplayOrientation.LandscapeRight); return(orientation != CCDisplayOrientation.Default); }