Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
Drawing sprites on screen issue [SOLVED]
Print
Pages: [
1
]
Author
Topic: Drawing sprites on screen issue [SOLVED] (Read 2476 times)
0 Members and 1 Guest are viewing this topic.
solver
Newbie
Posts: 12
Drawing sprites on screen issue [SOLVED]
«
on:
July 23, 2012, 08:42:54 pm »
Hello. I have a question: what method i must use to put sprites on screen? I know 3:
Draw sprites on texture, and then draw texture on screen
Draw by passing main "sf::RenderWindow App" into MyClass::Draw (sf::RenderWindow &App)
Inheritance of the sf::Drawable class by MyClass, and drawing it by common way
I have not found the answer on the forum and other websites. Sorry for my english. Thanks.
«
Last Edit: July 24, 2012, 12:06:12 pm by solver
»
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11033
Re: Drawing sprites on screen issue
«
Reply #1 on:
July 23, 2012, 08:47:13 pm »
What exactly is your problem?
You draw a sprite by calling
window.draw(sprite);
as it is documented in every graphical example (e.g.
here
).
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
solver
Newbie
Posts: 12
Re: Drawing sprites on screen issue
«
Reply #2 on:
July 23, 2012, 09:59:51 pm »
Ok. For example, I want to draw grid and I want to use function to do this job. At the first time I use this:
void
draw_grid
(
sf
::
RenderWindow
&
App
)
{
/*Some code*/
App.
Draw
(
line
)
;
/*...*/
}
Another 2 methods I descibed in my first post.
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11033
Re: Drawing sprites on screen issue
«
Reply #3 on:
July 23, 2012, 11:56:27 pm »
I advice you not use SFML 1.6 anymore but to switch to SFML 2rc.
What is your issue with that code?
I don't understand what your problem is. Are you asking for the 'best' solution? Or is there an actual problem?
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
solver
Newbie
Posts: 12
Re: Drawing sprites on screen issue
«
Reply #4 on:
July 24, 2012, 09:02:29 am »
>Are you asking for the 'best' solution?
Yes. This is exactly what I was looking for.
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11033
Re: Drawing sprites on screen issue
«
Reply #5 on:
July 24, 2012, 11:09:11 am »
There's no such thing as a 'best' solution. This highly depens on your code design and needs. If the current method works then go with it.
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
solver
Newbie
Posts: 12
Re: Drawing sprites on screen issue
«
Reply #6 on:
July 24, 2012, 12:05:50 pm »
Thanks. Now I can start refactoring.
</tread>
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
Drawing sprites on screen issue [SOLVED]
anything