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

Pages: [1]
1
Graphics / Re: Problems with Struct pointers that contain textures
« on: August 04, 2018, 07:16:04 am »
I really don't believe that making one post in my life on a forum is getting help from people all the time anyway.

And I do really think that I know what a class is and what a struct is, specially, I don't think that not using the new operator gives you the right to say that I don't know how to program, as I said, I'm used to use malloc, and I learn by doing projects anyway.

When tried to call the constructor for the array indexes after the first new call, made a strange behavior and some error like this was appearing:




But I got through this, just made some function which does the same thing as a constructor and called it for the array instead the constructor.

2
Graphics / Re: Problems with Struct pointers that contain textures
« on: August 03, 2018, 11:37:00 pm »
Well, I read it again, and the documentation never said that one can't use malloc instead of new, the only difference is that you will need to call the constructor separately, as malloc just allocates memories.

I tried doing with

wn::Item* it = new wn::Item[3];
it[0] = wn::Item(100, 100);

And it still give errors:

It is giving GL internal error in Texture.cpp 93
(If I remember, there was something about glFlush in the console log)

After my researches about these GL Internal error, it usually the drivers of the person the problem, but I don't see any potential error with my drivers, they are all updated and stuff, anad my graphic card is in one of the latest versions

PS: Saying for people to learn a language instead doing projects is a disservice for people who learn by doing programming, one does not learn how to apply the knowledge without needing to apply, if I started before learning sfml instead studying the language, I would be much better at the API and at the language than today

3
Graphics / [SOLVED]Problems with Struct pointers that contain textures
« on: August 03, 2018, 09:30:35 am »
Hello, I'm having problems with structure pointers, when I declare simply a structure without a pointer, I can freely draw it onto my screen.

Now, when I try to do like where it is commented,  it gives a SIGSEV error after I load the image inside the texture place, at the it[0] assignment, but I don't understand why, as I do always like this when I want to make a dynamic array.
ps: The image is correctly loaded.

This is just a simple example, as my entire class got one realloc function for it, but the problem is inside this struct.


Just another plus question:
Why did I needed to declare a sf::Vector2f for the size? When I tried using without the new variable, eg:
this->spriteView.setScale(width / t.getSize().x, height / t.getSize().y) it wasn't really scaling anything, the getScale function was returning 0 for the values

Pages: [1]