Berkelium sharp released

Vectrex

24-02-2010 11:51:05

Hey, this guy just wrapped the Berkelium Chromium c++ wrapper for C#
Looks like a great thing to get working in MOgre. There's an XNA demo which should be close
http://code.google.com/p/berkelium-sharp/

smiley80

24-02-2010 14:07:27

Good job!

Quick and dirty Mogre test:


Now I finally know why my approach didn't work. The wrapper was ok, but there was a stupid mistake in the convert to bitmap part.

Vectrex

24-02-2010 15:04:45

Nice!

anthrax11

24-02-2010 19:53:52

Darn, someone beat me to it, oh well, the more the merrier :). Here's mine, but not quite done yet:
http://berkeliumdotnet.codeplex.com/

Anyway, if someone's still using Awesomium, I just finished a complete Mogre demo for AwesomiumDotNet:
https://awesomiumdotnet.svn.codeplex.co ... les/Mogre/

rattus

25-06-2010 14:19:11

Hi there,

could you please post working sample with berkelium in mogre ?
I've been fiddling with it today and cannot find way to correctly get data from paint event to mogre texture.. :(

pretty please.

smiley80

25-06-2010 16:20:02

Paint event handler:
private void win_Paint(Window window, IntPtr sourceBuffer, Sirikata.BerkeliumSharp.Rect rect, int dx, int dy, Sirikata.BerkeliumSharp.Rect scrollRect)
{
using (ResourcePtr rpt = TextureManager.Singleton.GetByName(textureName))
{
using (TexturePtr texture = rpt)
{
HardwarePixelBufferSharedPtr texBuffer = texture.GetBuffer();

if (dx != 0 || dy != 0)
{
var sourceRect = new System.Drawing.Rectangle(scrollRect.Left, scrollRect.Top, scrollRect.Width, scrollRect.Height);
var destRect = sourceRect;
destRect.X += dx;
destRect.Y += dy;

var overlap = System.Drawing.Rectangle.Intersect(destRect, sourceRect);

if (destRect.Left < 0)
{
sourceRect.X -= destRect.Left;
destRect.X = 0;
}
if (destRect.Top < 0)
{
sourceRect.Y -= destRect.Top;
destRect.Y = 0;
}

destRect.Width = sourceRect.Width = overlap.Width;
destRect.Height = sourceRect.Height = overlap.Height;

if ((sourceRect.Width > 0) && (sourceRect.Height > 0))
{
PixelBox pb = texBuffer.Lock(
new Box(
(uint)sourceRect.Left,
(uint)sourceRect.Top,
(uint)sourceRect.Right,
(uint)sourceRect.Bottom),
HardwareBuffer.LockOptions.HBL_READ_ONLY);
texBuffer.Unlock();

texBuffer.BlitFromMemory(
pb,
pb.box);
}
}

texBuffer.BlitFromMemory(
new PixelBox(
(uint)rect.Width,
(uint)rect.Height,
0,
texture.Format,
sourceBuffer),
new Box(
(uint)rect.Left,
(uint)rect.Top,
(uint)rect.Right,
(uint)rect.Bottom));

texBuffer.Dispose();
}
}
}

rattus

01-07-2010 10:13:36

Thanks a thousand times :-)