RE: [cc65] Scalable UI without float?

From: Payton Byrd <plbyrd1gmail.com>
Date: 2010-04-21 06:01:55
I told you I was tired. :)  Multiply first is the answer I was looking for.

-----Original Message-----
From: Kevin Schuetz <scrapdog@runbox.com>
Sent: Tuesday, April 20, 2010 10:55 PM
To: cc65@musoftware.de
Subject: Re: [cc65] Scalable UI without float?

I would recommend using some sort of fixed-point arithmetic.

However, if you do want to continue defining positions in terms of 
percentages, the simplest answer to your problem would be to multiply 
first, then divide.

gotoxy(Item1X*screensize/100,0); cputs(Item1);
gotoxy(Item2X*screensize/100,0); cputs(Item2);
gotoxy(Item3X*screensize/100,0); cputs(Item3);
gotoxy(Item4X*screensize/100,0); cputs(Item4);
gotoxy(Item5X*screensize/100,0); cputs(Item5);





On 4/20/2010 10:37 PM, Payton Byrd wrote:
> Maybe I'm just tired, but I cannot come up with a good solution for this.
>
> What I'm trying to do is locate text on the screen using conio at 
> relative positions based on the screen width.  For example, I want to 
> define five positions for five menu items:
>
> Item 1: 0%
> Item 2: 20%
> Item 3: 40%


[The entire original message is not included]
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Apr 21 06:02:07 2010

This archive was generated by hypermail 2.1.8 : 2010-04-21 06:02:10 CEST