Reverse Viewport

Let Sim Innovations know about your Air Manager experience and let us know about your dream feature addition

Moderators: Ralph, russ

Message
Author
The Artful Dodger
Posts: 91
Joined: Sat Jul 09, 2022 3:20 pm

Re: Reverse Viewport

#11 Post by The Artful Dodger »

Hi, folks:

I don't have a Google drive! I have my own cloud and don't use external ones. As far as youtube, I have no idea how!!

It's very frustrating because I am converting it with a recognized converter buy Sim Innovations website doesn't like it!

Sorry.

Sparky

User avatar
Ralph
Posts: 6656
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Reverse Viewport

#12 Post by Ralph »

We don't allow video uploads. We have to pay for disk space. By allowing videos this will go up very rapidly.

User avatar
Keith Baxter
Posts: 3778
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Reverse Viewport

#13 Post by Keith Baxter »

Sparky,

This code is for a basic speed wheel. By reducing the size of the canvas you create a "VIEWPORT" for your text.

Code: Select all

--Add your text styles
robR_70vlgR      ="font:roboto_regular.ttf; size:70px; color: white; halign:right; valign:center;"
robR_70vlgL      ="font:roboto_regular.ttf; size:70px; color: white; halign:left; valign:center;"

--Add you canvases
background       =canvas_add(0,0,630,630)
airspeed_wheel   =canvas_add(0,282,117,78)

---Draw the background
canvas_draw(background, function()
    _rect(0,0,106,630)
    _fill("#686868")
end)

--Subscribe to the airspeed dataref
xpl_dataref_subscribe("sim/cockpit2/gauges/indicators/airspeed_kts_pilot", "FLOAT", function(airspeed)
---Airspeed wheel logic
        if airspeed <30 then airspeed =0 end
        new_val1=string.sub(string.format("% 3.5f",airspeed/10),-5)
        new_val2=string.sub(string.format("% 3.5f",airspeed/10),-4)
        new_valc=string.sub(new_val1,0,1)
        new_vala=string.sub(new_val2,0,2)
        if new_valc+1 == 10 then new_vald = 0 else new_vald = new_valc+1 end
--Draw and rotate the wheel
    canvas_draw(airspeed_wheel, function()
        _txt(string.format("% 3.0f",var_cap(airspeed,30,700)),robR_70vlgR,110,40)
        _rect(82,1,33,78)
        _fill("red")
        _txt(string.format("% 0.0f",new_vald),robR_70vlgL,70,-10+(new_vala/2))
        _txt(string.format("% 0.0f",new_valc),robR_70vlgL,70,40+(new_vala/2))
        _txt(string.format("% 0.0f",new_valc-1),robR_70vlgL,70,90+(new_vala/2))
    end)
end)
Keith.
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
jph
Posts: 2099
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Reverse Viewport

#14 Post by jph »

The Artful Dodger wrote: Thu Aug 11, 2022 2:57 pm Hi, folks:

I don't have a Google drive! I have my own cloud and don't use external ones. As far as youtube, I have no idea how!!

It's very frustrating because I am converting it with a recognized converter buy Sim Innovations website doesn't like it!

Sorry.

Sparky
slightly ot Sparky ... :D :D ;)
But if you have your own 'cloud' you could link to an uploaded video. the 'cloud' is a distributed on line storage area, not off line. If it's off line it's not a 'cloud' - it's most likely NAS. All people should have NAS.
If you use google chrome, then you have google drive. Doesn't everybody use chrome ? :lol:
Windows comes with a really handy tool called 'edge' to enable users to easily download Chrome (even though 'edge' is mostly Chrome it still has more spyware than Putin's bathroom)
If you use chrome and are signed in then just go to drive.google.com
“Everything in moderation, including moderation.”
“Experience is merely the name men gave to their mistakes.”
Joe (CISSP) -IT security consultant

The Artful Dodger
Posts: 91
Joined: Sat Jul 09, 2022 3:20 pm

Re: Reverse Viewport

#15 Post by The Artful Dodger »

Hi, Ralph:

You need to remove the mp4 file extension from the file types your system accepts!

Sparky

The Artful Dodger
Posts: 91
Joined: Sat Jul 09, 2022 3:20 pm

Re: Reverse Viewport

#16 Post by The Artful Dodger »

Speed Tape - 2022-08-11.zip
(507.67 KiB) Downloaded 13 times
Keith:

I have used a great deal of your code to produce mine - that's not my problem. Ralph didn't know how to solve the problem either - that's why he asked me to send a short video. Sadly, despite the fact that the system states it accepts .mp4 files, I guess it really doesn't. So, I zipped it - I don't know if anyone can actually open the zip file?

Sparky

User avatar
Keith Baxter
Posts: 3778
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Reverse Viewport

#17 Post by Keith Baxter »

Sparky,

Ok I see what you are trying to do. Pop that code snippet into the code box and I will fix it for you.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

The Artful Dodger
Posts: 91
Joined: Sat Jul 09, 2022 3:20 pm

Re: Reverse Viewport

#18 Post by The Artful Dodger »

Hi, Keith:

That code snippet is over 600 lines of code - I write it to work and then I polish it! That is the step I am in now!

However. I think I can whip up the details - it'll take me a while!

Thanks,

Sparky

User avatar
Keith Baxter
Posts: 3778
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Reverse Viewport

#19 Post by Keith Baxter »

The Artful Dodger wrote: Thu Aug 11, 2022 5:17 pm Hi, Keith:

That code snippet is over 600 lines of code - I write it to work and then I polish it! That is the step I am in now!

However. I think I can whip up the details - it'll take me a while!

Thanks,

Sparky
Sparky,

Do you know how to export a instrument?
If so just export it and send it to me via PM.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

The Artful Dodger
Posts: 91
Joined: Sat Jul 09, 2022 3:20 pm

Re: Reverse Viewport

#20 Post by The Artful Dodger »

Keith:

Here is a simplified version of my problem. As the text goes down, I need for it not to show up in the blue box (rather, gradually disappear) but to continue moving down, and then gradually show up as it comes from beneath the blue box. All the while the blue box must remain transparent.
The version I gave you a video of had the numbers simply popping out and then popping back in once clear of the box. But I don't like that! For me, the hard part is keeping the blue box transparent so that i can put a number in it!
I wish you success and I thank you profusely!

Sparky
________________________________________________________________________________________________________________________

Code: Select all

Panel = canvas_add(0, 0, 200, 100)
Block = canvas_add(40, 40, 100, 50)
--
Robo_50_H_HAR_VAC  = "font:roboto_regular.ttf; size:50px; color: #80FF80; halign:right; valign:center;"
--
LineNumber = 180
--
MyPanel = canvas_draw(Panel, function()
--
	_rect(3, 3, 195, 95)
	_stroke("green", 5)
--
end)
--
MyBlock = canvas_draw(Block, function()
--
	_rect(3, 3, 95, 45)
	_stroke("blue", 5)
--
end)
--
function CreateMovingText(Index, Value)
--
	MyBlock = canvas_draw(Panel, function()

--
		_txt("Now is the time", Robo_50_H_HAR_VAC, 250, Index)
--
	end)
end
--
function Setup(LineNo)
print("LineNo", LineNo)
	CreateMovingText(LineNo, Value)
	LineNo = LineNo + 40
end
--
Count = 180
MyTimer = timer_start(250, 250, Setup)
print("Count = ", Count)

Post Reply