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.


Topics - floppa_dev

Pages: [1]
1
General / console disable c++
« on: March 31, 2023, 01:43:33 pm »
how can i hide console c++ from showing, like when i send my project to my friend his console to be hidden

2
General / [Solved]Textures aren't showing
« on: January 21, 2023, 12:03:42 pm »
The textures arent showing
I will put my project below
In advance, thank you
main.cpp:
// Comp issues win any rez other tham 1920*1080
#include "smth.hpp"
#include "grass.cpp"
using namespace sf;
int main()
{
    init_grass();
    Object player, bg;
    player.position = {960, 100};
    bg.position = {0, 0};
    if (!player.texture.loadFromFile("Images/big-floppa-player.png") || !bg.texture.loadFromFile("Images/bg.jpg"))
    {
        return -1;
    }
    player.position = {0, 100};
    player.sprite.setTexture(player.texture);
    bg.sprite.setTexture(bg.texture);
    RenderWindow window(sf::VideoMode(1920, 1080), "Super Floppa", Style::Fullscreen);
    Clock clock;
    while (window.isOpen())
    {
        Event event;
        while (window.pollEvent(event))
        {
            sf::Time elapsed = clock.restart();
            float dt = elapsed.asSeconds();
            if (event.type == Event::Closed || Mouse::isButtonPressed(Mouse::Right))
                window.close();
            if (Keyboard::isKeyPressed(Keyboard::A))
                player.position += {-10.f, 0.f};
            if (Keyboard::isKeyPressed(Keyboard::D))
                player.position += {10.f, 0.f};
            if (Keyboard::isKeyPressed(Keyboard::W))
                player.position += {0.f, -10.f};
            if (Keyboard::isKeyPressed(Keyboard::S))
                player.position += {0.f, 10.f};
            window.clear();
            window.draw(bg.sprite);
            window.draw(grass);
            display_smth(player, window);
            while (!touch_grass_lol(player, grass))
            {
                player.position += {0.f, 10.f};
            }
            std::cout << player.position.x << &#39;-&#39; << player.position.y << &#39;\n&#39;;
            window.display();
            if (dt < 1.f / 60.f)
            {
                sleep(sf::seconds(1.f / 60.f - dt));
            }
        }
    }
    return 0;
}
// no credits here
//------------------
grass.cpp
#include <SFML/Graphics.hpp>
#include "smth.hpp"
using namespace sf;
RectangleShape grass(Vector2f(1920.f, 100.f));
void init_grass()
{

    Texture grass_tex;
    if (!grass_tex.loadFromFile("Images/grass.png"))
    {
        std::cout << -1192919929;
    }
    grass.setTexture(&grass_tex);
    grass.setPosition(0, 980);
}
// my friend ... needs to (-insert someone name-)
bool touch_grass_lol(Object &object, RectangleShape grass)
{
    if (object.sprite.getGlobalBounds().intersects(grass.getGlobalBounds()))
        return 1;
    return 0;
}
 
smth.hpp
#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/Window/VideoMode.hpp>
#include <SFML/System.hpp>
#include <iostream>
#include <cmath>
const double PI = 3.14159265358979323846;
struct Object
{
    sf::Vector2f position;
    float angle;
    sf::Sprite sprite;
    sf::Texture texture;
};

void update_pos(Object &object1, Object &object2)
{
    object1.position = object2.position;
}
void moveObject_angle(Object &object, float &distance, float &angle)
{
    // Calculate the displacement in the x and y directions
    float dx = distance * cos(angle * PI / 180.0f);
    float dy = distance * sin(angle * PI / 180.0f);

    // Update the object&#39;s position
    object.position.x += dx;
    object.position.y += dy;

    // Update the object&#39;s sprite position
    object.sprite.setPosition(object.position);
}
void display_smth(Object &object, RenderWindow &window)
{
    object.sprite.setPosition(object.position);
    window.draw(object.sprite);
}
/*bool jump(int f)
{
    int o = f;
    f-= o/10;
    player.position += player.position += {0.f, f};
    if(player.getGlobalBounds.itersects.grass.sprite)
    return 0;
}*/

3
General / [Please help]Error
« on: January 15, 2023, 09:07:09 am »
mingw32-make: *** [Makefile:11: run] Error -1073741819
code:
all:run
CC=g++
CFLAGS=-O1 -Wall -std=c++17 -Wno-missing-braces -I ./include/ -L ./lib/ -lsfml-graphics -lsfml-window -lsfml-system
TARGET=floppa.exe
SRC=src/main.cpp
DEPS=src/smth.hpp
$(TARGET): $(SRC) $(DEPS) Makefile
   $(CC) $< -o $@ $(CFLAGS)
build: $(TARGET)
run: build
   ./$(TARGET)

4
General / [SOLVED]Error
« on: January 11, 2023, 01:56:34 pm »
I have this errors:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ./lib//libsfml-graphics.a when searching for -lsfml-graphics
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ./lib/\libsfml-graphics.a when searching for -lsfml-graphics
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ./lib//libsfml-window.a when searching for -lsfml-window
(there are others)
and this makefile:
CC = g++
CFLAGS=-O1 -Wall -std=c++17 -Wno-missing-braces -I ./include/ -L ./lib/ -lsfml-graphics -lsfml-window -lsfml-system
SOURCES = src/main.cpp
OBJECTS = $(SOURCES:.cpp=.o)
EXECUTABLE = floppa

all: $(SOURCES) $(EXECUTABLE)
   
$(EXECUTABLE): $(OBJECTS)
        $(CC) $(CFLAGS) $(OBJECTS) -o $@

.cpp.o:
        $(CC) $(CFLAGS) $< -o $@
 
helppppppppppp

5
Feature requests / Angle between two object
« on: November 22, 2022, 03:27:24 pm »
how to calculate angle between two sprites/objects? :) ik this was asked before but i am a noob so i didnt understand

Pages: [1]
anything