예제 #1
0
        public static CCTexture2D GetCCTexture2DWithFile(String p_ContentFileName)
        {
            CCTexture2D cctext2D = new CCTexture2D();

            cctext2D.initWithTexture(CCApplication.sharedApplication().content.Load <Texture2D>(p_ContentFileName));
            return(cctext2D);
        }
예제 #2
0
        public static CCTexture2D GetCCTexture2D(Stream p_PicStrean, Int32 p_Width, Int32 p_Height, bool p_Zoom)
        {
            Texture2D   text2D   = Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice, p_PicStrean, p_Width, p_Height, p_Zoom);
            CCTexture2D cctext2D = new CCTexture2D();

            cctext2D.initWithTexture(text2D);
            return(cctext2D);
        }
예제 #3
0
        public static CCTexture2D GetCCTexture2D(Stream p_PicStrean)
        {
            Texture2D   text2D   = Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice, p_PicStrean);
            CCTexture2D cctext2D = new CCTexture2D();

            cctext2D.initWithTexture(text2D);
            return(cctext2D);
        }
예제 #4
0
        /// <summary>
        /// a selector callback
        /// </summary>
        /// <param name="pSender"></param>
        public virtual void menuCloseCallback(CCObject pSender)
        {
            CCDirector.sharedDirector().end();
#if __IOS__
            Environment.Exit(0);
#else
            CCApplication.sharedApplication().Game.Exit();
#endif
        }
예제 #5
0
 public void Open(string pFileName, uint uId)
 {
     if (pFileName == null || pFileName.Length == 0)
     {
         return;
     }
     this.Close();
     this.m_music    = CCApplication.sharedApplication().content.Load <Song>(pFileName);
     this.m_nSoundID = uId;
 }
예제 #6
0
 public static Texture2D GetTexture2D(Word p_Word)
 {
     if (p_Word.IsContent)
     {
         return(Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice, Content.Current.ReadFile(p_Word.PictureFilePath)));
     }
     else
     {
         return(Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice, Storage.Current.ReadFile(p_Word.PictureFilePath)));
     }
 }
예제 #7
0
 public void Open(string pFileName, uint uId)
 {
     if (pFileName != null)
     {
         if (pFileName.Length == 0)
         {
             return;
         }
         this.Close();
         this.m_effect   = CCApplication.sharedApplication().content.Load <SoundEffect>(pFileName);
         this.m_nSoundID = uId;
     }
 }
예제 #8
0
        public void Open(string pFileName, uint uId)
        {
            do
            {
                if (null == pFileName || pFileName.Length == 0)
                {
                    break;
                }

                Close();

                m_effect = CCApplication.sharedApplication().content.Load <SoundEffect>(pFileName);

                m_nSoundID = uId;
            } while (false);
        }
예제 #9
0
 public static Texture2D GetTexture2D(Word p_Word, Int32 p_Width, Int32 p_Height, bool p_Zoom)
 {
     return(Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice, FileLoader.ReadFile(p_Word.IsContent, p_Word.PictureFilePath), p_Width, p_Height, p_Zoom));
 }
예제 #10
0
 public static Texture2D GetTexture2D(Word p_Word)
 {
     return(Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice, FileLoader.ReadFile(p_Word.IsContent, p_Word.PictureFilePath)));
 }
예제 #11
0
 public static Texture2D GetTexture2D(String p_FilePath)
 {
     return(Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice, FileLoader.ReadFile(true, p_FilePath)));
 }
예제 #12
0
 /// <summary>
 /// a selector callback
 /// </summary>
 /// <param name="pSender"></param>
 public virtual void menuCloseCallback(CCObject pSender)
 {
     CCDirector.sharedDirector().end();
     CCApplication.sharedApplication().Game.Exit();
 }
예제 #13
0
 public static Texture2D GetTexture2D(String p_FilePath)
 {
     return(Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice, PhoneServices.Content.Current.ReadFile(p_FilePath)));
 }
예제 #14
0
        public override void draw()
        {
            base.draw();

            CCApplication app = CCApplication.sharedApplication();
            CCSize        s   = CCDirector.sharedDirector().getWinSize();

            // draw a simple line
            // The default state is:
            // Line Width: 1
            // color: 255,255,255,255 (white, non-transparent)
            // Anti-Aliased
            //glEnable(GL_LINE_SMOOTH);
            CCDrawingPrimitives.ccDrawLine(new CCPoint(0, 0), new CCPoint(s.width, s.height), new ccColor4F(255, 255, 255, 255));

            // line: color, width, aliased
            // glLineWidth > 1 and GL_LINE_SMOOTH are not compatible
            // GL_SMOOTH_LINE_WIDTH_RANGE = (1,1) on iPhone
            //glDisable(GL_LINE_SMOOTH);
            //glLineWidth( 5.0f );
            /*glColor4ub(255,0,0,255);*/
            //glColor4f(1.0, 0.0, 0.0, 1.0);
            CCDrawingPrimitives.ccDrawLine(new CCPoint(0, s.height), new CCPoint(s.width, 0), new ccColor4F(255, 0, 0, 255));

            // TIP:
            // If you are going to use always the same color or width, you don't
            // need to call it before every draw
            //
            // Remember: OpenGL is a state-machine.

            // draw big point in the center
            //glPointSize(64);
            /*glColor4ub(0,0,255,128);*/
            //glColor4f(0.0, 0.0, 1.0, 0.5);
            //ccDrawPoint( CCPointMake(s.width / 2, s.height / 2) );

            // draw 4 small points
            CCPoint[] points = { new CCPoint(60, 60), new CCPoint(70, 70), new CCPoint(60, 70), new CCPoint(70, 60) };
            //glPointSize(4);
            /*glColor4ub(0,255,255,255);*/
            //glColor4f(0.0, 1.0, 1.0, 1.0);
            //ccDrawPoints( points, 4);

            // draw a green circle with 10 segments
            //glLineWidth(16);
            /*glColor4ub(0, 255, 0, 255);*/
            //glColor4f(0.0, 1.0, 0.0, 1.0);
            CCDrawingPrimitives.ccDrawCircle(new CCPoint(s.width / 2, s.height / 2), 100, 0, 10, false, new ccColor4B(0, 255, 0, 255));

            // draw a green circle with 50 segments with line to center
            //glLineWidth(2);
            /*glColor4ub(0, 255, 255, 255);*/
            //glColor4f(0.0, 1.0, 1.0, 1.0);
            CCDrawingPrimitives.ccDrawCircle(new CCPoint(s.width / 2, s.height / 2), 50, ccMacros.CC_DEGREES_TO_RADIANS(90), 50, true, new ccColor4B(0, 255, 255, 255));

            // open yellow poly
            /*glColor4ub(255, 255, 0, 255);*/
            //glColor4f(1.0, 1.0, 0.0, 1.0);
            //glLineWidth(10);
            CCPoint[] vertices = { new CCPoint(0, 0), new CCPoint(50, 50), new CCPoint(100, 50), new CCPoint(100, 100), new CCPoint(50, 100) };
            CCDrawingPrimitives.ccDrawPoly(vertices, 5, false, new ccColor4F(255, 255, 0, 255));

            // closed purble poly
            /*glColor4ub(255, 0, 255, 255);*/
            //glColor4f(1.0, 0.0, 1.0, 1.0);
            //glLineWidth(2);
            CCPoint[] vertices2 = { new CCPoint(30, 130), new CCPoint(30, 230), new CCPoint(50, 200) };
            CCDrawingPrimitives.ccDrawPoly(vertices2, 3, true, new ccColor4F(255, 0, 255, 255));

            // draw quad bezier path
            CCDrawingPrimitives.ccDrawQuadBezier(new CCPoint(0, s.height),
                                                 new CCPoint(s.width / 2, s.height / 2),
                                                 new CCPoint(s.width, s.height),
                                                 50,
                                                 new ccColor4F(255, 255, 0, 255));

            // draw cubic bezier path
            CCDrawingPrimitives.ccDrawCubicBezier(new CCPoint(s.width / 2, s.height / 2),
                                                  new CCPoint(s.width / 2 + 30, s.height / 2 + 50),
                                                  new CCPoint(s.width / 2 + 60, s.height / 2 - 50),
                                                  new CCPoint(s.width, s.height / 2), 100,
                                                  new ccColor4F(255, 0, 255, 255));

            // restore original values
            //glLineWidth(1);
            /*glColor4ub(255,255,255,255);*/
            //glColor4f(1.0, 1.0, 1.0, 1.0);
            //glPointSize(1);
        }
예제 #15
0
 public override void draw()
 {
     base.draw();
     CCApplication.sharedApplication().GraphicsDevice.Clear(Color.White);
 }
예제 #16
0
 public static void ExitGame()
 {
     CCDirector.sharedDirector().end();
     CCApplication.sharedApplication().Game.Exit();
 }