Wednesday, July 26, 2017

So Whats changed?

I wanted to test the include headers, to make sure I was getting the openGL, openGLES includes.

The OSX version will use openGL, but IOS/Android uses openGLES. I don't want this difference to be all through the code, to it will be localized into the view code, with an abstraction that handles the kinds of objects I want to render.

There is a cost for this layer, but if you get things right, its minimal, and the benefit in game code, of not having to worry about the target means I could easily port to other platforms at a later stage.

I builts a PS2/Gamecube/PC(openGL) engine, that I ported to XBox(DirectX) in around 2 weeks. It supported fully skinned 3D characters, and a full scene graph. This project is just going to be 2D, so I'm not very worried.

As part of the testing, I some quick window init, wait for key code. Its very temporary, but allowed me to test everything was compiling, linking, and running:


void test(void)
{
    if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
    {
        std::cout << "ERROR SDL_Init" << std::endl;
    }

    // Create window
    SDL_Window * lWindow = SDL_CreateWindow("Defender",                 // window title
                                            SDL_WINDOWPOS_CENTERED,     // x position, centered
                                            SDL_WINDOWPOS_CENTERED,     // y position, centered
                                            640,                        // width, in pixels
                                            480,                        // height, in pixels
                                            SDL_WINDOW_OPENGL           // flags
                                           );

    SDL_Event lEvent;
    bool lRunning = true;

    while (lRunning) {
        while (SDL_PollEvent(&lEvent))
        {
            switch (lEvent.type)
            {
            case SDL_WINDOWEVENT:
            {
            }
            break;

            case SDL_KEYDOWN:
            {
                if (lEvent.key.keysym.scancode == SDL_SCANCODE_ESCAPE) {
                    lRunning = false;
                }
            }
            case SDL_QUIT:
                lRunning = false;
                break;
            }
        }
    }
}


So here is the screen shot, I know its not very impressive, but its only the start.


No comments:

Post a Comment