Knayder Temat założony przez niniejszego użytkownika |
SFML - Uruchamianie pliku .exe » 2016-04-16 20:35:45 Witam, jakiś czasu temu zabrałem się za SFML. Napisałem prostą gierkę w snake, jednak mam problem z uruchamianiem pliku .exe. Wyskakują mi błędy: Nie można uruchomić programu, ponieważ na komputerze nie znaleziono libgcc_s_sjlj-1.dll. Analogicznie dla libstdc++-6.dll oaz libgcc_s_sjlj-1.dll. Pobrałem te pliki z internetu i wrzuciłem do folderu z plikiem .exe, jednak po zrobieniu tego, zaczynają wyskakiwać errory: Nie znaleziono punktu wejścia procedury __gxx_personalti_sj0 w bibliotece C:\Lokalizacja Folder z .exe\sfml-graphics-2.dll. Analogicznie dla sfml-system-2.dll oraz sfml-window-2.dll. Dodam że program uruchamiany w Code::Block działą normalnie. Mam windows 10 64-bit. Kod gry #include <SFML/Graphics.hpp> #include "Part.h" #include <vector> #include <cmath> #include <iostream> #include <windows.h> #include <cstdlib> #include <ctime> #include <string>
using namespace std;
void input(); void addPart( int x, int y, float radius, int howMany ); void lost(); string intToStr( int n ); sf::RenderWindow screen( sf::VideoMode( 800, 800 ), "Snake" ); vector < sf::CircleShape > snake; sf::Vector2f direction( 0.0, 0.0 ); float angle = 0; float curve = 0.08, velocity = 3; bool isLost = false; sf::Color backgroundColor( 230, 230, 230 ); sf::Color snakeColor( 50, 50, 50 ); int score = 0;
sf::CircleShape point( 5 );
int main() { srand( time( NULL ) ); screen.setFramerateLimit( 60 ); point.setFillColor( sf::Color( 200, 80, 80 ) ); point.setPosition(( rand() % 600 ) + 100,( rand() % 600 ) + 100 ); addPart( 100, 100, 5, 6 ); while( screen.isOpen() ) { input(); if( !isLost ) snake[ 0 ].move( direction ); direction.x = velocity * cos( angle ); direction.y = velocity * sin( angle ); for( int i = snake.size() - 1; i > 5; i-- ) if( snake[ 0 ].getGlobalBounds().intersects( snake[ i ].getGlobalBounds() ) ) lost(); if( snake[ 0 ].getGlobalBounds().left < 0 ) lost(); if( snake[ 0 ].getGlobalBounds().left + snake[ 0 ].getGlobalBounds().width > screen.getSize().x ) lost(); if( snake[ 0 ].getGlobalBounds().top < 0 ) lost(); if( snake[ 0 ].getGlobalBounds().top + snake[ 0 ].getGlobalBounds().height > screen.getSize().y ) lost(); if( snake[ 0 ].getGlobalBounds().intersects( point.getGlobalBounds() ) ) { point.setPosition(( rand() % 600 ) + 100,( rand() % 600 ) + 100 ); addPart( snake[ snake.size() - 1 ].getPosition().x, snake[ snake.size() - 1 ].getPosition().y, 5, 20 ); score += 5; } if( !isLost ) for( int i = snake.size() - 1; i > 0; i-- ) snake[ i ].setPosition( snake[ i - 1 ].getPosition() ); screen.clear( backgroundColor ); for( int i = snake.size() - 1; i >= 0; i-- ) screen.draw( snake[ i ] ); screen.draw( point ); screen.display(); system( "cls" ); cout << angle << endl; cout << score << endl; } return 0; }
void input() { sf::Event event; while( screen.pollEvent( event ) ) { if( event.type == sf::Event::Closed ) screen.close(); } if( !isLost && sf::Keyboard::isKeyPressed( sf::Keyboard::Left ) ) angle -= curve; if( !isLost && sf::Keyboard::isKeyPressed( sf::Keyboard::Right ) ) angle += curve; }
void addPart( int x, int y, float radius, int howMany ) { sf::CircleShape part( radius ); part.setPosition( x, y ); part.setOrigin( radius, radius ); part.setFillColor( snakeColor ); for( int i = 0; i < howMany; i++ ) snake.push_back( part ); }
void lost() { isLost = true; backgroundColor = sf::Color( 200, 50, 50 ); for( int i = snake.size() - 1; i >= 0; i-- ) snake[ i ].setFillColor( sf::Color( 230, 230, 230 ) ); point.setFillColor( sf::Color( 230, 230, 230 ) ); }
|
|
pekfos |
» 2016-04-16 20:40:53 Jak nie wiesz, co pobrać, to użyj plików, które działają - masz je w katalogu kompilatora. |
|
Knayder Temat założony przez niniejszego użytkownika |
» 2016-04-16 20:44:58 Nie rozumiem? Co mam pobrać? |
|
mateczek |
» 2016-04-16 20:52:15 Nic nie musisz pobierać. Pliki masz na kompie. Wyszukaj i skopiuj do katalogu aplikacji. Lub dodaj katalog bin kompilatora do zmiennej path !!!
|
|
Knayder Temat założony przez niniejszego użytkownika |
» 2016-04-16 21:07:45 Ok, działa. Nie zrozumiałem o co wam chodzi, bo nie napisaliście że chodzi wam o pliki dll, a ja tego na początku nie zrozumiałem. Szczególnie że była mowa że nic nie muszę pobierać, a ja napisałem że pobrałem. Tak czy siak, dziękuję bardzo za pomoc. |
|
« 1 » |