Harry
Member
|
Adding elements into region / GuiImage
Hi. I want to add some Text gui objects into region, but I have problems with position:
Code:
region+=text.create(Vec2(region.crect.w()/2,region.pos().y),"Level");
How can I put text exactly in the center of region?
(This post was last modified: 03-06-2010 04:31 PM by Harry.)
|
|
03-01-2010 08:52 PM |
|
Esenthel
Administrator
|
RE: Adding elements into region
Vec2( ok , -region.crect.h()/2)
|
|
03-02-2010 12:04 PM |
|
Harry
Member
|
RE: Adding elements into region
Ok thanks I tried use region.crect.h()/2 and I didn't think to add "-" xd
|
|
03-02-2010 02:05 PM |
|
Harry
Member
|
RE: Adding elements into region / GuiImage
How can I draw minimap from tutorial in Gui Window? Now I have sth like this:
Code:
GuiImage imageT;
Window winMap;
winMap+=imageT.create(&image);
imageT.image->drawMask(WHITE,0,map_image_rect,*Images("Gfx/MiniMap/miniMapAlpha.gfx"),winMap.crect);
but it works a bit strange:
http://img695.imageshack.us/i/scrsh2.jpg/ - I have small image on the corner
http://img3.imageshack.us/i/scrsh.jpg/ - mini map isn't drawing as GuiImage in Map window.
Could somebody give me some tips?
|
|
03-06-2010 04:37 PM |
|
Esenthel
Administrator
|
RE: Adding elements into region / GuiImage
you should use GuiCustom for example, add it to the window, and extend the drawing methods, inside it draw as in tutorial
|
|
03-06-2010 04:39 PM |
|
Harry
Member
|
RE: Adding elements into region / GuiImage
Ok. I made it, but I have only one strange thing. When I set barVisible(true) my mini map is draw on this bar, but when i set barVisible(false) everything is draw properly. Do you know why?
|
|
03-07-2010 10:39 AM |
|
Esenthel
Administrator
|
RE: Adding elements into region / GuiImage
if you're using GuiCustom::draw method it shouldn't be a problem
if you're using GuiCustom::draw function you should use window.crect instead of rect
|
|
03-07-2010 03:51 PM |
|
Harry
Member
|
RE: Adding elements into region / GuiImage
I have this code:
Code:
struct MiniMap : GuiCustom
{
virtual void draw(GuiPC &gpc);
void drawMiniMap(...){...}
}
cpp file
void MiniMap::draw(GuiPC &gpc)
{
drawMiniMap(ExpGui.winMap.crect,Players[0].pos().xz(),32);
}
...
MiniMap custMap;
void ExperienceGui::create()
{
Gui+=winMap .create(Rect_C(0,0,1,1),"Map").barVisible(false).hide();
winMap+=custMap.create(winMap.crect);
}
Is there something wrong?
(This post was last modified: 03-07-2010 04:33 PM by Harry.)
|
|
03-07-2010 04:32 PM |
|
Esenthel
Administrator
|
RE: Adding elements into region / GuiImage
make use of 'gpc'
ExpGui.winMap.crect + gpc.offset
|
|
03-07-2010 06:25 PM |
|
Harry
Member
|
RE: Adding elements into region / GuiImage
I add in the center of minimap an image which should rotate when i rotate my player. So I draw this image by drawRotate method. As angle parameter I use this code:
Players[0].matrix().angles().y
but I'm not sure that this is ok, because sometimes (especially when I fly) my image rotate very strange (slower than it should or in wrong direction). Am I doing something wrong?
(This post was last modified: 03-10-2010 08:41 PM by Harry.)
|
|
03-10-2010 08:28 PM |
|