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 - ScoreX

Pages: [1]
1
Graphics / Board for PacMan
« on: December 25, 2011, 12:23:51 am »
The easiest way would be to have two arrays ( rows and columns ) and fill them with 1's and 0's which will define the maze.

Then you just draw the maze. Every square there is a 1, you have a wall. Every square that is a 0, you have a walkable path.

A small example:

1111111111111
1000000000001
1111110111111
1000000000001
1111111111111

You can walk about in either stretch where there is 0's, and you can pass from one side to the other using the middle path with the 0.

2
General / SFML + Awesomium integration
« on: October 17, 2011, 01:30:23 pm »
That works perfectly Laurent, thank you.

Yeah in my actual code I have the variables initialized outside the update loop, but to keep the amount of code I had to show you small I put them in there.

Thanks again, and great library by the way  :D

3
General / SFML + Awesomium integration
« on: October 16, 2011, 10:44:16 pm »
No messages are output to the console, it just fails gracefully. Try catch doesnt catch an error either.


If I step into the code at LoadFromMemory, it takes me to

Code: [Select]

template <typename T>
Rect<T>::Rect() :
Left  (0),
Top   (0),
Width (0),
Height(0)
{

}


and then returns.

**EDIT**

Ok, have it working now, but not entirely as I would like.

Code: [Select]

if(awe_webview_is_loading_page(webView))
{
awe_webcore_update();
}
else
{
awe_webcore_update();

renderBuffer = awe_webview_render(webView);

if(renderBuffer != NULL)
{
size_t bufferSize = awe_renderbuffer_get_height(renderBuffer) * awe_renderbuffer_get_rowspan(renderBuffer);

std::vector<sf::Uint8> charBuffer;
charBuffer.resize(bufferSize);

sf::Uint8* charPtr = &charBuffer[0];

awe_renderbuffer_copy_to(renderBuffer, charPtr, awe_renderbuffer_get_rowspan(renderBuffer), 4, true, false);

image.Create(1024, 768, charPtr);

texture.LoadFromImage(image);

sprite.SetTexture(texture);

window.Draw(sprite);
}
}


Using the Create function in sf::Image I can pass the pixel buffer and it works perfectly. But it'd be nice to remove that step and just grab it straight from memory.

4
General / SFML + Awesomium integration
« on: October 16, 2011, 10:19:11 pm »
Right, i'm one step closer. Found out how to get the buffer size ( buffer width * buffer rowspan - for anyone else who is wondering how ).

LoadFromMemory is still returning false however.

Code: [Select]

if(awe_webview_is_loading_page(webView))
{
awe_webcore_update();
}
else
{
awe_webcore_update();

renderBuffer = awe_webview_render(webView);

if(renderBuffer != NULL)
{

size_t bufferSize = awe_renderbuffer_get_rowspan(renderBuffer) * awe_renderbuffer_get_height(renderBuffer);

if(t.LoadFromMemory(awe_renderbuffer_get_buffer(renderBuffer), bufferSize))
{
sf::Sprite s(t);
window.Draw(s);
}
else
{
text.SetString("Failed");
window.Draw(text);
}


}
}

5
General / SFML + Awesomium integration
« on: October 16, 2011, 09:47:15 pm »
Ah! I see. Thanks for the speedy reply. I can see my C++ skills need to be dusted off a bit more for getting sizeof wrong.

It it is a pretty funny name indeed, and hopefully will live up to it once I can get it working  :)

6
General / SFML + Awesomium integration
« on: October 16, 2011, 09:26:13 pm »
Hi guys,


long time lurker first time poster. I'm trying to integrate Awesomium with SFML but i'm running into a small issue.

I'm trying to save the renderbuffer of Awesomium to a sf::Texture using the LoadFromMemory function, but the function always returns false. I'm hoping someone can help me fix the problem or let me know a better way of doing it. Thanks.

Code: [Select]

if(awe_webview_is_loading_page(webView))
{
awe_webcore_update();
}
else
{
awe_webcore_update();

renderBuffer = awe_webview_render(webView);

if(renderBuffer != NULL)
{
if(t.LoadFromMemory(awe_renderbuffer_get_buffer(renderBuffer), sizeof(awe_renderbuffer_get_buffer(renderBuffer)))) // This returns false
{
text.SetString("Passed");
window.Draw(text);
}
else
{
text.SetString("Failed");
window.Draw(text);
}
}
}

Pages: [1]
anything