Raul Posted March 27, 2010 Share Posted March 27, 2010 In order to use correctly the boom, hdr, etc effects and to render the sbx file I saw I have to use the framewerk. Looking at Marleys Ghost post I used that code and everything is working fine, but I need to make some modification: I have a class (cPlayer) which I have to make it use the fw object. Also from my Main.cpp I need to access it. Where do I have to define this line: leadwerks::Framewerk fw; If I declare it to the start of my Main.cpp when updating my player and accessing it I receive the error C2065: 'fw' : undeclared identifier error What should I do? Quote i5 2.7Ghz, GTS 450, 8GB Ram, Win7 x64; Win8 x64 rvlgames.com - my games RVL Games Facebook Page, YouTube Channel Blitzmax Link to comment Share on other sites More sharing options...
Canardia Posted March 27, 2010 Share Posted March 27, 2010 You can make separate .h and .cpp file which has the global fw variable. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Pixel Perfect Posted March 27, 2010 Share Posted March 27, 2010 Two simple solutions are as follows: declare fw as an extern in your player class header (not so nice) pass it as a parameter to your player class constructor from your main routine Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Raul Posted March 27, 2010 Author Share Posted March 27, 2010 @Lumooja: I tried to add the leadwerks::Framewerk fw; into a separate .h file and to include the file in every class and main.cpp but I receive the message "fw already declared" (or something like that) You said "global fw variable. " How to do that? @Pixel Perfect: How exactly can I pass it? Quote i5 2.7Ghz, GTS 450, 8GB Ram, Win7 x64; Win8 x64 rvlgames.com - my games RVL Games Facebook Page, YouTube Channel Blitzmax Link to comment Share on other sites More sharing options...
Pixel Perfect Posted March 27, 2010 Share Posted March 27, 2010 // define a private member variable in your class Framewerk* m_pFramewerk; // pass a pointer to your framewerk object as a parameter to the constructor and assign it to the member variable cPlayer::cplayer(Framework* pFramewerk) { m_pFramewerk= pFramewerk; } // Access the framewerk in your class via m_pFramewerk-> Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Canardia Posted March 27, 2010 Share Posted March 27, 2010 @Lumooja: I tried to add the leadwerks::Framewerk fw; into a separate .h file and to include the file in every class and main.cpp but I receive the message "fw already declared" (or something like that)You need to add the extern keyword in the .h file. // fwglobal.h #pragma once #include "framewerk.h" extern leadwerks::Framewerk fw; // fwglobal.cpp #include "fwglobal.h" leadwerks::Framewerk fw; Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Raul Posted March 27, 2010 Author Share Posted March 27, 2010 Thanks to both of you guys for sharing the code. Quote i5 2.7Ghz, GTS 450, 8GB Ram, Win7 x64; Win8 x64 rvlgames.com - my games RVL Games Facebook Page, YouTube Channel Blitzmax Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.