Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #6219 > unrolled thread

Instability in rectangular cursor

Started byRichard Ashbery <basura@invalid.addr.uk>
First post2020-11-13 13:17 +0000
Last post2020-11-13 20:33 +0000
Articles 5 — 3 participants

Back to article view | Back to comp.sys.acorn.programmer


Contents

  Instability in rectangular cursor Richard Ashbery <basura@invalid.addr.uk> - 2020-11-13 13:17 +0000
    Re: Instability in rectangular cursor Steve Drain <steve@kappa.me.uk> - 2020-11-13 14:10 +0000
      Re: Instability in rectangular cursor Richard Ashbery <basura@invalid.addr.uk> - 2020-11-13 17:12 +0000
        Re: Instability in rectangular cursor Steve Fryatt <news@stevefryatt.org.uk> - 2020-11-13 19:24 +0000
          Re: Instability in rectangular cursor Steve Drain <steve@kappa.me.uk> - 2020-11-13 20:33 +0000

#6219 — Instability in rectangular cursor

FromRichard Ashbery <basura@invalid.addr.uk>
Date2020-11-13 13:17 +0000
SubjectInstability in rectangular cursor
Message-ID<58cec65a21basura@invalid.addr.uk>
Are there any BASIC programmers out there who may have missed my
posting on ROOL > Forums > General about an issue with a routine that
simply animates a rectangular cursor across the screen by moving the
mouse? The mouse overlays another horizontal rectangle but in so doing
results in instability and spoils the rendering. Any solutions would
be welcome.

MODE 1920,1080,32
PX%=0
PY%=0
REPEAT
  GCOL 0,0,255
  RECTANGLE FILL 0,0,3838,100
  MOUSE MX%,MY%,MB%
  GCOL 255,0,0
  RECTANGLE FILL PX%-50,PY%,100
  IF MX%<PX% THEN : PX%=PX%-1 : ENDIF
  IF MX%>PX% THEN : PX%=PX%+1 : ENDIF
UNTIL0

[toc] | [next] | [standalone]


#6220

FromSteve Drain <steve@kappa.me.uk>
Date2020-11-13 14:10 +0000
Message-ID<rom466$13m9$1@gioia.aioe.org>
In reply to#6219
On 13/11/2020 13:17, Richard Ashbery wrote:

> The mouse overlays another horizontal rectangle but in so doing
> results in instability and spoils the rendering. Any solutions would
> be welcome.

I am not sure I get what you want, but you could try a WAIT before one 
or both the RECTANGLE statements.

[toc] | [prev] | [next] | [standalone]


#6221

FromRichard Ashbery <basura@invalid.addr.uk>
Date2020-11-13 17:12 +0000
Message-ID<58cedbd8b0basura@invalid.addr.uk>
In reply to#6220
In article <rom466$13m9$1@gioia.aioe.org>, Steve Drain
<steve@kappa.me.uk> wrote:
> On 13/11/2020 13:17, Richard Ashbery wrote:

> > The mouse overlays another horizontal rectangle but in so doing
> > results in instability and spoils the rendering. Any solutions
> > would be welcome.

> I am not sure I get what you want, but you could try a WAIT before
> one or both the RECTANGLE statements.

Thanks for responding.

You make a fair point and although WAIT does work in this example it
dramatically slows down the program that this code has been ripped from.
Please have a look at...

http://www.riscosbasic.uk/problems/Kill_verticals.zip

Unfortunately the program is not named but I believe it may have been
created by Krzysztof Jankowski and can be found on YouTube. The
original program was done in MODE 28 but I wanted to see if I could
convert it for 1080p monitors. Original mouse cursor has instability
issues but these are magnified in 1920 x 1080 modes.

Scoring logic appears slightly odd - it takes a very short time to build
up a huge score - this may require tweaking.

Regards

Richard

[toc] | [prev] | [next] | [standalone]


#6222

FromSteve Fryatt <news@stevefryatt.org.uk>
Date2020-11-13 19:24 +0000
Message-ID<mpro.qjr1w402vsza401n3.news@stevefryatt.org.uk>
In reply to#6221
On 13 Nov, Richard Ashbery wrote in message
    <58cedbd8b0basura@invalid.addr.uk>:

> You make a fair point and although WAIT does work in this example it
> dramatically slows down the program that this code has been ripped from.

It will do, because it seems to rely on replotting the screen many times a
frame, which is what causes the tearing effect.

WAIT simply pauses the program until the start of the next video frame, when
there's a small window of time in which to update the screen while the video
flyback is happening. If the code is expecting to execute the REPEAT loop
many more per second than the monitor refresh rate, then the game will slow
down as a result.

Unfortunately, you can't change the video refresh rate because that's set by
your monitor, so to fix the tearing you will need to decouple the game
timing from the screen update.

-- 
Steve Fryatt - Leeds, England

http://www.stevefryatt.org.uk/

[toc] | [prev] | [next] | [standalone]


#6223

FromSteve Drain <steve@kappa.me.uk>
Date2020-11-13 20:33 +0000
Message-ID<romqhn$9ot$1@gioia.aioe.org>
In reply to#6222
There is also the possibility of swapping screen banks, updating
 the hidden bank before displaying it. 

It is a very, very long time since I did this, but I think I
 recollect a ROOL Forum topic about doing it on modern machines
 using 3 banks.

-- 


----Android NewsGroup Reader----
https://piaohong.s3-us-west-2.amazonaws.com/usenet/index.html

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.acorn.programmer


csiph-web