Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kehvatsu

Pages: [1]
1
Window / Re: Integrating SFML to Cocos2d-x?
« on: July 05, 2013, 03:53:51 pm »
Thanks,

I decided to go with windows events. I just would have liked to make it cross-platform with SFML but that doesn't seem to be possible. Cocos2d-x is not designed for desktop use so it needs quite a bit of modifications. It has no support for right mouse button, mouse wheel, full screen, keyboard...

2
Window / Integrating SFML to Cocos2d-x?
« on: July 04, 2013, 11:13:49 pm »
Hi,

Is it possible to integrate SFML Events to Cocos2d-x OpenGL window? I can't get it to work because I don't understand enough of OpenGL to initialize SFML. Can I somehow initialize SFML window with already created Cocos2d-x OpenGL window? I'm only interested in receiving Events from SFML to use as input in my game.

This is the main game loop in Cocos2d-x:

int Application::run()
{

    PVRFrameEnableControlWindow(false);

    // Main message loop:
    MSG msg;
    LARGE_INTEGER nFreq;
    LARGE_INTEGER nLast;
    LARGE_INTEGER nNow;


    QueryPerformanceFrequency(&nFreq);
    QueryPerformanceCounter(&nLast);

    // Initialize instance and cocos2d.

    if (!applicationDidFinishLaunching())
    {
        return 0;
    }

    EGLView* pMainWnd = EGLView::sharedOpenGLView();
    pMainWnd->centerWindow();
    ShowWindow(pMainWnd->getHWnd(), SW_SHOW);

    while (1)
    {
        if (! PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
        {
            // Get current time tick.
            QueryPerformanceCounter(&nNow);

                        //CCLog("MAIN LOOP: %lld",nNow.QuadPart);

            // If it's the time to draw next frame, draw it, else sleep a while.
            if (nNow.QuadPart - nLast.QuadPart > _animationInterval.QuadPart)
            {
                nLast.QuadPart = nNow.QuadPart;
                Director::sharedDirector()->mainLoop();
            }
            else
            {
                Sleep(0);
            }
            continue;
        }

        if (WM_QUIT == msg.message)
        {
            // Quit message loop.
            break;
        }

        // Deal with windows message.
        if (! _accelTable || ! TranslateAccelerator(msg.hwnd, _accelTable, &msg))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return (int) msg.wParam;
}

I tried to create the sf::RenderWindow like this:
sf::RenderWindow r_wnd;
r_wnd.create(pMainWnd->getHWnd());
 

But this only creates a black screen.

Any ideas?

Thanks.




3
Graphics / Anti-aliasing RenderTexture
« on: May 31, 2013, 09:59:50 pm »
Hi,

I'm working on a game that relays heavily on RenderTexture for graphics of the game. RenderTexture feature of SFML is absolutely the best I have seen in any other PC graphics framework! My only problem is that I need to anti-alias the textures but this is currently not supported on SFML. So I have been thinking about hacks to get anti-aliasing effect for my texture.

Right now I'm thinking that lets say I want to draw sf::CircleShape with radius of 1 on to the RenderTexture and anti-alias it. I would draw the actual circle in radius of 2 and then get the sf::Texture from sf::RenderTexture, then use the copyToImage() and create sf::image from the texture. Then create new empty sf::Image of size 1x and then use some down sample algorithm to copy the pixels from the 2x sized sf::image to the new one. After that I would create texture from the sf:image and use that texture to use actual sprite.

But this seems overly complicated for such a simple task. Is there any easier way to achieve anti-aliasing for sf::RenderTexture? The method does NOT need to be fast. I will render the textures at the beginning of the game once.

Pages: [1]