I feel as if I have correctly setup my pointer and addresses within te arguments, but that's more than likely where I'm going wrong.
Quick question: Do you need the text object to be a pointer in the prototype of fadeMessage also?
Error:Code:#include <SFML/Graphics.hpp> #include <time.h> #include <string> using namespace std; void fadeMessage(sf::Text *text, unsigned int length); int main() { sf::RenderWindow window(sf::VideoMode(1000, 450), "Tpyor"); window.setFramerateLimit(60); sf::Text text("Welcome to my game.", sf::Font::getDefaultFont(), 36); fadeMessage(sf::Text &text, 200); while(window.isOpen()){ sf::Event event; while(window.pollEvent(event)){ if(event.type == sf::Event::Closed) window.close(); } window.clear(); window.draw(text); window.display(); } return 0; } //text object, effect length (max 255) void fadeMessage(sf::Text *text, unsigned int length){ *text.setString("worked"); }
Code:C:\Users\Justin\Desktop\Logic\main.cpp||In function 'int main()':| C:\Users\Justin\Desktop\Logic\main.cpp|15|error: expected primary-expression before '&' token| C:\Users\Justin\Desktop\Logic\main.cpp||In function 'void fadeMessage(sf::Text*, unsigned int)':| C:\Users\Justin\Desktop\Logic\main.cpp|34|error: request for member 'setString' in 'text', which is of non-class type 'sf::Text*'| ||=== Build finished: 2 errors, 0 warnings ===|



LinkBack URL
About LinkBacks


