Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mehrdad on Sat 11/04/2009 16:10:16

Title: 2 question:scrolling gui & adjust dialogs
Post by: Mehrdad on Sat 11/04/2009 16:10:16
hi
1:Does exist any easy way to add vertical scrolling for a GUI? The idea is an initially hidden GUI which appears with a smooth scroll when the mouse cursor is in upper or lower position WITHOUT CLICKS .like Beneath a steel sky game.

2:I want adjust all dialogs on the under screen( like subtitle).not over head characters.
how do i get it?



Title: Re: 2 question:scrolling gui & adjust dialogs
Post by: Khris on Sat 11/04/2009 18:33:24
Here's a snippet from the rep_ex of one of my discontinued games:
I used it to move in triangle shaped GUIs in the two upper corners but I'll try to rewrite it to a 24px high GUI at the top edge:

// this line above rep_ex:
int menu_gui_moving;

// the following inside rep_ex
  int x = mouse.x;
  int y = mouse.y;
  GUI*g = GUI.GetAtScreenXY(x, y);
   
  // menu GUI movement
  int guiy = gMenu.Y;
  if (y<25 && menu_gui_moving<1) {
    menu_gui_moving = 1;
  }
  else if ((g==null || y>=24) && menu_gui_moving>-1) {
    menu_gui_moving = -1;
  }
  guiy += menu_gui_moving*2;
  if (guix<-24) {
    guix = -24;
    menu_gui_moving = 0;
  }
  else if (guix>0) {
    guix = 0;
    menu_gui_moving = 0;
  }
  gMenu.SetPosition(gMenu.X, guix);


The second question has been answered a couple of times already, you should find a solution using the forum search.
Title: Re: 2 question:scrolling gui & adjust dialogs
Post by: Mehrdad on Sun 12/04/2009 15:28:47
Thanks KhrisMUC.are this scrolling smooth?
Title: Re: 2 question:scrolling gui & adjust dialogs
Post by: Khris on Mon 13/04/2009 15:27:18
It's going to scroll at two pixels per game loop; it looks pretty smooth, yes.
Title: Re: 2 question:scrolling gui & adjust dialogs
Post by: Mehrdad on Mon 13/04/2009 15:33:36
Thanks a lot