1
Programming / Re: where to go now?
« on: September 09, 2009, 01:51:53 PM »You included string.h but you use c-style strings. You do need c-style strings for the curses functions, but you can use c_str() to convert c++ strings to c-style strings.Code: [Select]string msg = "Press wasd to move around. Shift+E to exit";
That should work.
mvaddstr(rows / 2, (cols / 2) - (msg.length()/ 2),msg.c_str());
I tried that before, gave me a lot of errors. Replaced #include <string.h> with nothing, errors for missing string header. #include <string> however exploded:
include\c++\3.4.5\bits\char_traits.h|117|macro "move" passed 3 arguments, but takes just 2|
include\c++\3.4.5\bits\char_traits.h|184|macro "move" passed 3 arguments, but takes just 2|
include\c++\3.4.5\bits\char_traits.h|185|error: invalid function declaration|
include\c++\3.4.5\bits\char_traits.h|265|macro "move" passed 3 arguments, but takes just 2|
include\c++\3.4.5\bits\char_traits.h|266|error: invalid member function declaration|
include\c++\3.4.5\bits\char_traits.h|335|macro "move" passed 3 arguments, but takes just 2|
include\c++\3.4.5\bits\char_traits.h|336|error: invalid member function declaration|
include\c++\3.4.5\bits\basic_string.h|604|error: expected `)' before '->' token|
include\c++\3.4.5\bits\basic_string.h|1039|macro "erase" passed 2 arguments, but takes just 0|
include\c++\3.4.5\bits\basic_string.h|1040|error: invalid member function declaration|
include\c++\3.4.5\bits\basic_string.h|1052|macro "erase" passed 1 arguments, but takes just 0|
include\c++\3.4.5\bits\basic_string.h|1053|error: invalid member function declaration|
include\c++\3.4.5\bits\basic_string.h|1072|macro "erase" passed 2 arguments, but takes just 0|
include\c++\3.4.5\bits\basic_string.h|1073|error: invalid member function declaration|
include\c++\3.4.5\bits\basic_string.tcc|280|macro "move" passed 3 arguments, but takes just 2|
include\c++\3.4.5\bits\basic_string.tcc|415|macro "move" passed 3 arguments, but takes just 2|
include\c++\3.4.5\bits\basic_string.tcc|581|macro "erase" passed 1 arguments, but takes just 0|
||=== Build finished: 17 errors, 0 warnings ===|
I'm still quite new to c++, since I haven't used it in over a year. Figured it would be a good way to learn it again to do something that I enjoy in it. Are there any code examples for how to implement a map? Or little helpful tidbits of information? The thing that I know I'm going to have the most difficulty with is making a map that is bigger than the console window centering on the player.
Thanks ^_^