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

Username:   Password: 
 RegisterRegister   
 is there a way to find out if "offscreenonly" is enabled?
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
evildaddy911




PostPosted: Wed Feb 29, 2012 8:50 am   Post subject: is there a way to find out if "offscreenonly" is enabled?

What is it you are trying to achieve?
a color fading module


What is the problem you are having?
my computer cant draw it fast enough, so it looks really crappy in a loop
Is there a function that tells you if offscreenonly is on?

Describe what you have tried to solve this problem
the documentation keeps saying "Navigation to webpage was cancelled"


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


var see_below : string := "look at the attachment"



Please specify what version of Turing you are using
<Answer Here>



fade.tu
 Description:
colour fading module

Download
 Filename:  fade.tu
 Filesize:  1.77 KB
 Downloaded:  60 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Wed Feb 29, 2012 12:49 pm   Post subject: Re: is there a way to find out if "offscreenonly" is enabled?

Well, there is no way of determining if an output window is in offscreenonly mode.

But, you could create a separate window ad keep it hidden. Then you just have to draw your gradient to the hidden window, then copy the contents of that window to the window the user sees.

See windowmodule for window commands.
Tony




PostPosted: Wed Feb 29, 2012 3:56 pm   Post subject: RE:is there a way to find out if "offscreenonly" is enabled?

Sure. You can try to draw something to the screen, and see if it appears.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Zren




PostPosted: Wed Feb 29, 2012 4:10 pm   Post subject: RE:is there a way to find out if "offscreenonly" is enabled?

Since only your code will determine if the buffer is offscreen or not, why not just manage a boolean yourself? Tip: Make a procedure to set the variable and call View.Set(...).
copthesaint




PostPosted: Wed Feb 29, 2012 4:17 pm   Post subject: RE:is there a way to find out if "offscreenonly" is enabled?

Its very easy to know if a screen is offscreenonly. If you havnt set offscreenonly then it is Initialized as nooffscreenonly
Velocity




PostPosted: Wed Feb 29, 2012 6:57 pm   Post subject: RE:is there a way to find out if "offscreenonly" is enabled?

you type View.set ("offscreenonly") if you typed it... its there no doubt. assuming you placed it at the very top of your function that you want it to be used for.
Tony




PostPosted: Wed Feb 29, 2012 7:17 pm   Post subject: Re: RE:is there a way to find out if "offscreenonly" is enabled?

Zren @ Wed Feb 29, 2012 4:10 pm wrote:
Since only your code will determine if the buffer is offscreen or not...

Not if other people are using your library/package/whatever
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
evildaddy911




PostPosted: Wed Feb 29, 2012 10:36 pm   Post subject: Re: RE:is there a way to find out if "offscreenonly" is enabled?

Tony @ Wed Feb 29, 2012 3:56 pm wrote:
Sure. You can try to draw something to the screen, and see if it appears.

Like
Turing:
drawdot(-15,-15,black)
If whatdotcolor(-15,-15)= black then
Offscreen:=true
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Feb 29, 2012 11:20 pm   Post subject: RE:is there a way to find out if "offscreenonly" is enabled?

- if the dot gets drawn, it means offscreen is false.
- the screen could have already been black from before, so you'd need to draw twice, and look for that transition
-- which also means that if there's a forked thread, this is not deterministic (which is why forks and offscreenonly don't go together)

Of course you'd have to confirm that whatdotcolor actually reads from screen and not from the buffer into which offscreen draws.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Dan




PostPosted: Wed Feb 29, 2012 11:46 pm   Post subject: Re: RE:is there a way to find out if "offscreenonly" is enabled?

evildaddy911 @ 29th February 2012, 10:36 pm wrote:
Tony @ Wed Feb 29, 2012 3:56 pm wrote:
Sure. You can try to draw something to the screen, and see if it appears.

Like
Turing:
drawdot(-15,-15,black)
If whatdotcolor(-15,-15)= black then
Offscreen:=true


Tony wrote:

- if the dot gets drawn, it means offscreen is false.
- the screen could have already been black from before, so you'd need to draw twice, and look for that transition
-- which also means that if there's a forked thread, this is not deterministic (which is why forks and offscreenonly don't go together)

Of course you'd have to confirm that whatdotcolor actually reads from screen and not from the buffer into which offscreen draws.


If i rember correctly whatdotcolor and pic.new read from the buffer and not the screen.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Velocity




PostPosted: Thu Mar 01, 2012 12:15 am   Post subject: RE:is there a way to find out if "offscreenonly" is enabled?

pic.new reads from buffer, whatdotcolor reads from screen
Dan




PostPosted: Thu Mar 01, 2012 2:06 am   Post subject: Re: RE:is there a way to find out if "offscreenonly" is enabled?

Velocity @ 1st March 2012, 12:15 am wrote:
pic.new reads from buffer, whatdotcolor reads from screen


This does not seem to be true:

Turing:

View.Set("graphics")
View.Set("offscreenonly")

var y: int := View.WhatDotColor(1,1)

Draw.Dot(1,1,y+1);
var x: int := View.WhatDotColor(1,1)

put y, x;


outputs:

code:

01


If WhatDotColor read the screen it should be 00.

Notice that you will get the same output with "nooffscreenonly", making this method unhelpfull for detecting if "offscreenonly" is on (i.e. evildaddy911's code will allways return true).
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Velocity




PostPosted: Thu Mar 01, 2012 3:27 pm   Post subject: RE:is there a way to find out if "offscreenonly" is enabled?

hmm, thats odd. When i tested it, it begged to differ. Oh well, i guess there was something wrong with the way i wrote it. So ofcourse ill take your word over my compilers. Thanks for the clear up, dan.
Dan




PostPosted: Thu Mar 01, 2012 6:52 pm   Post subject: Re: RE:is there a way to find out if "offscreenonly" is enabled?

Velocity @ 1st March 2012, 3:27 pm wrote:
hmm, thats odd. When i tested it, it begged to differ. Oh well, i guess there was something wrong with the way i wrote it. So ofcourse ill take your word over my compilers. Thanks for the clear up, dan.


What was your code? And what does your complier output for the same code i posted?
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Velocity




PostPosted: Fri Mar 02, 2012 12:07 am   Post subject: RE:is there a way to find out if "offscreenonly" is enabled?

yes, it said 00
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 2  [ 21 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: