MyGui and SFML (OpenGL)

Assouan

04-03-2012 13:42:45

(sorry for my littel english, I'm french)

Hello, How to make a Hello World plyz :/ ?

I need a exemple (or sample) for get the viewing (or pixel) for draw in sfml, but I not find the solution

#include <MyGUI/MyGUI.h>
#include <MyGUI/MyGUI_DataManager.h>
#include <MyGUI/MyGUI_OpenGLImageLoader.h>
#include <MyGUI/MyGUI_OpenGLDataManager.h>
#include <MyGUI/MyGUI_OpenGLPlatform.h>
#include <MyGUI/MyGUI_OpenGLRenderManager.h>

#include "OpenGLImageLoader_Devil.hpp"

#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>

#include <windows.h>
#include <gl/gl.h>

#include <string>
#include <iostream>

using namespace std;

int main()
{
// Create the main window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

// Créate a Gui
MyGUI::Gui* mGUI;

OpenGLImageLoader_Devil* mIL = new OpenGLImageLoader_Devil();

MyGUI::OpenGLPlatform* mPlatform = new MyGUI::OpenGLPlatform();
mPlatform->initialise(mIL, "mIL");

mGUI = new MyGUI::Gui();
mGUI->initialise();

MyGUI::ButtonPtr button = mGUI->createWidget<MyGUI::Button>("Button", 10, 10, 300, 26, MyGUI::Align::Default, "Main");
button->setCaption("Hello World!");

// Start the game loop
while (window.IsOpen())
{
// Process events
sf::Event event;
while (window.PollEvent(event))
{
// Close window : exit
if (event.Type == sf::Event::Closed)
window.Close();
}

// Clear screen
window.Clear(sf::Color(255,200,0));

// Get Gui Image and Draw in SFML

// Update the window
window.Display();
}

return EXIT_SUCCESS;
}


Thanks for you help !

Altren

04-03-2012 14:59:05

Well, first of all you should try to call
mPlatform->getRenderManagerPtr()->drawOneFrame();every frame.

Assouan

04-03-2012 15:40:48

Ok thanks ! and for get the image or pixel ?
Exemple :
mPlatform->getRenderManagerPtr()->drawOneFrame();
int sizeX = mPlatform->getRenderManagerPtr()->getViewSize().width;
int sizeY = mPlatform->getRenderManagerPtr()->getViewSize().height;

for (int x(0) ; x < sizeX ; x++)
{
for (int y(0) ; y < sizeY ; y++)
{
// Exemple:
// mGUI->getColorAtPixel(x,y).red;
// mGUI->getColorAtPixel(x,y).green;
// mGUI->getColorAtPixel(x,y).blue;
// mGUI->getColorAtPixel(x,y).alpha;

// For afther I draw this pixel in sfml
}
}


Or if you have a other systèm, what is it ?

Thanks !

Altren

04-03-2012 19:40:37

MyGUI do not render into pixel buffer. You should look how OpenGL platform works and try to adapt it.