Drawing on the CustomDialogGui...?

Started by Knox, Thu 05/08/2010 20:50:17

Previous topic - Next topic

Knox

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!)

Code: ags

        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
--All that is necessary for evil to triumph is for good men to do nothing.

monkey0506

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 (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:

Code: ags
info.Surface.DrawImage(0, 100, 1568, 0);

Knox

#2
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):

Code: ags


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).
--All that is necessary for evil to triumph is for good men to do nothing.

monkey0506

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.

Knox

Poor guy, I think Ive asked him like a gazillion questions already...hehe   ;D

--All that is necessary for evil to triumph is for good men to do nothing.

Knox

Ok, well Ill just put this on hold then until I can get a hold of Abstauber, unless of course, anyone has any ideas!
--All that is necessary for evil to triumph is for good men to do nothing.

SMF spam blocked by CleanTalk