Jump to content
The simFlight Network Forums

Recommended Posts

Posted
-- Create window and define title, font, size and colours
w1 = wnd.open("TEST PANEL", 0,0,200,140)
wnd.font(w1, WND_ARIAL, 24.0, WND_BOLD) --Font, Size and Properties
wnd.backcol(w1, 0x000) -- background colour



while 1 do

	ipc.sleep(1000)

	wnd.textcol(w1, 0xF00)
	wnd.text(w1 , "RED")
	wnd.textcol(w1, 0x0F0)
	wnd.text(w1 , "GREEN")
	wnd.textcol(w1, 0x00F)
	wnd.text(w1 , "BLUE")
	wnd.textcol(w1, 0xFFF)
	wnd.text(w1 , "WHITE")

	ipc.sleep(1000)

	wnd.clear(w1)


end

Hi Pete, Hope you are well....

 

I just would like to ask a small question in regards to the WND Library.

I have inserted a little test script which draws 4 words of text in the display window which will all be different colours.

However the wnd.text command always seems to insert a CRLF and when called again after changing the colour will draw the NEW text on a NEW line.

 

What I would really like to do is mix the colours of text on the same line, Like this:

 

RED GREEN BLUE WHITE

 

instead of:

 

RED

GREEN

BLUE

WHITE

 

which is what the above code currently does.

Can you point me in the right direction to achieve this, I have gone over the WND library command reference but I cannot see a way to do it, but that would not be the first time I have missed something like this.

 

Thankyou for your help.

 

Regards Glenn. 

Posted

I'm pretty sure it's a line-based facility only at present. Without checking my code I'm not sure how much work it would be to make it stream based. The problem then is processing embedded controls. It gets much more complicated.

 

Pete

Posted

Ah OK Pete, What I was trying to do was to build an Annunciator Script that had Multi-Coloured Text labels in a Line.

 

If it was achievable or you can supply the facility, this would be beneficial for building small Annunciator panels.

I can think of many different pits where this could be done.

With the price of small USB screens these days it would definitely be beneficial to pit builders, and it is a way to get screen based annunciators without the need to Undock aircraft panels costing frame rates.

 

I have already built one for the VRS SuperBug that ties into the virtual Caution Panel, However this panel is all one colour so it works great, but this aircraft has two Brow panels that are multi-coloured and this facility would allow me to re-create those ones too over WideFS.

 

Anyhow I would appreciate it if you could take a look, but if it is too complex then I guess it may not be worth it.

 

Thankyou,

 

Glenn.

Posted

Anyhow I would appreciate it if you could take a look, but if it is too complex then I guess it may not be worth it.

 

I'm off on holiday after tomorrow and up to my eyes in stuff at present. I can take a look, but it will be in a couple of weeks. Remind me on or after 9th September.

 

Pete

Posted

No Problems Pete, Thankyou very much for considering this.......It's not urgent at all.

 

I will give you a nudge on the 9th for sure.

 

Have a great Holiday !!

 

Cheers Glenn.

  • 2 weeks later...
Posted

Just a reminder Pete, when you have time to take a look.

 

Sorry. I've had a good look at this, and I'm afraid it would be a complete re-write job which I'm not willing to undertake.

 

Perhaps you could give me some details of why you would like this. Maybe I can suggest an alternative.

 

Pete

Posted

OK Pete, That's OK I Understand. Thank you for taking a look at it anyhow.

 

 

Here is a Video Link demonstrating what I did with the WND Library.

 

http://www.youtube.com/watch?v=VMAiD3jqIb0

 

 

It is the quite a good solution for this particular Annunciator panel that I tied it into, that Annunciator is from the VRS F/A-18E and the Lamps are driven by Lvars in the aircraft itself.

I take the Lvar values and assign each one(lamp) to individual BITS in a 16BIT Word, each BIT corresponds to a lamp which I then feed to a Custom Offset at 0x66C0,

The WideClient WND Script monitors the 0x66C0 Offset and displays the appropriate lines of text based on the BIT Values in 0x66C0.

 

Unfortunately the Other two Annunciator panels that I wanted to render have different colored text on the same line and therefore causing me a problem.

Here is an image of the Annunciators, I am wanting to render the Left and Right Annunciators in this image, not necessarily the MASTER CAUTION and APU FIRE lamps but the other labels.

 

1a.png

 

 

Here are the arguments for this approach on this Annunciator......

 

 

Advantages: 

 

1)Little to no cost in Frame rates because the panel is rendered on another PC, 

 

2)Undocking just an Annunciator panel to put onto a small screen is not always available to to you, depending on the aircraft designer. 

 

3)Can handle a lot of Annunciators in one hit, saving on LED Boards, Wiring and Physical Annunciator building.

 

4)As you can see in the Video, the Annunciator can be rendered easily on multiple PC's making it available for mare than one pilot or instructor stations.

 

5)Easily rendered on small, cheap  USB Display Screens that are available these days.

 

6) Can be setup over IP networks, Even using Wireless such as in the Video

 

 

 

Disadvantages:

 

1)Will require a second PC, but it is easy and cheap to find unwanted laptops and PC's that could handle this task very easily.

 

2)Will require WideFS (But more Sales for you Pete !!)

 

3)Will require a Network setup for the communications to take place over WideFS.

 

4)Unable to handle multicoloured text on the same line, I also have not looked at how it would go with a flashing label or indicator 

 

 

 

That's about all I can think of at this point.

 

I have looked at the Button Screen but that is more geared towards an INPUT screen in conjunction with a touch panel and restricted a bit for the use as an OUTPUT screen.

Maybe it might be easier to make modifications to the Button Screen area to allow for a wider color range of Text and Background colors and be able to control those colors programatically.

That way individual buttons could be addressed for color or addressed for a flashing event etc.

 

Anyhow that's sort of where I was coming from, It might be worthwhile to provide something that can do on screen OUTPUT like this, what do you think ?

 

Thankyou again Pete for your time.

 

Regards Glenn.

Posted

How many variations of text in the four positions are there? Maybe you could make a set of bitmaps with the right texts and colours, one for each possible display need, then display whichever bitmap is appropriate? Possibly 16 small bitmaps covers all conditions for the 4 indicators?

 

Pete

Posted

OK yes, That would be an option, I have not played with the "wnd.bitmap(w, "pathfilename")" command.

 

This may be a solution, I guess it gets harder to deal with when there are more lamps to deal with, There are actually 10 Indicators on the left and 11 on the right some are hidden in that image, so that would be 1024 bitmaps for the left and 2048 bitmaps for the right.

I could be pulling my hair out on that one.....so maybe not practical.

I presume that completely refills/refreshes the whole screen with the new image,  so every indicator must be handled in the bitmap.

 

If there was a way to draw/refresh the screen with multiple bitmaps in set positions, then I would only need two bitmaps for each lamp, 20 for the left and 22 for the right, that would be doable. 

 

Cheers Glenn

Posted

OK yes, That would be an option, I have not played with the "wnd.bitmap(w, "pathfilename")" command.

 

This may be a solution, I guess it gets harder to deal with when there are more lamps to deal with, There are actually 10 Indicators on the left and 11 on the right some are hidden in that image, so that would be 1024 bitmaps for the left and 2048 bitmaps for the right.

I could be pulling my hair out on that one.....so maybe not practical.

 

Certainly not practical. Sorry. I was only thinking of the 4.

 

I presume that completely refills/refreshes the whole screen with the new image,  so every indicator must be handled in the bitmap.

 

Yes.

 

If there was a way to draw/refresh the screen with multiple bitmaps in set positions, then I would only need two bitmaps for each lamp, 20 for the left and 22 for the right, that would be doable. 

 

 

Again, it just won't fit into my current code. Quite honestly I think you are trying to force things into a simple Lua provision which it isn't intended for not suitable for. you'd be better off doing it all as a simple VB.Net program, using the Paul Henty .Net interface to FSUIPC/WideFS.

 

Pete

 

Posted

 

 

Again, it just won't fit into my current code. Quite honestly I think you are trying to force things into a simple Lua provision which it isn't intended for not suitable for. you'd be better off doing it all as a simple VB.Net program, using the Paul Henty .Net interface to FSUIPC/WideFS.

 

No problems Pete, I will take a look at that, Thankyou

 

Cheers Glenn.

Posted

Pete, Don't write off your WND library so fast, sometimes you just have to think outside the square..... in this case outside the window !!

 

So I went back to the WND library again in the manual and was just looking at the commands, then the penny dropped...... Just create multiple little windows which each can be color controlled, Background and Text all independently.

Attached is a looping demo script exercising different colors across the display, This could also be used for Radio Frequency Displays too, it's not limited to Annunciators by any means.

 

One quick question if I may.....

 

How many Individual displays can be created with the WND library ?

 

Cheers Glenn.

--[[

Looping Demo Annunciator Panel.
Created using the WND Library for use on a WideClient PC and WideFS
By Glenn Weston

I will leave it to your Imagination what you can do with this.

--]]



-- Create window and define title, font, size and colours
w1 = wnd.open("TEST PANEL1", WND_FIXED, 200,200,100,35)
wnd.font(w1, WND_ARIAL, 24.0, WND_BOLD) --Font, Size and Properties
wnd.backcol(w1, 0x000) -- background colour

w2 = wnd.open("TEST PANEL2", WND_FIXED, 300,200,100,35)
wnd.font(w2, WND_ARIAL, 24.0, WND_BOLD) --Font, Size and Properties
wnd.backcol(w2, 0x000) -- background colour

w3 = wnd.open("TEST PANEL3", WND_FIXED, 400,200,100,35)
wnd.font(w3, WND_ARIAL, 24.0, WND_BOLD) --Font, Size and Properties
wnd.backcol(w3, 0x000) -- background colour


w4 = wnd.open("TEST PANEL4", WND_FIXED, 500,200,100,35)
wnd.font(w4, WND_ARIAL, 24.0, WND_BOLD) --Font, Size and Properties
wnd.backcol(w4, 0x000) -- background colour


while 1 do

	ipc.sleep(1000)

	wnd.textcol(w1, 0xF00)
	wnd.text(w1 , "  RED")
	wnd.textcol(w2, 0x0F0)
	wnd.text(w2 , "GREEN")
	wnd.textcol(w3, 0x00F)
	wnd.text(w3 , "  BLUE")
	wnd.textcol(w4, 0xFFF)
	wnd.text(w4 , " WHITE")

	ipc.sleep(1000)

	wnd.clear(w1)
	wnd.clear(w2)
	wnd.clear(w3)
	wnd.clear(w4)

	ipc.sleep(1000)

	wnd.textcol(w1, 0xF00)
	wnd.text(w1 , "  RED")

	ipc.sleep(250)

	wnd.clear(w1)

	ipc.sleep(250)


	wnd.textcol(w2, 0x0F0)
	wnd.text(w2 , "GREEN")

	ipc.sleep(250)

	wnd.clear(w2)

	ipc.sleep(250)

	wnd.textcol(w3, 0x00F)
	wnd.text(w3 , "  BLUE")

	ipc.sleep(250)

	wnd.clear(w3)

	ipc.sleep(250)

	wnd.textcol(w4, 0xFFF)
	wnd.text(w4 , " WHITE")

	ipc.sleep(250)

	wnd.clear(w4)

	ipc.sleep(250)

	wnd.textcol(w1, 0x00F)
	wnd.text(w1 , "  BLUE")
	wnd.textcol(w2, 0x00F)
	wnd.text(w2 , "  BLUE")
	wnd.textcol(w3, 0x00F)
	wnd.text(w3 , "  BLUE")
	wnd.textcol(w4, 0x00F)
	wnd.text(w4 , "  BLUE")

	ipc.sleep(1000)

	wnd.backcol(w1, 0xFFF) -- background colour
	wnd.backcol(w2, 0xFFF) -- background colour

	wnd.textcol(w1, 0x0F0)
	wnd.text(w1 , "GREEN")
	wnd.textcol(w2, 0x0F0)
	wnd.text(w2 , "GREEN")
	wnd.textcol(w3, 0x0F0)
	wnd.text(w3 , "GREEN")
	wnd.textcol(w4, 0x0F0)
	wnd.text(w4 , "GREEN")

	ipc.sleep(1000)

	wnd.backcol(w1, 0x000) -- background colour
	wnd.backcol(w2, 0x000) -- background colour

	wnd.backcol(w3, 0xFFF) -- background colour
	wnd.backcol(w4, 0xFFF) -- background colour

	wnd.textcol(w1, 0xF00)
	wnd.text(w1 , "  RED")
	wnd.textcol(w2, 0xF00)
	wnd.text(w2 , "  RED")
	wnd.textcol(w3, 0xF00)
	wnd.text(w3 , "  RED")
	wnd.textcol(w4, 0xF00)
	wnd.text(w4 , "  RED")

	ipc.sleep(1000)

	wnd.backcol(w3, 0x000) -- background colour
	wnd.backcol(w4, 0x000) -- background colour

	wnd.textcol(w1, 0xFB0)
	wnd.text(w1 , "-----------")
	wnd.textcol(w2, 0xFB0)
	wnd.text(w2 , "-----------")
	wnd.textcol(w3, 0xFB0)
	wnd.text(w3 , "-----------")
	wnd.textcol(w4, 0xFB0)
	wnd.text(w4 , "-----------")

	ipc.sleep(3000)

end
 
Posted

How many Individual displays can be created with the WND library ?

 

 

 

My code imposes no limit -- it simply creates the Window and gives you a handle (the 'hwnd' in fact). So any limit is up to Windows: maybe 65535? 

 

It isn't one of those resources which my code keeps track of, so all those Windows still exist when your Lua closes unless you close the window first.

 

Pete

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.