Jump to content
Sign in to follow this  
Guest Magma

MAKE_STATIC image not showing up

Recommended Posts

Guest Magma

Hi folks,I'm programming gauges for the first time and I'm having a hard time getting started. I finally got my code to compile and have modified the panel.cfg. The .gau appears to load fine when I hit the Fly Now in FS2004 but the background image of my gauge is not being drawn to the screen. Is the MAKE_STATIC macro not being called? Here is all my code starting with test.c, test.h and test.rc. It is completely stripped down and doesn't do anything, but shouldn't it still paint the image to the screen?// test.c code#include "..incgauges.h"#include #include "test.h"#define GAUGE_NAME "Test Code0"#define GAUGEHDR_VAR_NAME gaugehdr_test#define GAUGE_W 100extern PELEMENT_HEADER test_Small;GAUGE_CALLBACK testCallback;GAUGE_HEADER_FS700(GAUGE_W, GAUGE_NAME, &test_Small, NULL, testCallback, 0, 0, 0);MAKE_STATIC(test_background,BMP_SMALL_TEST,NULL,NULL,IMAGE_USE_TRANSPARENCY,0,0,0);PELEMENT_HEADER test_Small = &test_background.header;void FSAPI testCallback ( PGAUGEHDR pgauge, SINT32 service_id, UINT32 extra_data ){ switch (service_id){ case PANEL_SERVICE_PRE_DRAW:{ } }}void FSAPI ModuleInit(void){}void FSAPI ModuleDeinit(void){}GAUGE_TABLE_BEGIN() GAUGE_TABLE_ENTRY(&gaugehdr_test) GAUGE_TABLE_END()// test.h code#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_BUILD))#ifndef VS_VERSION_INFO#define VS_VERSION_INFO 0x0001#endif#define BMP_SMALL_TEST 0x1000// test.rc#include "test.h"VS_VERSION_INFO VERSIONINFO FILEVERSION VERSION_MAJOR,VERSION_MINOR,0,VERSION_BUILD PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,0,VERSION_BUILD FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x10004L FILETYPE 0x1L FILESUBTYPE 0x0LBEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "TEST Technologies Inc.0" VALUE "FileDescription", "Flight Simulator Test Gauge0" VALUE "FileVersion", VERSION_STRING VALUE "LegalCopyright", "Copyright 20060" VALUE "ProductName", "Test Code0" VALUE "ProductVersion", VERSION_STRING END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 ENDENDBMP_SMALL_TEST BITMAP DISCARDABLE "ressmall_test.BMP"

Share this post


Link to post
Share on other sites

I've never seen a gauge header macro constructed like this:GAUGE_HEADER_FS700(GAUGE_W, GAUGE_NAME, &test_Small,NULL, testCallback, 0, 0, 0);I think you need something like:char test_gauge_name[] = GAUGE_NAME;GAUGE_HEADER_FS700(GAUGE_W, test_gauge_name, &test_Small,NULL, testCallback, 0, 0, 0);By the way, if the callback function isn't being used for anything, you can dispense with it and make the gauge header macro look like this:GAUGE_HEADER_FS700(GAUGE_W, test_gauge_name, &test_Small, NULL, NULL, 0, 0, 0);Doug

Share this post


Link to post
Share on other sites
Guest Magma

Hi Doug,I figured if test_gauge_name[] = GAUGE_NAME anyways then I would just stick GAUGE_NAME in as a parameter. But I tried both of your suggestions and they compiled just fine but the image still didn't showed up when I ran the simulator.Magma

Share this post


Link to post
Share on other sites

Yes, your code, as posted, compiles just fine. On my system, it also produces a perfectly visible gauge. I've gotta ask... What are you using for a bitmap? RGB(0,0,0) will be "drawn" as transparent.Doug

Share this post


Link to post
Share on other sites
Guest Magma

Thanks Doug for compiling and trying my code. No RGB (0,0,0) colors in the image. Now I am confused as to where the problem is. I'm using VC++ 2005 and have the code generation runtime library set to (/MT) and the output is set to test.gau. Do I need a makefile?I wonder if I have the panel.cfg file set right? I just modified a C130 .cfg file by commenting out gauge06 and put in my gauge at some arbitrary postion. Here is the code:[Window Titles]Window00=main panelWindow01=gpsWindow02=radioWindow03=Compass[Window00]file=C130zpan.bmp size_mm=1024window_size_ratio=0.68 position=7visible=1ident=0window_pos= 0.000, 0.000gauge00=737-400!Airspeed, 306,473,91,90gauge01=737-400!Flaps, 565,571,83,82gauge02=737-400!Altimeter, 302,569,97,92gauge03=737-400!Vertical Speed, 563,480,86,85gauge04=737-400!Fuel Quantity, 233,709,120,57gauge05=Cessna208!Horizontal-Indicator, 421,613,122,119//gauge06=Cessna!Attitude, 416,457,132gauge06=test, 100,100,100,100gauge07=737-400!RMI, 174,562,116,131gauge08=737-400!Gear Lever, 657,491,48,96gauge09=Bell_206B.Clock, 231,481,63,60gauge10=Cessna!DME, 847,443,160,41gauge11=737-400!Autopilot, 698,311,303,45gauge12=00.sukhoi.trim, 316,669,64,29gauge13=radalt, 888,499,84,23gauge14=c130hdg, 827, 221 ,135,73gauge15=ZH_ligh1, 172,502,27,28gauge16=IL-62v2.N1-4, 964,569,56,55gauge17=IL-62v2.N1-3, 903,569,56,55gauge18=IL-62v2.N1-2, 839,569,56,55gauge19=IL-62v2.N1-1, 773,570,56,55gauge20=Boeing747-400!Engine Start Knob 1, 492,741,20,25gauge21=Boeing747-400!Engine Start Knob 2, 527,741,20,25gauge22=Boeing747-400!Engine Start Knob 3, 563,741,20,25gauge23=Boeing747-400!Engine Start Knob 4, 597,741,20,25gauge24=SimIcons!Map Icon, 768,436,26,26gauge25=SimIcons!GPS Icon, 768,467,26,26gauge26=SimIcons!ATC Icon, 801,436,26,26gauge27=SimIcons!Compass Icon, 769,501,26,26gauge28=SimIcons!Avionics Icon, 801,467,26,26gauge29=cessna_182.switches, 787,713,228,49gauge30=Beech_Baron!Gear Lights, 661,613,45,46[Window01]Background_color=16,16,16 size_mm=130,210window_size_ratio=1.00 position=7visible=0ident=GPS_PANELwindow_size= 0.340, 0.490window_pos= 0.008, 0.500gauge00=gps!gps, 0,0,130,210[Window02]Background_color=16,16,16 size_mm=127,345position=8visible=0ident=RADIO_STACK_PANELgauge00=737-400!Comm 1, 0,0gauge01=737-400!Comm 2, 0,54gauge02=737-400!Nav 1, 0,108gauge03=737-400!Nav 2, 0,162gauge04=737-400!Transponder, 0,216gauge05=737-400!ADF, 0,265gauge06=737-400!Audio, 0,319[Window03]Background_color=138,118,106 size_mm=70position=2visible=0ident=COMPASS_PANELgauge00=Magnetic_Compass!Magnetic-Compass, 0,0[Vcockpit01]Background_color=0,0,0 size_mm=512,256position=7visible=1ident=pixel_size=512,256texture=$vcgauge00=737-400!Airspeed, 12,26,66,60gauge01=737-400!Flaps, 107,162,35,33gauge02=737-400!Altimeter, 14,88,63,61gauge03=737-400!Vertical Speed, 22,150,48,45gauge04=Cessna208!Horizontal-Indicator, 80,87,77,74gauge05=Cessna!Attitude, 80,-1,86,85gauge06=737-400!RMI, 360,61,95,108gauge07=737-400!Gear Lever, 304,60,37,109gauge08=Bell_206B.Clock, 301,4,52,47gauge09=Cessna!DME, 368,27,81,30gauge10=00.sukhoi.trim, 298,176,48,23gauge11=radalt, 366,173,93,24gauge12=c130hdg, 355,-28,89,53gauge13=ZH_ligh1, 79,169,19,20[Default View]X=0Y=0SIZE_X=8191SIZE_Y=6143

Share this post


Link to post
Share on other sites

Change this:gauge06=test, 100,100,100,100to this:gauge06=test!Test Code, 100,100,100,100(that line #define GAUGE_NAME is there for a reason ;-) )If you're going to do any work at all with panels, do yourself a huge favour and get a copy of FSPanelStudio. Best thirty bucks you'll ever spend on an FS add on.Doug

Share this post


Link to post
Share on other sites
Guest Magma

Ah there it is! Thanks Doug that was much appreciated. I will look into FSPanelStudio like you suggested.Magma

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...