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 - Stauricus

Pages: 1 2 [3] 4 5 ... 25
31
the only thing I can think of without further information or any code is that since your view goes from 0,0 to window size, sprites in negative position will be outside the view and therefore will be drawn where they cannot be seen.

32
Graphics / Re: Text file to tilemap, where to start?
« on: October 24, 2022, 09:08:18 pm »
At this point I am only left with turning those numerical values of the textures into chars, so map.txt can be read properly

Yeah, you can do that or map the texture coordinates manually. but it will take a looot of time and may become messy. if you tile is 64x64 pixels, for example:

if (tile == "a"){
    quad[0].texCoords = sf::Vector2f(0, 0);
    quad[1].texCoords = sf::Vector2f(0, 64);
    quad[2].texCoords = sf::Vector2f(64, 64);
    quad[3].texCoords = sf::Vector2f(64, 0);
}
if (tile == "b"){
    quad[0].texCoords = sf::Vector2f(64, 64);
    quad[1].texCoords = sf::Vector2f(64, 128);
    quad[2].texCoords = sf::Vector2f(128, 128);
    quad[3].texCoords = sf::Vector2f(128, 64);
}

//etc

 

33
Graphics / Re: Text file to tilemap, where to start?
« on: October 24, 2022, 12:46:51 pm »
first let me say that this is not a good idea at all. your first line has 9 characters, and (because dots have a smaller size) your second line has 20. walls won't match in position, unless you are creating your tilemaps in a monospaced font..

but if you really want to do that, you'll have to convert each character to textCoord in the tileset (in the example from the link) instead of just using the tile number itself for the calculations.

i'd suggest you to use a tilemap creator, like Tiled, and export your map to numbers...

34
that can happen when tiles are sized as floats instead of integers

35
Graphics / Re: Jittery 98 sprites
« on: August 15, 2022, 04:46:19 pm »
do you have v-sync activated? v-sync and setFramerateLimit don't work well together.

36
General / Re: i need video tutorial now please!
« on: July 30, 2022, 06:23:27 pm »
there are a lot of video tutorials on YouTube. nothing special.
although videos are not really recomended for programming learning. they get outdated too quickly, and many content creators don't really care to fix errors in their recordings.

i'd sugest the official tutorials

37
Graphics / Re: VertexArray accepts coordinates one beyond?
« on: June 07, 2022, 02:18:57 pm »
Quote
I assumed that such a request would go 1 pixel beyond the width & height
what width & height are you talking about? I don't know if I really got your question here

some considerations that may be what you're looking for:
-the VertexArray quad size doesn't have to be the exact size of the original texture. you can use a texture sized as 32x32 and a VertexArray quad like 120x57. things will just be stretched accordingly, kinda like wallpapers can be stretched in a monitor. this is also true for sprites.
-for texCoords, if you use a coordinate bigger than the texture itself, it will just loop around. if the texture file size is 200x50, and you use textCoord set in 210x50, it wil simply be set to 10x50.

38
Graphics / Re: TextureRect sometimes rendered wrong
« on: June 04, 2022, 05:27:28 pm »

39
System / Re: sf::clock dont work inside a class
« on: May 21, 2022, 10:05:11 pm »
what!? no, don't need to add it as static (unless, of course, you want many objects from the class to use the same clock). are you used to program in Python or something? it's different in C++
just move the clock outside the funcion, but still inside the class, something like this:

class Rect {

sf::Clock cl1;

public:

        Rect() {}


        void RectOnClick(int Mousex, int Mousey) {
               
                Lemon_Milk.loadFromFile("C:/Users/Felipe Palermo/source/repos/sfmllearn/sfmllearn/LEMONMILK-Bold.otf");

                static int contagem = 1;
                bool LockClick = false;



                if (sf::Mouse::isButtonPressed(sf::Mouse::Left) && LockClick == false) {
//the rest of the code is the same

40
System / Re: sf::clock dont work inside a class
« on: May 21, 2022, 09:00:11 pm »
you are creating a new Clock everytime 'RectOnClick' is called. try moving sf::Clock cl1 outside the RectOnClick function.

41
General / Re: C++ cannot open source file
« on: May 16, 2022, 05:52:34 pm »
the source files. have a check if the path is correct, it contains the SFML folder twice in your error:
C:\Users\Mert\source\repos\SFML\SFML\SFML.cpp

try to include files in your source code just with
#include "Graphics.hpp"

OR

change the configurations from Visual Studio to look for header files in the path "C:\Users\Mert\source\repos\" instead of "C:\Users\Mert\source\repos\SFML\".

42
General / Re: C++ cannot open source file
« on: May 15, 2022, 03:01:54 pm »
well, simply put, Visual Studio isn't finding the header file Graphics.hpp.
in what folder exactly did you put the SFML headers and etc? can you show us the complete folder path?

43
Graphics / Re: Can't draw 2 big textures
« on: May 02, 2022, 06:51:28 pm »
unless you have a 32k monitor (does it even exists?), there is no point in using a texture that big in this case.
anyway, the bottleneck would be your own computer. and a bottleneck in people helping you is that many swear words.
also, we have no idea whats inside rika.paint(), so there is not much we can help. you didn't post any code at all.

anyway, have you tried a complete and minimal working example? just a simple program drawing two big textures at once?

44
General / Re: Sprite.move()
« on: April 21, 2022, 10:35:52 pm »
are you sure the sprite isn't moving at all? have you tried checking its position every frame?
you may be moving the sprite and the view at the same time, and not noticing the movement?

also, one thing that seems weird to me is that you are checking if the keyboard is pressing LEFT, and checking if the pos.x is bigger than view.x (doesn't bigger means that its to the right side of the view?)

45
General / Re: SFML shows error squiggles even though it works
« on: April 12, 2022, 12:58:19 pm »
well, you need at least to post what these errors are
probably not errors, but warnings

Pages: 1 2 [3] 4 5 ... 25
anything