Horde3D

Next-Generation Graphics Engine
It is currently 05.05.2024, 06:52

All times are UTC + 1 hour




Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: 11.05.2007, 17:14 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Sorry but that's not possible because it won't work if you put the windows code into a header file. The WinMain routine has to be in a cpp file. What exactly is the problem you have at the moment?

The Chicago sample already is quite modular. You can put your code into the Application class. Just take the unmodified sample and try to compile it. If that works, begin removing lines from the app.cpp and see if it is still compiling. You can try to remove the crowd simulation and so on and then you will quite soon have a minimal sample. I think that's the best way to learn basic coding...

If it is just the C++ that makes you headaches you could try the C# version which has a direct port of the sample application. There is a link in the downloads section. In C# you don't have to take care of all that admittedly ugly Win32 stuff.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 11.05.2007, 18:00 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
i`ve removed from start all the code concerning the crowd, and got about 20 errors. after removing the "ResHandle _fontMatRes, _logoMatRes;" line from app.h i got it down to 6 errors.
Code:
d:\work\coding\horde_test_final\horde_test_final\main.cpp(88) : error C2664: 'UnregisterClassW' : cannot convert parameter 1 from 'const char [11]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
d:\work\coding\horde_test_final\horde_test_final\main.cpp(115) : error C2440: '=' : cannot convert from 'const char [11]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
d:\work\coding\horde_test_final\horde_test_final\main.cpp(165) : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [11]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
d:\work\coding\horde_test_final\horde_test_final\main.cpp(182) : warning C4311: 'type cast' : pointer truncation from 'HDC' to 'int'
d:\work\coding\horde_test_final\horde_test_final\main.cpp(185) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [27]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
d:\work\coding\horde_test_final\horde_test_final\main.cpp(298) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [24]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
d:\work\coding\horde_test_final\horde_test_final\main.cpp(307) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [120]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast


if it is not to much to ask, could you clear for me the sample and upload it somewhere? this would get me going, and give me a chance to make some meaningfull posts next time :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 11.05.2007, 18:25 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
I can tell you what's the problem here. Go to the project settings under General and choose as Character Set Multibyte instead of Unicode. That's something they have changed with VS2005. Tell me if it is working and if not I will upload this cleaned sample for you. But I'm quite optimistic that it will work now... :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 11.05.2007, 18:38 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
thanks! that cleared all the errors. it compiled and linked ok. but when i want to start it the app crashes and the debbuger automaticly launches.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 11.05.2007, 18:52 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
The best is probably to recreate the project from scratch, use the original Chicago code and remove step by step some lines again. That takes time but learning a complex programming language like C++ requires you to gain experience and that means a plenty of trial and error...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 11.05.2007, 18:56 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
success! i have started from scratch and did every thing all over again. this time it worked!

but in the process i have lost the FPS counter. i will keep cleaning this solution and get it as small as i can.

thanks for the support!

LE: image deleted, host doesn't work anymore


Last edited by SpOOky on 11.11.2008, 00:50, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 11.05.2007, 19:05 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Great! :D

Now that you know how to get your app running you can begin to do something productive :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 11.05.2007, 19:15 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
now i`m digging into the xml files syntax; as soon as i understand how to use them and gain enough knowledge of the api i`ll cook up something and post screenshots!

i`ll soon start a small map walktrough app. and build from there as i get more proficient with horde3D.

thanks again for the support


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 11.05.2007, 20:54 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
one more thing: i ve shared the app with some friends, just to see how it performs on their gpus. it failed to start, giving this error message "the app failed to start because the app config is incorrect". what`s causing this?

horde3D runs on their systems, as they`ve downloaded and compiled the chicago sample and it does


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 11.05.2007, 21:41 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
In the Compiler options under Code Generation are several modes available. You should choose the non-DLL versions because else your app requires some Visual Studio Dlls in order to run.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 12.05.2007, 02:12 
Offline

Joined: 03.05.2007, 11:26
Posts: 26
Well done Spooky! It's nice when a plan finally comes together :D

Mark


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 12.05.2007, 12:43 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
problem solved! :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 12.05.2007, 17:27 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
i have one more question regarding the windows api, though. how do i center the window? i have played a bit with it but it wouldnt budge

thanks


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 12.05.2007, 18:55 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
I'm no expert in win32 programming. I think there is some function SetWindowPos but best is probably to look into the MSDN or google for an appropriate function.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 13.05.2007, 12:17 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
thanks marciano, with this i believe that i`ve cleared any win api encounters in the near future. now, to msdn! :)

paul


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group