please dont rip this site

Learning to Program with the Cybiko Handheld Computer Using B2C

Chapter 15 : Printxy

Printxy is like a combination of the Point function and the Print function.  Printxy allows you to position text anywhere on the Cybiko screen.  The format of the Printxy command is:

printxy x,y, value [, value…]

The text string is composed of the values of the variables after the Y coordinate.  The text string is printed at the coordinates X, Y.  The values will be painted with the X/Y coordinate in the upper left corner of the text.  The values can be any collection of comma-separated variables or literals – just as in Print. 

Our Example Program will print your name on the display and bounce it off the edges of the screen.  Try using shorter names to see how the performance improves.

 

DO THIS

Copy the file "c:\…\B2Cv5\tutorial\ch14.b2c" to "C:\…\B2Cv5\ch14.b2c".  Then execute the command "build ch14.b2c".  Download the ch14.app file to the cybiko.
dim name[32] as char'your name
dim x as int        'x coordinate of your name
dim y as int        'y coordinate of your name
dim dx as int      'direction the name moves in x coord
dim dy as int      'direction the name moves in y coord
input "Enter your name ", name
x = 80-rnd(160)  'random x starting point
y = 43-rnd(86)     'random y starting point
dx = -1  ' moving to the left
dy = -1  'moving up
while 1  'do forever or until ESC is pressed
    cls                          'clear the screen
    printxy x,y, name   'print the name onscreen
    x=x+dx   'move x dir
    y=y+dy   'move y dir
    if x>80 then
      dx=-dx    ' bounce off right side
    end if
    if x<-80 then
      dx=-dx   ' bounce off left side
    end if
    if y>30 then
      dy=-dy   'bounce off bottom
    end if
    if y<-43 then
      dy=-dy  'bounce off top
    end if
wend


file: /Techref/cybiko/b2c/ch15.htm, 3KB, , updated: 2008/6/13 15:59, local time: 2024/12/28 09:05,
TOP NEW HELP FIND: 
3.137.219.221:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/TECHREF/cybiko/b2c/ch15.htm"> cybiko b2c ch15</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .