![]() |
|
|||||||
| Register | Wiki | Downloads | FAQ | Members List | Social Groups | Calendar | Search | Today's Posts | Mark Forums Read |
| Gauges Use this forum for all your gauges related discussions |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
C++ Bitmaps
Hey guys,
I have written a gauge for FSX (in this case, the base of an altitude gauge), and I followed the same procedure I have for gauges in the past (that worked). Now, I am having an inexplicable access violation error loading the gauge from within FSX. I have tried using GAUGE_HEADER_FS700 and GAUGE_HEADER_FS1000 (using NULL in place of callbacks and serialization data in the latter), and both times, what happens is this: When using FsPanelStudio to place the gauge, it recognizes that it is an FSX gauge, and reads the gauge table to identify that !altitude points to the altitude guage. As soon as I click on it, FsPanelStudio freezes, and if I select it from withing FSX, FSX crashed with an unhandled exception either in user32.dll or ntdll.dll. There are no compiler errors, except for an Intellisense "Expected a declaration" warning in the .rc file (which was not present in VS2010/VC++ 2010, but is in VS11). I have tried using a different bitmap, and I have tried compiling it with VS2010 as well (to no avail). If anyone else has had this issue before, please let me know how you fixed it. I have read the FSX SDK samples several times, and read the Dragonfly Gauge Tutorial as a guide, and I have checked my code several times. I will publish that actual code later if neccesary, just wondering if there is something obvious I overlooked. Thanks ahead of time, |
|
#2
|
||||
|
||||
|
I have found VS2008 to be a bit more stable for FSX stuff than the newer versions....
|
|
#3
|
|||
|
|||
|
Quote:
Tom |
|
#4
|
|||
|
|||
|
I have edited out certain sections, as the project is secret.
---------ers_FILE.rc----------------------------- ALTITUDE_BACKGROUND BITMAP DISCARDABLE "res\\ALTITUDE_BACKGROUND.BMP" ------------------------------------------------ ----------altitude.cpp---------------------------- char altitude_gauge_name[] = GAUGE_NAME; extern PELEMENT_HEADER altitude_list; extern MOUSERECT altitude_mouse_rect[]; GAUGE_HEADER_FS700(GAUGE_W,altitude_gauge_name,&al titude_list,altitude_mouse_rect,0,0,0,0); MAKE_STATIC(alt_back,ALTITUDE_BACKGROUND,NULL,NULL ,IMAGE_USE_TRANSPARENCY | IMAGE_USE_ERASE,0,0,0) PELEMENT_HEADER altitude_list = &alt_back.header; MOUSE_BEGIN(altitude_mouse_rect,NULL,0,0) MOUSE_END #undef GAUGE_NAME #undef GAUGEHDR_VAR_NAME #undef GAUGE_W -------------------------------------------------------------- -------------ers_FILE.cpp--------------------------------- #include "inc\\gauges.h" #include "ers_FILE.h" //Altitude Gauge #define GAUGE_NAME "altitude" #define GAUGEHDR_VAR_NAME gaugehdr_altitude #define GAUGE_W 100 #include "gauges\altitude.cpp" GAUGE_TABLE_BEGIN() GAUGE_TABLE_ENTRY(&gaugehdr_altitude) GAUGE_TABLE_END() -------------------------------------------------------- --------------------------ers_FILE.h---------------------- #define VERSION_MAJOR 1 #define VERSION_MINOR 0 #define VERSION_BUILD 0 // magic to get the preprocessor to do what we want #define lita(arg) #arg #define xlita(arg) lita(arg) #define cat3(w,x,z) w##.##x##.##z##\000 #define xcat3(w,x,z) cat3(w,x,z) #define VERSION_STRING xlita(xcat3(VERSION_MAJOR,VERSION_MINOR,VERSION_BU ILD)) #ifndef VS_VERSION_INFO #define VS_VERSION_INFO 0x0001 #endif #define ALTITUDE_BACKGROUND 0x1000 ------------------------------------------------------------- |
|
#5
|
|||
|
|||
|
Quote:
#include "ers_FILE.h" in the .rc file? Otherwise ALTITUDE_BACKGROUND bitmap's physical location wouldn't be associated with 0x1000 address. Appart from that, I can't find anything wrong with your code. Tom |
|
#6
|
|||
|
|||
|
Yes, I did include the header. You just confirmed my fears my friend. Either VS11 is compiling wrong, or my FSX is screwed up.
|
|
#7
|
|||
|
|||
|
A very remote possibility, but has your new bitmap the same nunber of bits/pixel as previous ones that were OK?
|
|
#8
|
|||
|
|||
|
Here's the weird part - it worked on one of my other dev's computers. Just not mine; I am unsure of the reason, but it is definitively something on my side (the other dev did indeed see the bitmap).
|
|
#9
|
||||
|
||||
|
overall though GDI+ is a better way to go when it comes to C++ gauges....
|
|
#10
|
|||
|
|||
|
Not always.
|
|
#11
|
|||
|
|||
|
Always.
If you know how to use it *properly*, which means avoiding the functions that looks easy to use (which are usually slower) and use the more low-level functions that are harder and looks on paper more "complex", but are usually faster, and also if you skip GDI+ for some things that can be done with regular GDI and are way faster with it (like clearing the screen). There's nothing that can't be done with GDI+, including analog gauges with a custom bitmap background and vector needles drawn with GDI+ on top of them. |
|
#12
|
|||
|
|||
|
Oh, I agree you can do it "all" with GDI+... I disagree that it's always the best choice.
|
|
#13
|
|||
|
|||
|
Quote:
So yes, I agree that, for someone without all the above information, it might not always be the best choice... |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Effects bitmaps | itifonhom | Special Effects General | 3 | 03 Jun 2009 15:34 |
| .gau file and bitmaps | Capn_Geoff | Gauges | 8 | 10 Dec 2008 17:30 |
| Gauge with Bitmaps | PeterW | Gauges | 1 | 30 Jan 2008 09:05 |
| 2 bitmaps better than 1? | Fern | GMax and 3DS Max | 9 | 05 Dec 2005 15:00 |
| Repeating Bitmaps | paul | SCASM & ASM tweaking | 2 | 31 Mar 2005 11:55 |