Can anyone guide me regarding implementation of data structures using SFML?

Hello! I have been assigned a project to implement arrays, linked list and hashing using SFML on visual studio. I have applied the required setting for sfml on my visual studio.

A data structure is just data and algorithms used on that data. SFML is a multimedia library. The two are orthogonal.
Are you saying you want a visual representation of data structures using SFML?

Before trying to combine data structures and SFML, the first thing would be to make sure you understand them independently. Have you written data structures, like your own linked list? And do you know how to draw basic shapes using SFML? I would take those two topics separately, practice with it, and then once you understand them as separate concepts, attempt to combine them.

I'm also not sure what "implementing" an array even means, unless you mean the visual representation of it, which could just mean a row a rectangles that you then draw. If anything, I would start with that: Just draw N rectangles in a row in SFML.
Last edited on
Yes! A visual representation is what I mean!
This is what I have done so far. It's printing a square on-screen. No idea how to make multiple squares as entered by the user.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
using namespace std;
#include <SFML/Graphics.hpp>

int main()
{
	sf::RenderWindow window(sf::VideoMode(512, 512), "Rectangle", sf::Style::Close | sf::Style::Resize);
	sf::RectangleShape player(sf::Vector2f(50.0f, 50.0f));

	while (window.isOpen())
	{
		sf::Event evnt;
		while (window.pollEvent(evnt))
		{
			switch (evnt.type)
			{
			case sf::Event::Closed:
				window.close();
				break;
			case sf::Event::Resized:
				cout << "New window width : " << evnt.size.width;
				cout << "New window height : " << evnt.size.height;
				break;
			case sf::Event::TextEntered:
				if (evnt.text.unicode < 128)
				{
					cout << evnt.text.unicode;

				}
			}

		}
		window.draw(player);
		window.display();
	
	}
	return 0;
}

Topic archived. No new replies allowed.