Absolutely.CABAListic wrote:Sounds great
I'm currently writing a small little game engine for Python for which I hope to get to the GUI part in the next few weeks. Once I do, I will take a very close look at gorilla, and then perhaps we could discuss a few concrete ideas what and how could go into the Ogre core.
Gorilla - minimal hud and overlay replacement for OGRE
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Re: gorilla - minimal hud and overlay replacement. UPDATED!
- Praetor
- OGRE Retired Team Member
- Posts: 3335
- Joined: Tue Jun 21, 2005 8:26 pm
- Location: Rochester, New York, US
- x 3
- Contact:
Re: gorilla - minimal hud and overlay replacement. UPDATED!
Of course you meant the components, right? Like where the terrain and paging features currently reside? That has to be what you meant...CABAListic wrote:Sounds great
I'm currently writing a small little game engine for Python for which I hope to get to the GUI part in the next few weeks. Once I do, I will take a very close look at gorilla, and then perhaps we could discuss a few concrete ideas what and how could go into the Ogre core.
Game Development, Engine Development, Porting
http://www.darkwindmedia.com
http://www.darkwindmedia.com
-
- Gnome
- Posts: 324
- Joined: Sun May 11, 2008 9:27 pm
- x 20
Re: gorilla - minimal hud and overlay replacement. UPDATED!
Hey Betajaen!
Great work you're doing here. I'm currently playing around with Gorilla in my engine and so far it seems _exactly_ what I need. Im trying to implement a basic mouse cursor appearance. I'm using a Rectangle with background set to "mousecursor" and when I set top() and left() accordingly as the mouse moves, it seem to only move left and top corners. Right/bottom corners are stuck at their original positon. Am I misinterpreting left() top() as canvas/rectangle position ..?
Great work you're doing here. I'm currently playing around with Gorilla in my engine and so far it seems _exactly_ what I need. Im trying to implement a basic mouse cursor appearance. I'm using a Rectangle with background set to "mousecursor" and when I set top() and left() accordingly as the mouse moves, it seem to only move left and top corners. Right/bottom corners are stuck at their original positon. Am I misinterpreting left() top() as canvas/rectangle position ..?
-
- OGRE Retired Team Member
- Posts: 2903
- Joined: Thu Jan 18, 2007 2:48 pm
- x 58
- Contact:
Re: gorilla - minimal hud and overlay replacement. UPDATED!
Hm nope, didn't think of that. But sure, that's a sensible safe approach.Praetor wrote:Of course you meant the components, right? Like where the terrain and paging features currently reside? That has to be what you meant...CABAListic wrote:Sounds great
I'm currently writing a small little game engine for Python for which I hope to get to the GUI part in the next few weeks. Once I do, I will take a very close look at gorilla, and then perhaps we could discuss a few concrete ideas what and how could go into the Ogre core.
(Although, for lower-level components like a TextureAtlas and a 'ManualObject' for 2D stuff, I could see benefits of placing them in the core. But nevermind, I really just didn't think of a component.)
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Re: gorilla - minimal hud and overlay replacement. UPDATED!
It was a bug I found yesterday, redownload from Github, there is a fixed version.mrmclovin wrote:Right/bottom corners are stuck at their original positon. Am I misinterpreting left() top() as canvas/rectangle position ..?
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Re: gorilla - minimal hud and overlay replacement. UPDATED!
Code: Select all
Changes:
- Added multiple font support for a single Texture Atlas
- Added Dejavu-9 and Dejavu-24 fonts to dejavu.gorilla and dejavu.png, known as "9", "24". Existing font is known as "14".
- Improved Glyph rendering
- Fixed memory leak with TextureAtlases not freeing Glyphs or Sprites
- _tommo_
- Gnoll
- Posts: 677
- Joined: Tue Sep 19, 2006 6:09 pm
- x 5
- Contact:
Re: gorilla - minimal hud and overlay replacement. UPDATED!
Most awesome screenshot ever.betajaen wrote:
- syedhs
- Silver Sponsor
- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
Re: gorilla - hud/overlay replacement - Updated on 07-Sep-20
Although I have not used it (yet), I would say this fits what we call 'less for more'
I think I am going to replace all my overlays with gorilla.
Thank you.
I think I am going to replace all my overlays with gorilla.
Thank you.
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
- AshMcConnell
- Silver Sponsor
- Posts: 605
- Joined: Fri Dec 14, 2007 11:44 am
- Location: Northern Ireland
- x 16
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 07-Sep-20
I've just been walking with gorillas. Looks great .
Is there any way to show part of a sprite? I was thinking of showing a percentage of my RPM metre would work nicely. I could show each RPM element separately, but it would be more efficient just to show a percentage. Can anyone think of a way to do that?
Thanks for your help!
Ash
Is there any way to show part of a sprite? I was thinking of showing a percentage of my RPM metre would work nicely. I could show each RPM element separately, but it would be more efficient just to show a percentage. Can anyone think of a way to do that?
Thanks for your help!
Ash
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 07-Sep-20
Perhaps, yes. I'd have to put some code in though.
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 07-Sep-20
Updated
http://github.com/betajaen/gorilla
@AshMcConnell
Something like this is what you want. (Remember to keep a cache of the sprite pointer for speed!)
When you want to update, just adjust the width and background image:
Code: Select all
Changes
- (Requested by AshMcConnell) Sprites used with Rectangles can be partially shown from the left/top position. See: Rectangle::background_image
@AshMcConnell
Something like this is what you want. (Remember to keep a cache of the sprite pointer for speed!)
Code: Select all
rect = mLayer->createRectangle(400,400,50,100);
Gorilla::Sprite* coco = mLayer->_getSprite("coco");
rect->background_image(coco, 0.5f, 1.0f);
Code: Select all
rect->background_image(coco, 0.75f, 1.0f); // 0.75 = 75% = 75% power!
rect->width(75); // 75px (Sprite is 100px in size)
- AshMcConnell
- Silver Sponsor
- Posts: 605
- Joined: Fri Dec 14, 2007 11:44 am
- Location: Northern Ireland
- x 16
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 08-Sep-20
Damn, that was quick! I was fiddling with the same lines of code and came up with the same solution
Thanks a lot! I'll try and get my RPM Meter working and let you know how I get on.
Thanks again,
Ash
Thanks a lot! I'll try and get my RPM Meter working and let you know how I get on.
Thanks again,
Ash
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
- AshMcConnell
- Silver Sponsor
- Posts: 605
- Joined: Fri Dec 14, 2007 11:44 am
- Location: Northern Ireland
- x 16
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 08-Sep-20
Pretty basic textures, but it works in principle
Are you still intending to allow render to texture as an option?
All the best,
Ash
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 08-Sep-20
Nice.
Working on it now. Trying to decided on a name for a "RenderTarget" type class for Screen and RTTScreen to inherit from.
Working on it now. Trying to decided on a name for a "RenderTarget" type class for Screen and RTTScreen to inherit from.
-
- Gnome
- Posts: 324
- Joined: Sun May 11, 2008 9:27 pm
- x 20
Re: gorilla - hud/overlay replacement - Updated on 08-Sep-20
Yoo! Any opacity support implemented / planned ?
Love this framework.
Love this framework.
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
- AshMcConnell
- Silver Sponsor
- Posts: 605
- Joined: Fri Dec 14, 2007 11:44 am
- Location: Northern Ireland
- x 16
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 08-Sep-20
Hi Betajean,
I'm having a bit of a problem with the widthClip / resize stuff (sorry I've been a pain already!). The co-ordinates seem to be a little off.
Here is a video showing the problem. You may need to go fullscreen in youtube to see it properly. If you look at the RPM bar you can see where the polys join as the co-ords are slightly off. Is there any way I can limit this problem?
Thanks for your help
All the best,
Ash
I'm having a bit of a problem with the widthClip / resize stuff (sorry I've been a pain already!). The co-ordinates seem to be a little off.
Here is a video showing the problem. You may need to go fullscreen in youtube to see it properly. If you look at the RPM bar you can see where the polys join as the co-ords are slightly off. Is there any way I can limit this problem?
Thanks for your help
All the best,
Ash
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 08-Sep-20
Silly question, but what does it look like in OpenGL?
- AshMcConnell
- Silver Sponsor
- Posts: 605
- Joined: Fri Dec 14, 2007 11:44 am
- Location: Northern Ireland
- x 16
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 08-Sep-20
Oddly it's absolutely perfect.betajaen wrote:Silly question, but what does it look like in OpenGL?
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 08-Sep-20
It's Microsoft everything is half and half with them.
I think the rectangles width/height need to have added texelWidth/texelHeight and left/top need to be subtracted texelWidth/texelHeight. Maybe the UV's too.
I can't try it out at the moment because my Gorilla has a missing Screen class, but if you want to try it out for me, the caption code is a good place to show you what to do.
[Edit]
Basically, in the Rectangle::_redraw function. You need to expand the rectangle size by twice the texel size.
Something like that.
You may need to do the same thing for the UV too, but that would be in the background_image function.
I think the rectangles width/height need to have added texelWidth/texelHeight and left/top need to be subtracted texelWidth/texelHeight. Maybe the UV's too.
I can't try it out at the moment because my Gorilla has a missing Screen class, but if you want to try it out for me, the caption code is a good place to show you what to do.
[Edit]
Basically, in the Rectangle::_redraw function. You need to expand the rectangle size by twice the texel size.
Something like that.
Code: Select all
Ogre::Real texelOffsetX = mLayer->_getTexelX(), texelOffsetY = mLayer->_getTexelY()
Ogre::Vector2 a, b, c, d;
a.x = mLeft - texelOffsetX; a.y = mTop - texelOffsetY;
b.x = mRight + texelOffsetX; b.y = mTop - texelOffsetY;
c.x = mLeft - texelOffsetX; c.y = mBottom + texelOffsetY;
d.x = mRight + texelOffsetX; d.y = mBottom + texelOffsetY;
- AshMcConnell
- Silver Sponsor
- Posts: 605
- Joined: Fri Dec 14, 2007 11:44 am
- Location: Northern Ireland
- x 16
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 08-Sep-20
Thanks BetaJaen
It has made the textures link up correctly, but the lights are still creeping when the width is changed.
I tried adding the texelOffset to the uv, but it didn't seem to make a difference.
Thanks again,
Ash
PS. lol, you got a bit of F1 practice in the video too
It has made the textures link up correctly, but the lights are still creeping when the width is changed.
I tried adding the texelOffset to the uv, but it didn't seem to make a difference.
Code: Select all
Vertex temp;
Ogre::Vector2 uv = mLayer->_getSolidUV();
uv.x += texelOffsetX;
uv.y += texelOffsetY;
Ash
PS. lol, you got a bit of F1 practice in the video too
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 08-Sep-20
Wrong UV.
[Edit]
Forgot your using this one:
The other background functions of Rectangle need to be similar like that too.
Code: Select all
/*! function. background_image
desc.
Set the background to a sprite from the texture atlas.
note.
To remove the image pass on a null pointer.
*/
void background_image(Sprite* sprite)
{
if (sprite == 0)
{
mUV[0] = mUV[1] = mUV[2] = mUV[3] = mLayer->_getSolidUV();
}
else
{
Ogre::Real texelOffsetX = mLayer->_getTexelX(), texelOffsetY = mLayer->_getTexelY();
mUV[0].x = mUV[3].x = sprite->uvLeft - texelOffsetX;
mUV[0].y = mUV[1].y = sprite->uvTop - texelOffsetY;
mUV[1].x = mUV[2].x = sprite->uvRight + texelOffsetX;
mUV[2].y = mUV[3].y = sprite->uvBottom + texelOffsetY;
}
mDirty = true;
mLayer->_markDirty();
}
Forgot your using this one:
Code: Select all
/*! function. background_image
desc.
Set the background to a sprite from the texture atlas, with clipping.
Clipping is used for example with RPM meters on HUDs, where a portion
of the sprite needs to be shown to indicate the RPM on the car.
widthClip is a decimal percentage of the width of the sprite (0.0 none, 1.0 full)
heightClip is a decimal percentage of the height of the sprite (0.0 none, 1.0 full)
You should use this with the width() and height() functions for a full effect.
note.
To remove the image pass on a null pointer.
*/
void background_image(Sprite* sprite, Ogre::Real widthClip, Ogre::Real heightClip)
{
if (sprite == 0)
{
mUV[0] = mUV[1] = mUV[2] = mUV[3] = mLayer->_getSolidUV();
}
else
{
Ogre::Real texelOffsetX = mLayer->_getTexelX(), texelOffsetY = mLayer->_getTexelY();
mUV[0].x = mUV[3].x = sprite->uvLeft - texelOffsetX;
mUV[0].y = mUV[1].y = sprite->uvTop - texelOffsetY;
mUV[1].x = mUV[2].x = sprite->uvLeft + ( (sprite->uvRight - sprite->uvLeft) * widthClip ) + texelOffsetX ;
mUV[2].y = mUV[3].y = sprite->uvTop + ( (sprite->uvBottom - sprite->uvTop) * heightClip ) + texelOffsetY;
}
mDirty = true;
mLayer->_markDirty();
}
- AshMcConnell
- Silver Sponsor
- Posts: 605
- Joined: Fri Dec 14, 2007 11:44 am
- Location: Northern Ireland
- x 16
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 08-Sep-20
Hmm that doesn't seem to work properly. It makes the RPM lights disappear entirely.
From some tracing I get
sprite->uvLeft = 0.0
sprite->uvRight = 0.29297
texelOffsetX = -0.5
mUV[1].x and mUV[2].x become (0.29297 - 0.5) => -0.207 when we are showing the full width
Which doesn't seem right?
Thanks!
Ash
From some tracing I get
sprite->uvLeft = 0.0
sprite->uvRight = 0.29297
texelOffsetX = -0.5
mUV[1].x and mUV[2].x become (0.29297 - 0.5) => -0.207 when we are showing the full width
Which doesn't seem right?
Thanks!
Ash
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
Re: gorilla - hud/overlay replacement - Updated on 08-Sep-20
Do'h yes.
I'm mixing up the units, they needs to be converted.
I'm mixing up the units, they needs to be converted.
Code: Select all
Ogre::Real texelOffsetX = mLayer->_getTexelX(), texelOffsetY = mLayer->_getTexelY();
texelOffsetX /= mLayer->_getTextureSize().x;
texelOffsetY /= mLayer->_getTextureSize().y;