internal override void Execute(CCDrawManager drawManager) { if (Action != null) { Action(); } }
internal static void Initialize(GraphicsDevice graphics, CCDrawManager drawManager) { batch = new CCPrimitiveBatch(drawManager); CCDrawingPrimitives.drawManager = drawManager; DrawColor = CCColor4B.White; LineWidth = 1; PointSize = 1.0f; }
public CCRenderTexture() { beginCommand = new CCCustomCommand(float.MinValue, OnBegin); endCommand = new CCCustomCommand(float.MaxValue, OnEnd); PixelFormat = CCSurfaceFormat.Color; drawManager = CCDrawManager.SharedDrawManager; renderer = drawManager.Renderer; }
internal CCRenderer(CCDrawManager drawManager) { DrawManager = drawManager; RenderQueue = new RenderQueue<CCRenderQueueId, CCRenderCommand>(); quads = new CCRawList<CCV3F_C4B_T2F_Quad>(); batchCommands = new List<CCRenderCommand>(BATCH_QUADCOMMAND_RESEVER_SIZE); batchQuadCommands = new List<CCQuadCommand>(BATCH_QUADCOMMAND_RESEVER_SIZE); }
public override bool ApplicationDidFinishLaunching() { CCDirector.SharedDirector.SetOpenGlView(); CCDirector.SharedDirector.Projection = CCDirectorProjection.Projection2D; CCDrawManager.SetDesignResolutionSize(PreferredWidth, PreferredHeight, CCResolutionPolicy.ShowAll); CCDirector.SharedDirector.DisplayStats = true; CCDirector.SharedDirector.AnimationInterval = 1.0 / 60; CCDirector.SharedDirector.RunWithScene(new GameScene()); return(true); }
public GoneBananasApplication(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.Portrait); graphics.PreferMultiSampling = false; }
public override void Mouse(MouseState state, MouseState oldState) { var pos = CCDrawManager.ScreenToWorld(state.X, state.Y); _mousePos = new Vector2(pos.X, pos.Y); if (state.LeftButton == ButtonState.Pressed) { Explode(); } }
public AppDelegate(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.LandscapeRight | DisplayOrientation.LandscapeLeft); graphics.PreferMultiSampling = false; //graphics.PreferredBackBufferWidth = 480; //graphics.PreferredBackBufferHeight = 320; }
public override void Draw() { base.Draw(); // move to 50,50 since the "by" path will start at 50,50 CCDrawManager.PushMatrix(); CCDrawManager.Translate(50, 50, 0); CCDrawingPrimitives.DrawCatmullRom(m_pArray, 50); CCDrawManager.PopMatrix(); CCDrawingPrimitives.DrawCatmullRom(m_pArray2, 50); }
internal override void Execute(CCDrawManager drawManager) { // drawManager.PushMatrix(); // //var xnaMatrix = ModelViewTransform.XnaMatrix; // //drawManager.MultMatrix(ref xnaMatrix); // drawManager.BlendFunc(BlendType); // drawManager.BindTexture(Texture); // // drawManager.DrawQuad(ref Quads[0]); // // drawManager.PopMatrix(); }
public AppDelegate(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.LandscapeRight | DisplayOrientation.LandscapeLeft); game.Window.AllowUserResizing = true; graphics.PreferMultiSampling = false; #if WINDOWS || WINDOWSGL || WINDOWSDX || MACOS graphics.PreferredBackBufferWidth = 1024; graphics.PreferredBackBufferHeight = 768; #endif }
public BlocCruiserApplication(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; //graphics.PreferredBackBufferWidth = (int)CCDirector.SharedDirector.WinSize.Width; //graphics.PreferredBackBufferHeight = (int)CCDirector.SharedDirector.WinSize.Height; CCDrawManager.InitializeDisplay( game, graphics, DisplayOrientation.LandscapeRight | DisplayOrientation.LandscapeLeft); graphics.PreferMultiSampling = false; }
internal CCRenderer(CCDrawManager drawManagerIn) { currentBatchedQuads = new CCRawList<CCV3F_C4B_T2F_Quad>(256, true); quadCommands = new CCRawList<CCQuadCommand>(256, true); renderQueue = new CCRawList<CCRenderCommand>(); drawManager = drawManagerIn; viewportGroupStack = new Viewport[MaxStackDepth]; layerGroupViewMatrixStack = new Matrix[MaxStackDepth]; layerGroupProjMatrixStack = new Matrix[MaxStackDepth]; viewportGroupIdStack = new byte[MaxStackDepth]; layerGroupIdStack = new byte[MaxStackDepth]; groupIdStack = new byte[MaxStackDepth]; }
public virtual void Mouse(MouseState state, MouseState oldState) { var p = CCDrawManager.ScreenToWorld(state.X, state.Y); Vector2 position = new Vector2(p.X, p.Y); if (state.LeftButton == ButtonState.Released && oldState.LeftButton == ButtonState.Pressed) { MouseUp(); } else if (state.LeftButton == ButtonState.Pressed && oldState.LeftButton == ButtonState.Released) { MouseDown(position); } MouseMove(position); }
internal CCPrimitiveBatch(CCDrawManager drawManager, int bufferSize=DefaultBufferSize) { DrawManager = drawManager; if (drawManager.XnaGraphicsDevice == null) { throw new ArgumentNullException("graphicsDevice"); } triangleVertices = new CCV3F_C4B[bufferSize - bufferSize % 3]; lineVertices = new CCV3F_C4B[bufferSize - bufferSize % 2]; triangleVerts = new CCRawList<CCV3F_C4B[]>(100, true); lineVerts = new CCRawList<CCV3F_C4B[]>(100, true); }
public AppDelegate(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.LandscapeRight | DisplayOrientation.LandscapeLeft); #if WINDOWS_PHONE8 HandleMediaStateAutomatically = false; // Bug in MonoGame - https://github.com/Cocos2DXNA/cocos2d-xna/issues/325 #endif game.Window.AllowUserResizing = true; graphics.PreferMultiSampling = false; #if WINDOWS || WINDOWSGL || WINDOWSDX || MACOS graphics.PreferredBackBufferWidth = 1024; graphics.PreferredBackBufferHeight = 768; #endif }
/// <summary> /// Implement CCDirector and CCScene init code here. /// </summary> /// <returns> /// true Initialize success, app continue. /// false Initialize failed, app terminate. /// </returns> public override void ApplicationDidFinishLaunching(CCApplication application) { //1280 x 768 #if WINDOWS_PHONE preferredWidth = 1280; preferredHeight = 768; #else preferredWidth = 1024; preferredHeight = 768; #endif application.PreferredBackBufferWidth = preferredWidth; application.PreferredBackBufferHeight = preferredHeight; application.PreferMultiSampling = true; application.ContentRootDirectory = "Content"; //CCSpriteFontCache.FontScale = 0.5f; //CCSpriteFontCache.RegisterFont("MarkerFelt", 22); //CCSpriteFontCache.RegisterFont("arial", 12, 24); CCDirector director = CCApplication.SharedApplication.MainWindowDirector; director.DisplayStats = true; director.AnimationInterval = 1.0 / 60; CCSize designSize = new CCSize(480, 320); if (CCDrawManager.FrameSize.Height > preferredHeight) { //CCSize resourceSize = new CCSize(960, 640); CCSize resourceSize = new CCSize(preferredWidth, preferredHeight); application.ContentSearchPaths.Add("hd"); director.ContentScaleFactor = resourceSize.Height / designSize.Height; } CCDrawManager.SetDesignResolutionSize(designSize.Width, designSize.Height, CCResolutionPolicy.ShowAll); // turn on display FPS director.DisplayStats = true; // set FPS. the default value is 1.0/60 if you don't call this director.AnimationInterval = 1.0 / 60; CCScene pScene = IntroLayer.Scene; director.RunWithScene(pScene); }
public AppDelegate(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.LandscapeRight | DisplayOrientation.LandscapeLeft); graphics.PreferMultiSampling = false; // TODO: Set your window dimensions here graphics.PreferredBackBufferWidth = 1024; graphics.PreferredBackBufferHeight = 768; }
internal CCPrimitiveBatch(CCDrawManager drawManager, int bufferSize=DefaultBufferSize) { DrawManager = drawManager; if (drawManager.XnaGraphicsDevice == null) { throw new ArgumentNullException("graphicsDevice"); } device = drawManager.XnaGraphicsDevice; triangleVertices = new VertexPositionColor[bufferSize - bufferSize % 3]; lineVertices = new VertexPositionColor[bufferSize - bufferSize % 2]; // set up a new basic effect, and enable vertex colors. basicEffect = new BasicEffect(drawManager.XnaGraphicsDevice); basicEffect.VertexColorEnabled = true; }
public override void Mouse(MouseState state, MouseState oldState) { //base.Mouse(state, oldState); var pos = CCDrawManager.ScreenToWorld(state.X, state.Y); Vector2 MouseWorld = new Vector2(pos.X, pos.Y); //SimpleWind.Position = MouseWorld; _simpleWind.Direction = MouseWorld - _simpleWind.Position; _simpleWind.Strength = _strength; if (state.LeftButton == ButtonState.Pressed && oldState.LeftButton == ButtonState.Released) { _simpleWind.Position = MouseWorld; _simpleWind.Direction = MouseWorld + new Vector2(0, 1); Microsoft.Xna.Framework.Input.Mouse.SetPosition(state.X, state.Y + 10); } }
public override void Draw() { base.Draw(); // move to 50,50 since the "by" path will start at 50,50 CCDrawManager.PushMatrix(); CCDrawManager.Translate(50, 50, 0); CCDrawingPrimitives.DrawCardinalSpline(m_pArray, 0, 100); CCDrawManager.PopMatrix(); var s = CCDirector.SharedDirector.WinSize; CCDrawManager.PushMatrix(); CCDrawManager.Translate(s.Width / 2, 50, 0); CCDrawingPrimitives.DrawCardinalSpline(m_pArray, 1, 100); CCDrawManager.PopMatrix(); }
public AppDelegate(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; _winSize = new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); #if NETFX_CORE CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight); #else #if ANDROID CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.Portrait | DisplayOrientation.PortraitDown); #else CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.Portrait); #endif #endif graphics.PreferMultiSampling = false; }
public AppDelegate(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; // Set the size of the windows that you want here. preferredWidth = 1024; preferredHeight = 768; graphics.PreferredBackBufferWidth = preferredWidth; graphics.PreferredBackBufferHeight = preferredHeight; CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.LandscapeRight | DisplayOrientation.LandscapeLeft); graphics.PreferMultiSampling = false; }
public void NewOrientation() { switch (s_currentOrientation) { case DisplayOrientation.LandscapeLeft: s_currentOrientation = DisplayOrientation.Portrait; break; case DisplayOrientation.Portrait: s_currentOrientation = DisplayOrientation.LandscapeRight; break; case DisplayOrientation.LandscapeRight: s_currentOrientation = DisplayOrientation.LandscapeLeft; break; } CCDrawManager.SetOrientation(s_currentOrientation); }
public AppDelegate(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; // Set the preferred dimensions of your game, this is also known as // your target resolution. preferredWidth = 480; preferredHeight = 320; graphics.PreferredBackBufferWidth = preferredWidth; graphics.PreferredBackBufferHeight = preferredHeight; // Note the orientation here, must match what you specify in the Activity attributes. CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.LandscapeRight | DisplayOrientation.LandscapeLeft); // Anti-aliasing graphics.PreferMultiSampling = false; }
public AppDelegate(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; #if WINDOWS || MACOS || MONOMAC || LINUX || OUYA || XBOX graphics.PreferredBackBufferWidth = 1024; graphics.PreferredBackBufferHeight = 768; #endif CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.LandscapeRight | DisplayOrientation.LandscapeLeft); graphics.PreferMultiSampling = false; //graphics.PreferredBackBufferWidth = 480; //graphics.PreferredBackBufferHeight = 320; }
internal void RenderCustomCommand(CCDrawManager drawManager) { bool originalDepthTestState = drawManager.DepthTest; drawManager.DepthTest = UsingDepthTest; drawManager.PushMatrix(); drawManager.SetIdentityMatrix(); if (WorldTransform != CCAffineTransform.Identity) { var worldTrans = WorldTransform.XnaMatrix; drawManager.MultMatrix(ref worldTrans); } Action(); drawManager.PopMatrix(); drawManager.DepthTest = originalDepthTestState; }
public AppDelegate(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; // Set the preferred dimensions of your game which will be the window dimensions // of your game. On embedded devices like phones and tablets, this should match the // resolution of your device target. Ouya can support two resolutions 720p and 1080p // so you can choose whatever aspect ration you need for your game here. preferredWidth = 480; preferredHeight = 320; graphics.PreferredBackBufferWidth = preferredWidth; graphics.PreferredBackBufferHeight = preferredHeight; // Note the orientation here, must match what you specify in the Activity attributes. CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.LandscapeRight | DisplayOrientation.LandscapeLeft); // Anti-aliasing graphics.PreferMultiSampling = false; }
public AppDelegate(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; preferredWidth = 480; preferredHeight = 320; // TODO: Set your preferred window dimensions, this will set a resolution // that fits the hardware. You do not have to set this, so remove these lines // if you want default behavior. graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferHeight = 480; CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.LandscapeRight | DisplayOrientation.LandscapeLeft); graphics.PreferMultiSampling = false; }
public AppDelegate(Game game, GraphicsDeviceManager graphics) : base(game, graphics) { s_pSharedApplication = this; // disable the automatic media restore so we don't get a deadlock when the game // first starts. HandleMediaStateAutomatically = false; // set the render viewport size graphics.PreferredBackBufferWidth = preferredWidth; graphics.PreferredBackBufferHeight = preferredHeight; // Initialize the graphics CCDrawManager.InitializeDisplay(game, graphics, DisplayOrientation.LandscapeRight | DisplayOrientation.LandscapeLeft); // this controls anti-aliasing graphics.PreferMultiSampling = false; }
internal CCGeometryBatch(CCDrawManager drawManager, int bufferSize=DefaultBufferSize) { DrawManager = drawManager; if (drawManager.XnaGraphicsDevice == null) { throw new ArgumentNullException("graphicsDevice"); } device = drawManager.XnaGraphicsDevice; batchItemList = new List<CCGeometryInstance>(bufferSize); freeBatchItemQueue = new Queue<CCGeometryInstance>(bufferSize); EnsureCapacity(bufferSize, bufferSize * 2); // set up a new basic effect, and enable vertex colors. basicEffect = new BasicEffect(drawManager.XnaGraphicsDevice); basicEffect.VertexColorEnabled = true; basicEffect.TextureEnabled = true; AutoClearInstances = true; }
/// <summary> /// Implement CCDirector and CCScene init code here. /// </summary> /// <returns> /// true Initialize success, app continue. /// false Initialize failed, app terminate. /// </returns> public override bool ApplicationDidFinishLaunching() { //initialize director CCDirector pDirector = CCDirector.SharedDirector; pDirector.SetOpenGlView(); #if WINDOWS DrawManager.SetDesignResolutionSize(1024, 768, ResolutionPolicy.ExactFit); #else CCDrawManager.SetDesignResolutionSize(800, 480, ResolutionPolicy.ShowAll); //DrawManager.SetDesignResolutionSize(480, 320, ResolutionPolicy.ShowAll); #endif // turn on display FPS pDirector.DisplayStats = true; // pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft); // set FPS. the default value is 1.0/60 if you don't call this pDirector.AnimationInterval = 1.0 / 60; // create a scene. it's an autorelease object CCScene pScene = new CCScene(); CCLayer pLayer = new TestController(); /* * CCScene pScene = CCScene.node(); * var pLayer = Box2DView.viewWithEntryID(0); * pLayer.scale = 10; * pLayer.anchorPoint = new CCPoint(0, 0); * pLayer.position = new CCPoint(CCDirector.sharedDirector().getWinSize().width / 2, CCDirector.sharedDirector().getWinSize().height / 4); */ pScene.AddChild(pLayer); pDirector.RunWithScene(pScene); return(true); }
/// <summary> /// Implement CCDirector and CCScene init code here. /// </summary> /// <returns> /// true Initialize success, app continue. /// false Initialize failed, app terminate. /// </returns> public override bool ApplicationDidFinishLaunching() { //initialize director CCDirector pDirector = CCDirector.SharedDirector; pDirector.SetOpenGlView(); // 2D projection pDirector.Projection = ccDirectorProjection.kCCDirectorProjection2D; // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices //if( ! [director_ enableRetinaDisplay:YES] ) // CCLOG(@"Retina Display Not supported"); #if WINDOWS || MACOS || MONOMAC || LINUX || OUYA || XBOX var resPolicy = ResolutionPolicy.ExactFit; #else var resPolicy = ResolutionPolicy.ShowAll; #endif CCDrawManager.SetDesignResolutionSize(preferredWidth, preferredHeight, resPolicy); // turn on display FPS //pDirector.DisplayStats = true; // set FPS. the default value is 1.0/60 if you don't call this pDirector.AnimationInterval = 1.0 / 60; CCScene pScene = IntroLayer.Scene; pDirector.RunWithScene(pScene); return(true); }
/// <summary> /// Implement CCDirector and CCScene init code here. /// </summary> /// <returns> /// true Initialize success, app continue. /// false Initialize failed, app terminate. /// </returns> public override bool ApplicationDidFinishLaunching() { //initialize director CCDirector pDirector = CCDirector.SharedDirector; pDirector.SetOpenGlView(); var resPolicy = CCResolutionPolicy.ExactFit; // This will stretch out your game CCDrawManager.SetDesignResolutionSize(preferredWidth, preferredHeight, resPolicy); // turn on display FPS //pDirector.DisplayStats = true; // set FPS. the default value is 1.0/60 if you don't call this pDirector.AnimationInterval = 1.0 / 60; CCScene pScene = IntroLayer.Scene; pDirector.RunWithScene(pScene); return(true); }
internal override void Execute(CCDrawManager drawManager) { //throw new NotImplementedException(); }
internal abstract void Execute(CCDrawManager drawManager);
internal CCGrabber(CCDrawManager drawManager) { this.drawManager = drawManager; }
internal void UseMaterial (CCDrawManager drawManager) { drawManager.BlendFunc(BlendType); drawManager.BindTexture(Texture); }
/// <summary> /// Implement CCDirector and CCScene init code here. /// </summary> /// <returns> /// true Initialize success, app continue. /// false Initialize failed, app terminate. /// </returns> public override bool ApplicationDidFinishLaunching() { //initialize director CCDirector pDirector = CCDirector.SharedDirector; pDirector.SetOpenGlView(); CCSpriteFontCache.FontScale = 0.6f; CCSpriteFontCache.RegisterFont("arial", 12, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 38, 50, 64); CCSpriteFontCache.RegisterFont("MarkerFelt", 16, 18, 22); CCSpriteFontCache.RegisterFont("MarkerFelt-Thin", 12, 18); CCSpriteFontCache.RegisterFont("Paint Boy", 26); CCSpriteFontCache.RegisterFont("Schwarzwald Regular", 26); CCSpriteFontCache.RegisterFont("Scissor Cuts", 26); CCSpriteFontCache.RegisterFont("A Damn Mess", 26); CCSpriteFontCache.RegisterFont("Abberancy", 26); CCSpriteFontCache.RegisterFont("Abduction", 26); // turn on display FPS pDirector.DisplayStats = true; // set FPS. the default value is 1.0/60 if you don't call this pDirector.AnimationInterval = 1.0 / 60; CCSize designSize = new CCSize(480, 320); if (CCDrawManager.FrameSize.Height > 320) { CCSize resourceSize = new CCSize(960, 640); CCContentManager.SharedContentManager.SearchPaths.Add("hd"); /* * CCContentManager.SharedContentManager.SearchPaths.Add("hd/extensions"); * CCContentManager.SharedContentManager.SearchPaths.Add("extensions"); * CCContentManager.SharedContentManager.SearchPaths.Add("hd/animations"); * CCContentManager.SharedContentManager.SearchPaths.Add("animations"); * CCContentManager.SharedContentManager.SearchPaths.Add("hd/TileMaps"); * CCContentManager.SharedContentManager.SearchPaths.Add("TileMaps"); * CCContentManager.SharedContentManager.SearchPaths.Add("hd/ccb"); * CCContentManager.SharedContentManager.SearchPaths.Add("ccb"); * CCContentManager.SharedContentManager.SearchPaths.Add("hd/Images"); * CCContentManager.SharedContentManager.SearchPaths.Add("Particles"); * CCContentManager.SharedContentManager.SearchPaths.Add("Sounds"); * CCContentManager.SharedContentManager.SearchPaths.Add("TileMaps"); */ pDirector.ContentScaleFactor = resourceSize.Height / designSize.Height; } CCDrawManager.SetDesignResolutionSize(designSize.Width, designSize.Height, CCResolutionPolicy.ShowAll); /* #if WINDOWS || WINDOWSGL * CCDrawManager.SetDesignResolutionSize(1280, 768, CCResolutionPolicy.ExactFit); #else * CCDrawManager.SetDesignResolutionSize(800, 480, CCResolutionPolicy.ShowAll); * //CCDrawManager.SetDesignResolutionSize(480, 320, CCResolutionPolicy.ShowAll); #endif */ // create a scene. it's an autorelease object CCScene pScene = new CCScene(); CCLayer pLayer = new TestController(); /* * CCScene pScene = CCScene.node(); * var pLayer = Box2DView.viewWithEntryID(0); * pLayer.scale = 10; * pLayer.anchorPoint = new CCPoint(0, 0); * pLayer.position = new CCPoint(CCDirector.sharedDirector().getWinSize().width / 2, CCDirector.sharedDirector().getWinSize().height / 4); */ pScene.AddChild(pLayer); pDirector.RunWithScene(pScene); return(true); }
internal override void Execute(CCDrawManager drawManager) { drawManager.BindTexture(Texture.Texture); drawManager.BlendFunc(BlendType); Texture.DrawQuads(); }