BBC BASIC
« Re: "mygraphics" Library (required for button too »

Welcome Guest. Please Login or Register.
Mar 31st, 2018, 11:09pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Cross-platform BBC BASIC (Windows, Linux x86, Mac OS-X, Android, iOS, Raspberry Pi)
BBC BASIC Resources
BBC BASIC Help Documentation
BBC BASIC for Windows Home Page
BBC BASIC Programmers' Reference
BBC BASIC Beginners' Tutorial
BBC BASIC for SDL 2.0 Home Page
BBC BASIC Discussion Group

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Re: "mygraphics" Library (required for button too  (Read 556 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 803
xx Re: "mygraphics" Library (required for button too
« Thread started on: Nov 7th, 2016, 11:59am »

on Nov 6th, 2016, 8:35pm, michael wrote:
This program will be needed later for the 2 major projects I am working on.

Something not right here:

Code:
      DEFPROCrect(x%,y%,w%,h%)      LOCAL sx%,sy%      sx%=x%:sy%=y%      IF x%>w% THEN x%=w%:w%=sx%      IF y%>h% THEN y%=h%:h%=sy%      ry%=y%      y%=ry% 

Those last two lines are definitely strange!

Also, the variables sx% and sy% appear to be unnecessary. Let's examine this code in isolation:

Code:
      sx%=x%      IF x%>w% THEN x%=w%:w%=sx% 

First note that sx% is used only in this code snippet. That means we can move it into the conditional clause without affecting the functionality:

Code:
      IF x%>w% THEN sx%=x%:x%=w%:w%=sx% 

But having made that change, we can see that the code is identical in its operation (but slower than) this:

Code:
      IF x%>w% THEN SWAP x%,w% 

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls