Help Please! EAGLView ERROR

Discussion in 'iOS Programming' started by TwinofSian, Dec 26, 2011.

  1. TwinofSian, Dec 26, 2011
    Last edited: Dec 26, 2011

    TwinofSian macrumors member

    Joined:
    Oct 23, 2011
    #1
    I have been porting a project from cocos2d .99.4 onto the newest version of cocos2d using v 1.0.1. I copied over all the files, and changed the method names so as to update them with the new cocos2d engine.

    However, I have been getting warnings regarding this:

    Code:
    glView = [[EAGLView alloc] initWithFrame:[window bounds]
                                pixelFormat:kEAGLColorFormatRGBA8
                                depthFormat:GL_DEPTH_COMPONENT24_OES
                               preserveBackbuffer:NO];
    
    it said no method was listed, and it was right; I changed it to initWithView.

    However, the simulator would launch, but the game would not load; the screen would not even 'flip' as it is supposed to.

    The above problem drew my attention to the fact that the EAGLView instance variable in the App.h file does not appear to be defined. A jump to definition yields no results.

    HOWEVER, EAGLView.h does exist, but it doesnt seem to be recognized. My own theory is that the Cocos2d template features a Platform folder with a iOS and MAC subfolder.

    Before you ask, yes I selected the cocos2d iOS template, and it still saddled me with this Mac crap.
    link 1
    ^There you can see how EAGLView has no definition

    link 2
    ^There you can see EAGLView.h clearly exists, altho in an iOS subfolder of Platform

    link 3
    ^Here's the current cocos2d.h file
    link 4
    ^Here's the App.m Implementation of the EAGLView mthd. Note how EAGLView txt is colorless.

    So, question in a nutshell? How do I get the EAGLView.h file to be recognized by the App.h file? Because it clearly isn't.
     
  2. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    Have u tried importing "cocos2d.h"
    It doesn't know what EAGLView is, what kind of class, because you didn't put a forward declaration or imported it.
    Think that should solve this issue.
     
  3. TwinofSian, Dec 27, 2011
    Last edited: Dec 27, 2011

    TwinofSian thread starter macrumors member

    Joined:
    Oct 23, 2011
    #3
    I have tried something similar in the past, but the Project's files are setup in such a way as to create a delicate loop effect wherein the iPhone Game Kit imports cocos2d and Foundation header files, while the main project imports the Game Kit, and all game files import the Game Header files. Here are some screenshots, including the result of me following your advice.

    Here's the Project's header File:
    Project Header File
    Here's the Kit's header file:
    Kit Header File

    Here's the header and implementation file that is giving me all the trouble *Note, I added the suggestions: a @class declaration and an #import.*

    App Header
    App Implementation

    Note how the console error now says that
    However, when I tried

    Code:
    App.h
    
    @class cocos2d;
    and

    Code:
    App.m
    
    #import "cocos2d.h"
    The console message said:
    This tells me that even though I am forwarding/importing the EAGLView file, it doesn't seem to be doing the trick. The cocos2d declarations/imports seems to disrupt the loop entirely.

    I feel I am close to solving this issue, any insights would be much appreciated.
     

Share This Page