Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Knox on Thu 05/08/2010 20:50:17

Title: Drawing on the CustomDialogGui...?
Post by: Knox on Thu 05/08/2010 20:50:17
Hi,

Ive never used the drawing functions yet, other then simple stuff when its on a room background.

Ive got a script setup so that when the mouse is over a certain part of the customDialogGui, I want to draw a sprite over it so thats its on top of everything else. This sprite stays on top of everything else until the mouse leaves that area, in which case I would just delete it.

The problem is I dont know how to draw onto this custom gui...I got this working (as a debugging to see if my script logic is ok)...it just doesnt draw on top of the custom gui, it does it on the room's background, behind the customDialogGUI (obviously cause Im not doing the right thing!)


       DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
       surface.DrawImage(0, 100, 1568, 0);
       surface.Release();


I checked the manual on drawing and I have to admit I dont understand it :P...


**EDIT**

OK I found this thread Ill see if it helps:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=41116.0
Title: Re: Drawing on the CustomDialogGui...?
Post by: monkey0506 on Thu 05/08/2010 22:24:17
You said you've checked the manual, but have you tried using the code there directly as a basic starting point? If not, there are code samples here (http://www.adventuregamestudio.co.uk/manual/CustomDialogOptions.htm) (in the manual) that should get you started.

The problem is that you don't need to create a new DrawingSurface yourself, but just use the one that is already given to you by the DialogOptionsRenderingInfo object:

info.Surface.DrawImage(0, 100, 1568, 0);
Title: Re: Drawing on the CustomDialogGui...?
Post by: Knox on Fri 06/08/2010 15:15:58
Hey monkey!

You back? Ok, well, the thing is I dont want the sprite to show up when an option is selected, I want it to show up when no options are selected at all...so I dont think I can use "info."

Ill re-read it though to see if I can figure it out :P


**EDIT**

Ok, well I get an error "Null pointer referenced" for this (in customDialogGui):



function mouseInsideBounds2(int iMinX, int iMaxX, int iMinY, int iMaxY)
{
  return ((mouse.x >= iMinX && mouse.x <= iMaxX) && (mouse.y >= iMinY && mouse.y <= iMaxY));
}

function repeatedly_execute_always()
{
  if (CDG.scroll_btn_timer > 0) CDG.scroll_btn_timer--;
  if (CDG.scroll_btn_timer == 0 && CDG.scroll_btn_push == true) CDG.scroll_btn_push= false;
  if (CDG.gui_type == eTextCatMode) process_button_push();
 
  if (bTacticalDialogInProcess == true)
  {
    if (mouseInsideBounds2(295, 325, 595, 665) || mouseInsideBounds2(395, 425, 595, 665) || mouseInsideBounds2(495, 525, 595, 665) ||
    mouseInsideBounds2(595, 625, 595, 665) || mouseInsideBounds2(695, 725, 595, 665))
    {
      DialogOptionsRenderingInfo *info;
      if (info.ActiveOptionID == 0) info.Surface.DrawImage(0, 100, 1568, 0);
    }
  }   
   
}


So I want it to check if the mouse is inside any of those bounderies...if so (it means no options are selected), draw sprite 1568 over the surface (this is a sprite  that hides a fake-sprite "label" to simulate nothing in the label).
Title: Re: Drawing on the CustomDialogGui...?
Post by: monkey0506 on Fri 06/08/2010 21:40:59
I didn't realize you meant the CDG module. I guess that should have been somewhat obvious..seeing as I already knew that you're using it..it's been a while. :P

For help with the module specifically, you might try posting in its thread or contacting abstauber.
Title: Re: Drawing on the CustomDialogGui...?
Post by: Knox on Sat 07/08/2010 05:01:43
Poor guy, I think Ive asked him like a gazillion questions already...hehe   ;D

Title: Re: Drawing on the CustomDialogGui...?
Post by: Knox on Tue 10/08/2010 13:30:44
Ok, well Ill just put this on hold then until I can get a hold of Abstauber, unless of course, anyone has any ideas!