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

Pages: 1 [2] 3 4 5
16
Hello,
I don't know if this should be in the "window help" section or here, but the problem i am presensting here, started when i wanted to get the Bounding boxes of my entities.

I made a class using vertices and wanted to get the bounding boxes through the function "getBounds" by inhereting the class from the "VertexArray" class, like this :
class VertexClass :  public sf::VertexArray, public sf::Transformable , public sf::Drawable
{
     private: /// ///////////////////////////////////////////
       sf::VertexArray V;
       sf::Texture Tex;
       virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const    {
        states.transform *= getTransform();
        states.texture = &Tex;
        //states.texture = nullptr;
        target.draw(V, states);
        }
     public:/// ////////////////////////////////////////////////////////////////////////////////////////////////
         bool VertexFunction(sf::Vector2f v0,sf::Vector2f v1,sf::Vector2f v2 ) //(...,PrimitiveType type)
        {
            V.setPrimitiveType(sf::Triangles);
              V.resize(3);

                V[0].position = v0;
                V[1].position = v1;
                V[2].position = v2;
                V[0].texCoords = v0;
                V[1].texCoords = v1;
                V[2].texCoords = v2;
        return true;
        }
};
 

One problem when calling the "draw" function :
//main
VertexClass VClass;
    VClass.VertexFunction(sf::Vector2f(200,200),sf::Vector2f(400,200),sf::Vector2f(400,400));

....
window.draw(VClass);
 

Error message is :
Quote
'sf::Drawable' is an ambiguous base of 'VertexClass'

I searched on the internet and found these solutions : https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.cbclx01/cplr138.htm

Maybe i did not get it but i tried the following options :
window.sf::Drawable::draw(VClass);
//or
window.sf::VertexClass::draw(VClass);
I tried then to modify the class declaration, and added "sf::Drawable" before the draw function declaration. Still have the problem..

1) So how do we solve this situation if anyone knows?
2) Is there a better method to get the bound box of my verticesClass? (This is way i choose to put the post in the graphics section of the forum).


17
The "next chapter" is the one about sf::Transform. This is a lower level class, more flexible than sf::Transformable, and thus it allows one origin for each transformation if you really need it.

https://www.sfml-dev.org/tutorials/2.5/graphics-transform.php#custom-transforms

Yes that's what i thought. Gotcha

18
General / Re: Free Textures/ images/ icons/ musics/ sounds /songs..
« on: April 20, 2020, 07:04:37 pm »
Yes i guess, it's just i thought i might get a complete list from some veteran who had already went through this steps.

19
SFML projects / Re: Bullet Hell Game
« on: April 20, 2020, 07:03:11 pm »
You should share some video so we can judge the music better.
Also, this forum has many "guests" know that your screen shots do not show only if a member is logged in, just for you information;)

20
Done.
You're mixing real-time input and events. Best to check "isKeyPressed" outside the event loop.

If you're using events, you can pair the KeyPressed event to the KeyReleased event.

But, if you're just using real-time input, you can do it like this:
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
    u = 1;
else
    u = 0;

Or shorter:
u = (sf::Keyboard::isKeyPressed(sf::Keyboard::Up) ? 1 : 0);

Oh much better, thank you Hapax :).

21
SFML projects / Re: My first coding program: Xenon
« on: April 20, 2020, 05:23:26 pm »
I like it,
Where did you get the "alien" and "alien ammo" images from? Did you make them?

22
General / Free Textures/ images/ icons/ musics/ sounds /songs..
« on: April 20, 2020, 05:12:10 pm »
Hello,
Do you have a list of websites where you can get your hands on free Textures, or any kind of images (small for chars to big for backgrounds). Same thing for sounds or musics?

I mean, material you can you use freely in a game that would sell.. someday.

23
SFML projects / Re: Project Arcanus
« on: April 20, 2020, 05:03:18 pm »
Hi all, i'm new to both SFML and the forums here, but wanted to share something I am currently working on.
I've been a developer now for around ten years, but I mostly work in web. I wanted to get my feet wet with C++ and Game Development after a long hiatus from doing anything related to game dev and was shuffled along to SFML by recommendation and so far, I love it.

I wanted to create something that would be fun to me and taking inspriration from games like Terraria, I decided to begin development of this project a couple of days ago.

So far, I have this:

If it's hard to see you can go to the direct link here: https://sykestech-cdn.fra1.cdn.digitaloceanspaces.com/rendering.png

Basically I have some very simple terrain generation, it's built of chunks, at the moment 10x10 of 16x16 blocks. Each chunk is 100 blocks in size.  I can render infinitely if I wanted, but at the moment I just render 100,000 blocks. To keep the app from slowing down, I load chunks in and out when they come within viewable range of the camera. You can move left and right, albeit very choppily.

This is very much a work in progress and something i'll be developing over the coming year in my spare time. I've created a public github: https://github.com/sykestech/arcanus, so feel free to look at my code and tell me off for anything I am doing that isn't quite right or could be improved. Also feel free to contribute if you wish.

Again, just wanted to share what I have and looking forward to hearing your feedback.

Thanks

Image link broken
Github link deleted.

24
Impressing,
So is there any SFML involved in the making?

25
Hello,

I) Once your SFML C++ game is done, coded, compiled and ready to play by using the .exe file,

1) How far are you from being able to put it on the Google App Store?
A) I know you have to pay few bucks, like 100€/$ a year?
B) I think you have to use something called android studio? Wrong?
C) You have to make sure you have no copyrighted material ? (music/images..)
D) ..

2) Making it into a flash game, is possible? Or do you have to had coded it in other langages?

II) What is the best strategy to advertise for your game?
A) Present it to some videogame website and ask them for a review? Or Youtuber/blog
B) Ask for SFML forum memebrs for support
C) Sell it for some company making games that would advertise it and get like a 50% cut revenues?
D) put for free and rely on "ad revenues" ?

26
SFML projects / Re: Bullet Hell Game
« on: April 20, 2020, 04:46:28 pm »
Looks very fun, the player is the black square?

27
Quote
Yes! I feel like all classe using Vertices will be inheriting from the transformable class at some point. Maybe there is a purpose having it separated from the other "shape" classes?
sf::VertexArray is a lower level class. It is not the final entity, but it is generally used by those to store their geometry. Making them inherit from sf::Transformable would make this base class redundant in every other drawable class.
The idiom is really to wrap this class (typically with a texture, shader, or whatever) in a higher level drawable / transformable class.
I can only imagine.
Quote
Quote
Humm really? i don't know i don't think so, it seemed like the tutorial said an example or an explantion on how to use the setOrigin to make a shape rotate around its center or other points
So you were talking about explanations on setOrigin itself? Not how to use multiple origins (one for each transformation)?
Both, because both points collide, making it rotate around itself = changing its origin, and giving it multiple origins for multiple transformations, means before every transformation go back the approriate Origin?
Anyway the tutorial says : "read the next chapters", was it referring to the advanced 3x3 matrix transform? Where are these "next chapters?"  ;D

28
Haha yes it's insane how i went astray, but happy to have found the road.
Quote
Do you mean sf::VertexArray?
Yes! I feel like all classe using Vertices will be inheriting from the transformable class at some point. Maybe there is a purpose having it separated from the other "shape" classes?
Quote
Nop. What error did you get?
I remember having a problem at some time, i definitely had, but i just tried again and no error;).

Quote
That was probably referring to sf::Transform.
Humm really? i don't know i don't think so, it seemed like the tutorial said an example or an explantion on how to use the setOrigin to make a shape rotate around its center or other points, will be given. But there were none. (But you know your tutorials better than me:p)

___

Finally, yes i understand that you can't teach C++ here, after all its not called "C++ tutorials" it's all about SFML.

Quote
Thanks for taking the time to do so, that's appreciated ;)
My pleasure ;D

29
Graphics / Re: Splitting the screen with sf::View
« on: April 19, 2020, 03:57:29 pm »
Found the solution !   :P
The draw function had to be written after the clear function, so i took them outside the "window.pollEvent" thing, and it worked

window.clear(sf::Color::White);


                                    window.setView(view3b);
                                    window.draw(RS);
                                    window.setView(view3bSave);
                                    window.draw(RS);



        window.display();

30
Graphics / (Solved) Splitting the screen with sf::View
« on: April 19, 2020, 03:51:03 pm »
Hello,
The non spiltted window shows as this :


The entity that is drawn is the grid, it is a rectangur shape called RS, you will see it mentioned at the end of post.

I try to split the screen in half by having 2 views in the same window like this  (view3b is the main view)
if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::D) // Double view
                  {
                                    sf::View view3bSave=view3b; // i save a copy of the main view)
                                   //   player 1 (left side of the screen)
                                    view3b.setViewport(sf::FloatRect(0.f, 0.f, 0.5f, 1.f));
                                    window.setView(view3b);
                                    // player 2 (right side of the screen)
                                    view3bSave.setViewport(sf::FloatRect(0.5f, 0.f, 0.5f, 1.f));
                                    window.setView(view3bSave);
                  }
 
And i get only the right part :


Then i read this post : https://en.sfml-dev.org/forums/index.php?topic=11526.0
Where it is expalained the "window.draw(world);" has to be done following each "setView".
I tried to draw the rectangular shape (the grid) RD, as following.

                  if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::D) // Double view
                  {
                                    sf::View view3bSave=view3b;
                                   //   player 1 (left side of the screen)
                                    view3b.setViewport(sf::FloatRect(0.f, 0.f, 0.5f, 1.f));
                                    window.setView(view3b);
                                    window.draw(RS);
                                    // player 2 (right side of the screen)
                                    view3bSave.setViewport(sf::FloatRect(0.5f, 0.f, 0.5f, 1.f));
                                    window.setView(view3bSave);
                                    window.draw(RS);

                  }

It did not work ! By the way here is the declaration of the main View :
sf::View view3b;
    view3b.reset(sf::FloatRect(0.f, 0.f, 800.f, 800.f));
// its the size of the window.
What am i missing?

Pages: 1 [2] 3 4 5
anything