WebSimConnect
Resource contributor
- Messages
- 154
To complete my FSX/P3D HTML5 tools, I want to include a component that will allow to merge XML gauges with HTML5 CustomDraw elements in the XML code.
I have questions to the ones who ever developed own CustomDraw element in C++ that can be used in the XML gauge. There are not so many samples and docs available on the topic so I am developing a bit blindly. I have successfully implemented HTML based CustomDraw element based on IGaugeCDrawable class and its virtual method Draw()
as I was inspired by famous TrafficRadar example I use TAKES_DC flag that allows to Draw GDI+/DX11 based on the provided HDC parameter. Then I started to experiment with TAKES_PIMAGE flag which changes the way the CustomDraw is rendered. Instead of HDC, the Draw() method receives the pointer to PIMAGE structure. After few experiments I noted that you can use PIMAGE in 2 ways, either write directly to the image bits buffer or simply replace the bits buffer with your own bits buffer. The only problem I have is that the image created is always IMG_15_BIT, // 1555 format and changing the format had no effect. The CustomDraw element was always rendered the way it was initialized with IMG_15_BIT. I guess there must be a way to change the format of the IMAGE passed to the Draw() method. The question is how ? There is a virtual method
which is called once the CustomDraw is initialized, however playing on IMAGE structure had on effect. Maybe there are some XML atributes that shall be set in XML code ?
The second issue is mouse input. C++ gauges have mouse_list_register fuction to capture mouse events. How about CustomDraw element, anything similar ?
any help highly appreciated
Marcin
I have questions to the ones who ever developed own CustomDraw element in C++ that can be used in the XML gauge. There are not so many samples and docs available on the topic so I am developing a bit blindly. I have successfully implemented HTML based CustomDraw element based on IGaugeCDrawable class and its virtual method Draw()
Code:
bool Draw (IGaugeCDrawableDrawParameters* pParameters, PIXPOINT size, HDC hdc, PIMAGE pImage);
as I was inspired by famous TrafficRadar example I use TAKES_DC flag that allows to Draw GDI+/DX11 based on the provided HDC parameter. Then I started to experiment with TAKES_PIMAGE flag which changes the way the CustomDraw is rendered. Instead of HDC, the Draw() method receives the pointer to PIMAGE structure. After few experiments I noted that you can use PIMAGE in 2 ways, either write directly to the image bits buffer or simply replace the bits buffer with your own bits buffer. The only problem I have is that the image created is always IMG_15_BIT, // 1555 format and changing the format had no effect. The CustomDraw element was always rendered the way it was initialized with IMG_15_BIT. I guess there must be a way to change the format of the IMAGE passed to the Draw() method. The question is how ? There is a virtual method
Code:
bool SetupDraw (PIXPOINT size, HDC hdc, PIMAGE pImage) of IGaugeCDrawable
The second issue is mouse input. C++ gauges have mouse_list_register fuction to capture mouse events. How about CustomDraw element, anything similar ?
any help highly appreciated
Marcin