About Store Forum Documentation Contact



Post Reply 
GuiPC: Okay to use?
Author Message
Driklyn Offline
Member

Post: #1
GuiPC: Okay to use?
I'm curious to know if it's okay to use a custom GuiPC object to manually draw GuiObj's (Text, for example). I have it working, but I've noticed the entire screen gets clipped to whatever the GuiPC.clip values are (i.e. portions of the screen outside of these values no longer get cleared/drawn anymore, so whatever was there, stays there, as if it's frozen).

Here's some sample code. Notice how the black rectangle is drawn to the size of D.viewRect(), which is always the entire screen, but if you set GuiPC.clip to something other than the entire screen (i.e. Rect(-1, -1, 1, 1)), the black rectangle is only visible on that portion of the screen (i.e. the screen is clipped to the value of GuiPC.clip). Look at the screenshots below to see what I'm talking about.

PHP Code:
GuiPC guiPC;
Text  text;

void InitPre()
{
   
DataPath("../../../Data");
   
Paks.add("engine.pak");
}

bool Init()
{
   
//guiPC.clip = D.viewRect();
   
guiPC.clip Rect(-1, -111);
   
   
text.create("Hello World!");
   
text.tds->color WHITE;
   
   return 
true;
}

bool Update()
{
   if (
Kb.bp(KB_ESC)) return false;
   return 
true;
}

void Draw()
{
   
D.clear(TURQ);
   
   
D.rect(BLACKD.viewRect());
   
D.text(Rect(-1011), "D.rect(BLACK, D.viewRect());\n\nD.viewRect() => " D.viewRect().asText());
   
   
D.text(0, -0.5f"guiPC.clip => " guiPC.clip.asText());
   
text.draw(guiPC);
}

void Shut() {} 


Attached File(s) Image(s)
       
05-01-2011 12:12 AM
Find all posts by this user Quote this message in a reply
Barthap Offline
Member

Post: #2
RE: GuiPC: Okay to use?
I dont understand, what's strange here? Isn't it normal?
05-01-2011 08:31 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #3
RE: GuiPC: Okay to use?
Here's a better picture to get the idea:

   

As you can see, if GuiPC.clip is set to Rect(-1, -1, 1, 1), only that portion of the screen is drawn to anymore. The screen outside of this area stays as it was.

I'm assuming this is normal behavior, but I just want to make sure using a GuiPC to manually draw Text is okay to do, as there already is EE::Gui that you normally assign GuiObj's to.

I guess it just seemed weird how a GuiPC can change the clipping area of the screen, not just for GuiObj's. That's why I made this post, I suppose.
05-01-2011 09:01 AM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #4
RE: GuiPC: Okay to use?
it's ok to use GuiPC
they do affect clipping, which you may restore using D.clip(..) after drawing with guipc
05-01-2011 10:07 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #5
RE: GuiPC: Okay to use?
Okay, thanks...
05-03-2011 12:00 AM
Find all posts by this user Quote this message in a reply
Post Reply