Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Tall

Pages: [1]
1
General / Re: Cant get working SFML with clion
« on: January 14, 2018, 12:40:37 pm »
ok, i have tryied to change things in the cmakeLists file. and now the error changed.

mingw32-make.exe: *** No rule to make target 'BOX2D'.  Stop.


CMakeLists.txt

cmake_minimum_required(VERSION 3.7)
project(BOX2D)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=lib++")

set(SOURCE_FILES main.cpp)
add_executable(BOX2D ${SOURCE_FILES})

set(CMAKE_MODULE_PATH "D:/c++/Librerie/SFML-2.4.2/cmake/Modules" ${CMAKE_MODULE_PATH})

set(SFML_STATIC_LIBRARIES TRUE)
set(CMAKE_FIND_FRAMEWORK NEVER)

find_package(SFML COMPONENTS graphics window system REQUIRED)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(${main.cpp} ${SFML_Libraries})

2
General / Re: Cant get working SFML with clion
« on: January 13, 2018, 07:19:54 pm »
i have tryied to change project name, and now im getting this

CMake Error at cmake_modules/FindSFML.cmake:355 (message):
  Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY
  SFML_GRAPHICS_LIBRARY SFML_NETWORK_LIBRARY SFML_AUDIO_LIBRARY)
 

I tried a simple helloWorld program and it worked with cmake

3
General / Cant get working SFML with clion
« on: January 13, 2018, 03:42:22 pm »
hi, im trying to use Clion with SFML, im using minGW compiler, im on Windows 10.

When i try to compile, i get this error: No rule to make target '01Chess'.  Stop.


Cmake file

cmake_minimum_required(VERSION 3.2)
project(01Chess)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp)
add_executable(01Chess ${SOURCE_FILES})

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
find_package(SFML REQUIRED system window graphics network audio)
if (SFML_FOUND)
    include_directories(${SFML_INCLUDE_DIR})
    target_link_libraries(01Chess ${SFML_LIBRARIES})
endif()



main.cpp file

#include <SFML/Graphics.hpp>
#include "config.h"

int main() {
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen()) {
        sf::Event event;
        while (window.pollEvent(event)) {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }
    return 0;
}


4
Graphics / Re: Need help with RectangleShape and array
« on: January 03, 2018, 09:07:56 pm »
thank for you help, now the program works perfectly. Tomorrow im gonna revise vertex and array.

5
Graphics / Re: Need help with RectangleShape and array
« on: January 03, 2018, 01:52:41 pm »
thanks for your support, but code::blocks didint gave me any error.

6
Graphics / Need help with RectangleShape and array (Solved)
« on: January 03, 2018, 11:32:10 am »
So, im creating a little game as a school project, a very simple one, im trying to create projectiles but when i press 'F' to fire the game crash.

here the part on the code
    int fire_c = 0;
    std::vector <sf::RectangleShape> fire (fire_c);
    std::vector <sf::Vector2f> fire_p (fire_c);
 

        if (sf::Keyboard::isKeyPressed(sf::Keyboard::F)) {
            fire_c = fire_c + 1;
            fire.resize(fire_c);
            fire_p.resize(fire_c);
            fire[fire_c].setFillColor(sf::Color::Red);
            fire[fire_c].setSize(sf::Vector2f(2,5));
            fire_p[fire_c].x = astronave_p.x + 4;
            fire_p[fire_c].y = astronave_p.y - 6;
            pioggia[fire_c].setPosition(pioggia_p[fire_c]);
        }
        for (int i = 1; i < fire_c; i++) {
            fire_p[i].y = fire_p[i].y - 5;
            fire[i].setPosition (fire_p[i]);
        }

for (int i = 1; i < fire_c; i++) {window.draw(fire[i]);}
 

7
Graphics / Re: Help with renderWindow not displaying
« on: May 02, 2017, 03:41:29 pm »
Quote
Is "cell" an sf::RectangleShape object? If so, do you ever set its size?

is "posOut" an sf::Text object? If so, do you ever set its font?

ty, i totaly forgot to set size

8
Graphics / Help with renderWindow not displaying
« on: May 01, 2017, 10:34:20 pm »
Hi guys, i need help with my project, the renderWindow is not showing anything.

if you need i can post the headers too.

main.cpp
#include <SFML/Graphics.hpp>
#include <iostream>
#include "Display.h"
#include "Obj.h"
using namespace std;

int main()
{
        Display app;
        Obj obj;

        app.window.setFramerateLimit(60);

        while (app.window.isOpen())
        {
                app.eventsCheck();
               
                app.clear();

                //Game
                obj.logic();
                obj.output();
                obj.draw(app.window);

                app.display();
        }

        return 0;
}
 

display.cpp
#include "Display.h"



Display::Display()
{
        window.create(sf::VideoMode(800, 600), "Ai", sf::Style::Default);
}

void Display::display()
{
        window.display();
}

void Display::clear()
{
        window.clear(sf::Color::White);
}

void Display::eventsCheck()
{
        while (window.pollEvent(event))
        {

                if (event.type == sf::Event::Closed)
                        window.close();
        }
}
 

obj.cpp
#include "Obj.h"

Obj::Obj()
{
        pos.x = 100;
        pos.y = 100;
        cell.scale(sf::Vector2f(1, 1));
        cell.setFillColor(sf::Color::Black);
        cell.setPosition (pos);

        if (!font.loadFromFile("arial.ttf"))
                std::cout << "Errore durante il caricamento del font" << std::endl;

        posOut.setCharacterSize(30);
        posOut.setColor(sf::Color::Black);
        posOut.setPosition(sf::Vector2f(2, 1));
}

void Obj::draw(sf::RenderWindow &window)
{
        window.draw(cell);
        window.draw(posOut);
}

void Obj::logic()
{
}

void Obj::output()
{
        ss << "x." << pos.x << " y." << pos.y;
        posOut.setString(ss.str());
}
 

Pages: [1]
anything