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

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: Can you integrate allegro into an sfml window?
« Last post by fallahn on Today at 10:56:07 am »
Just tried it with gcc and there were a few typos which needed fixing 😅

I've updated the repo with a version that I've tested on my linux box and added a CMake project for the demo if you'd like to try it.
2
SFML development / Re: Font/Text Direction
« Last post by FRex on Today at 06:26:52 am »
Adding vertical advance in sf::Font would unlock one thing: let users write own text code that does the vertical layout. I think this was the point Hapax made.

Same as now sf::Text has no per letter color, style, etc. but you can write a class that does, all using sf::Font, never dealing with FreeType yourself, or how in general you can make own drawables using vertex arrays or buffers.

Now if you want vertical text, you'd have to use FreeType 100% by yourself, just to get that y from advance that sf::Font doesn't expose (I'm not sure if anything else is missing or if just this one field will allow it).
3
After a bit of experimenting, that solution partially worked. I figured it out so I'm going to mark the thread as solved, but for anyone who runs into this issue:

Resetting the window view is NOT enough to solve this on its own. The flow of code should be something like this:
if (event.type == sf::Event::Resized) {
        window.setView(sf::View(sf::Vector2f(window.getSize().x/2.f,window.getSize().y/2.f), sf::Vector2f(window.getSize().x, window.getSize().y)));
        for (auto& i : sprites) {
            i.setPosition(/*new position */);
        }
       
    }
You must adjust every drawn object/sprite's position after you change the sf::View, otherwise each drawn object is stuck with an arbitrary sf::View based on the time it was drawn before/after the resizing of the window.
4
General discussions / Re: Scroll Wheel
« Last post by eXpl0it3r on May 22, 2024, 10:38:53 pm »
Have you tried the sf::Event::MouseWheelScrolled event? See the tutorial.

Or are you saying that your mouse has more than one scroll wheel?

As for buttons, SFML also supports two extra mouse buttons.
5
General / Re: Can you integrate allegro into an sfml window?
« Last post by Me-Myself-And-I on May 22, 2024, 09:23:06 pm »
I don't think that's the problem.
The header files are not listed in the cmake file.
# Project: Project1
# Makefile created by Dev-C++ 5.11

CPP      = g++.exe
CC       = gcc.exe
WINDRES  = windres.exe
OBJ      = main.o VideoTexture.o
LINKOBJ  = main.o VideoTexture.o
LIBS     = -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32" -L"C:/SFML-2.4.0/lib" -static-libgcc -lsfml-graphics -lsfml-network -lsfml-audio  -lsfml-system -lsfml-window -m32
INCS     = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
CXXINCS  = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++" -I"C:/SFML-2.4.0/include"
BIN      = Project1.exe
CXXFLAGS = $(CXXINCS) -m32 -std=c++11
CFLAGS   = $(INCS) -m32 -std=c++11
RM       = rm.exe -f

.PHONY: all all-before all-after clean clean-custom

all: all-before $(BIN) all-after

clean: clean-custom
        ${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
        $(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)

main.o: main.cpp
        $(CPP) -c main.cpp -o main.o $(CXXFLAGS)

VideoTexture.o: VideoTexture.cpp
        $(CPP) -c VideoTexture.cpp -o VideoTexture.o $(CXXFLAGS)
6
General / I need help with this
« Last post by Yosef on May 22, 2024, 08:03:37 pm »
I'm developing a pool game using SFML and Box2D, and I'm currently facing an issue with creating the cue ball outline when the player aims. I have three rays that are cast: two black ones and one white one. How can I determine the position of the outline of the cue ball using the shortest of these rays as the player aims. I am using the ray cast function of box2d.

I have attached picture of the outline for further reference

7
General discussions / Scroll Wheel
« Last post by clampflower on May 22, 2024, 05:23:19 pm »
Hi All,

Apologies, as I am fairly new to this game.  I have been programming in C++ / SFML for a while now (months) but got stuck on mouse wheels. How do I use SFML to detect which way a vertical mouse wheel has been scrolled? I am using a Logitech mouse that has a pile of buttons and wheels but the main vertical wheel is the one that I want to detect.

I have been playing Forge of Empires and this scroll wheel controls the zoom function of the map, which is great and so I know this is doable. Would very much appreciate any help.

Many thanks

Moon.
8
General / Re: Can you integrate allegro into an sfml window?
« Last post by fallahn on May 22, 2024, 05:22:14 pm »
It depends on you compiler/toolchain setup.

For example Visual Studio lists 2 folders in its source tree "Header Files" and "Source Files". Only the files which are included in the "Source Files" folder are sent for compilation. It's at this point any header files which are #include 'd in the *.cpp files are pulled in by the compiler for compilation. (Well, kinda, they're put in place by the preprocessor just before compilation).

On the other hand *.hpp files listed in the "Header Files" section are ignored, except for when they're explicitly #include 'd in a *.cpp file. If you try adding an *.hpp file to the "Source Files" folder, Visual Studio will try to compile it directly which may or may not be what you want (probably not in most cases, and definitely not in this specific case).

Other toolchain/compiler setups are similar: you list the source files (*.c and *.cpp) you want to compile, followed by the directories containing the header files. That way the compiler will only pull in any header files for compilation as is needed.

So what I mean is - make sure the *.hpp files are not being added to the list of files to be compiled, either by accidentally adding them to the "Source Files" folder in Vidual Studio, or by any other means with a different compiler.
9
Audio / Re: (SOLVED)Music not playing even though its loaded.
« Last post by Me-Myself-And-I on May 22, 2024, 04:43:29 pm »
Sorry for reopening this topic after I closed it. I just wanted to say, I found the solution and it had nothing to do with the window. I figured out that I had too many soundbuffers ,and sounds  for music to play anything. I guess I hit the limit and caused sf::Music to be silent.
10
General / Re: Can you integrate allegro into an sfml window?
« Last post by Me-Myself-And-I on May 22, 2024, 04:18:20 pm »
This might sound dumb but... how exactly do you do that? :P I don't think I've ever heard of excluding header files from compilation when the cpp file is using them. Neither have I found any documentation on how to do that.
Pages: [1] 2 3 ... 10
anything