Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Coordinates
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Jay316




PostPosted: Wed Jun 22, 2005 6:36 pm   Post subject: Coordinates

how do i specifically know what part of the screen is which. how do i make a square in the middle or in the top left of the screen in turing? if someone can please help me..thanks!
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Wed Jun 22, 2005 6:45 pm   Post subject: (No subject)

Alright, here's the simple way to know generally.

I hope you know from math that x is _ horizontal and y is | vertical. 0x0y is at the bottom left hand corner of the screen. Maximumx and maximumy is top right corner of the screen. We see this when using: maxx and maxy. Try it,
code:
put maxx
put maxy


So to find the center of the screen we would divide maxx / 2 and maxy / 2.

Use this program to figure out the coordinates on the screen using the mouse:
code:
var x, y, button : int %vars for the mouse where code
loop %needs to be in a loop to keep on reading mouse data
    Mouse.Where (x, y, button)    %code to find data on mouse
    put " ", x, " ", y     %put mouse location
    %check to see if button is hit
    if button = 1 then
        locatexy (maxx div 2, maxy div 2)
        put "you clicked the button"
        delay (1000)
        cls
    end if
    cls
end loop
Jay316




PostPosted: Wed Jun 22, 2005 6:54 pm   Post subject: (No subject)

thanks so very much! im gonan try and load this program just before my test Razz
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: