Welcome, Guest. Please login or register.

Author Topic: window size  (Read 2974 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline yakumo9275Topic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2008
  • Posts: 301
    • Show only replies by yakumo9275
    • http://mega-tokyo.com/blog
window size
« on: February 01, 2012, 01:57:13 PM »
So, I have done some more work on my amiga text adventure engine. I have my window, set and loaded my font, applied it. One thing I notice was that the size of the window seems to be the entire window, not just my drawing area, so I get the widgets/gadgets for titlebar and I guess side scrollbar / resize that has the button in the bottom right.

So when I do window->Width / rport->TxWidth, the number of columns ends up being greater than the visible area, so text goes off screen, same for height.

Is there a way to get the window size less the attached gadgets/widgets?

Right now I have topaz.font at 9 and I subtract 2 rows and 3 or 4 columns and its ok but its a hack and wont be ok if I change to topaz 8 or some other font...
--/\\-[ Stu ]-/\\--
Commodore 128DCR, JiffyDOS, Ultimate 1541 II, uIEC/SD, CBM 1902A  Monitor
 

Offline Gilloo

  • Full Member
  • ***
  • Join Date: Apr 2006
  • Posts: 124
    • Show only replies by Gilloo
Re: window size
« Reply #1 on: February 01, 2012, 02:07:11 PM »
Hi,
For a non borderless window (aka normal window :) ), the usable width is w->Width - w->BorderLeft - w->BorderRight, and the height, w->Height - w->BorderTop - w->BorderBottom.

For a GimmeZeroZero window, use w->GZZWidth and w->GZZHeight instead w->Width and w->Height.
« Last Edit: February 01, 2012, 02:11:07 PM by Gilloo »
 

Offline yakumo9275Topic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2008
  • Posts: 301
    • Show only replies by yakumo9275
    • http://mega-tokyo.com/blog
Re: window size
« Reply #2 on: February 01, 2012, 02:13:00 PM »
Quote from: Gilloo;678581
Hi,
For a non borderless window (aka normal window :) ), the usable width is w->Width - w->BorderLeft - w->BorderRight, and the height, w->Height - w->BorderTop - w->BorderBottom.

For a GimmeZeroZero window, use w->GZZWidth and w->GZZHeight instead w->Width and w->Height.



aah cool. My NewWindow() is a GZZ window, so I will fix that tonight. The programming books I have for amiga didnt mention GZZWidth / GZZHeight :/ thanks for the heads up!
--/\\-[ Stu ]-/\\--
Commodore 128DCR, JiffyDOS, Ultimate 1541 II, uIEC/SD, CBM 1902A  Monitor
 

Offline Thomas

Re: window size
« Reply #3 on: February 01, 2012, 04:39:40 PM »
Quote from: Gilloo;678581
For a GimmeZeroZero window, use w->GZZWidth and w->GZZHeight instead w->Width and w->Height.


GZZWidth and GZZHeight are maintained for non-GZZ windows, too. You don't need to calculate them yourself.

Offline yakumo9275Topic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2008
  • Posts: 301
    • Show only replies by yakumo9275
    • http://mega-tokyo.com/blog
Re: window size
« Reply #4 on: February 02, 2012, 03:08:39 AM »
sweet. GZZWidth etc worked perfectly. Now I just need to figure IDCMP msg handling in there somewhere (so I can grab quit/resize) and some keyboard input and it'll be better than I expected! :)
--/\\-[ Stu ]-/\\--
Commodore 128DCR, JiffyDOS, Ultimate 1541 II, uIEC/SD, CBM 1902A  Monitor
 

Offline Thomas

Re: window size
« Reply #5 on: February 02, 2012, 07:36:27 AM »

Offline yakumo9275Topic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2008
  • Posts: 301
    • Show only replies by yakumo9275
    • http://mega-tokyo.com/blog
Re: window size
« Reply #6 on: February 02, 2012, 11:21:08 AM »
Thanks Thomas, my biggest problem will be trying to integrate my message handling into the flow of my application. Going from a whole procedural to event driven.. complicates all my forms of input if I need to also handle all the window+system events at the same time.
--/\\-[ Stu ]-/\\--
Commodore 128DCR, JiffyDOS, Ultimate 1541 II, uIEC/SD, CBM 1902A  Monitor
 

Offline Thomas

Re: window size
« Reply #7 on: February 02, 2012, 04:02:20 PM »
When you say message handling you probably don't speak about AmigaOS messages, do you?

If you have multiple Amiga message ports it's quite easy to handle them all at the same time. You have one place in your program where you Wait() for all signals of all ports and then handle each port depending on which signal you received. (Example attached).

Offline yakumo9275Topic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2008
  • Posts: 301
    • Show only replies by yakumo9275
    • http://mega-tokyo.com/blog
Re: window size
« Reply #8 on: February 02, 2012, 04:16:16 PM »
well, I mean the IDCMP messages. At various points my program can wait for input, and at any time its waiting for input you can receive resize/close/refresh messages etc if you subscribed to them correct?

I guess my problem is, if I print 20 lines of text, and want to print more, I ask the user to hit a key when its all read so it does not scroll off the screen, so while waiting to hit a key, the last thing I need is to be told I need to resize, because I will need to reflow all the text just gone, and what is to come. doing resizes/redraws at the top level is fine, but if I am in the middle of dealing with something that is interspersed with a single user input makes it more difficult.
--/\\-[ Stu ]-/\\--
Commodore 128DCR, JiffyDOS, Ultimate 1541 II, uIEC/SD, CBM 1902A  Monitor
 

Offline Thomas

Re: window size
« Reply #9 on: February 02, 2012, 04:34:08 PM »
Quote
while waiting to hit a key, the last thing I need is to be told I need to resize


But what are you going to do if you tell the user to hit a key and he instead resizes the window?

I would just wait for input and then react on the input, i.e. continue printing text if the user hit a key and reflow the text if he resized the window.

If you are busy you shouldn't Wait() of course. You could do something like this: (see attachment)

Offline yakumo9275Topic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2008
  • Posts: 301
    • Show only replies by yakumo9275
    • http://mega-tokyo.com/blog
Re: window size
« Reply #10 on: February 06, 2012, 05:29:00 PM »
I re-orchestrated things around my event handler and have things working, got menus in too. Going to add a requestor in if no file is specified and I should be good :) Only have 1 bug in savefile load/restore to figure out but everything else seems ok.

I checked out how infocom games behave and its very much the same for them as my interpreter, mine behaves a bit nicer but I dont consider it good behaviour :P
--/\\-[ Stu ]-/\\--
Commodore 128DCR, JiffyDOS, Ultimate 1541 II, uIEC/SD, CBM 1902A  Monitor