Computer Science Canada

is there a way to find out if "offscreenonly" is enabled?

Author:  evildaddy911 [ 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>

Author:  Dreadnought [ 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.

Author:  Tony [ 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.

Author:  Zren [ 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(...).

Author:  copthesaint [ 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

Author:  Velocity [ 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.

Author:  Tony [ 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

Author:  evildaddy911 [ 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

Author:  Tony [ 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.

Author:  Dan [ 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.

Author:  Velocity [ 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

Author:  Dan [ 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).

Author:  Velocity [ 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.

Author:  Dan [ 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?

Author:  Velocity [ 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

Author:  Dan [ Fri Mar 02, 2012 12:36 am ]
Post subject:  Re: RE:is there a way to find out if "offscreenonly" is enabled?

Velocity @ 2nd March 2012, 12:07 am wrote:
yes, it said 00


What version of turing?

Author:  Velocity [ Fri Mar 02, 2012 9:58 am ]
Post subject:  RE:is there a way to find out if "offscreenonly" is enabled?

4.1

Author:  Insectoid [ Fri Mar 02, 2012 10:41 am ]
Post subject:  Re: RE:is there a way to find out if "offscreenonly" is enabled?

Velocity @ Thu Mar 01, 2012 12:15 am wrote:
pic.new reads from buffer, whatdotcolor reads from screen


whatdotcolor reading from the buffer is a big part of whatdotcolor collision detection.

Author:  Dan [ Fri Mar 02, 2012 1:17 pm ]
Post subject:  Re: RE:is there a way to find out if "offscreenonly" is enabled?

Velocity @ 2nd March 2012, 9:58 am wrote:
4.1


I just tested it in 4.1 and got "01". Normaly I would just assume you are mistaken or their is somthing odd going on with your copy of turing. However, you seem to have a history of making b.s. posts you can't back up (e.g. the lanschool thread). Please stop spreading disinformation or your account will be banned (you are only 1 warnning from a ban as it is).

Author:  Aange10 [ Sat Mar 03, 2012 10:33 am ]
Post subject:  RE:is there a way to find out if "offscreenonly" is enabled?

I also get "01", copying and pasting your code.

Author:  evildaddy911 [ Fri Mar 16, 2012 1:22 pm ]
Post subject:  Re: is there a way to find out if "offscreenonly" is enabled?

alright, i tried the hidden window thing sdreadnought (?) mentioned, is there anything you guys can find wrong with it?
PS
the
Turing:
drawfillbox (0, 0, maxx, maxy, 0)

line in the example is just to show that the reset color procedure works


: