Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: I need to draw shapes and save to a file  (Read 2631 times)

0 Members and 1 Guest are viewing this topic.

Tigre Pablito

  • Full Member
  • ***
  • Posts: 226
    • View Profile
    • Email
I need to draw shapes and save to a file
« on: August 12, 2016, 10:54:16 pm »
hi people from SFML

I need to draw a black square with a white (with alpha set) circle inside it and then save that to a file. I need this to make a light effect on my Super Mario game.  :D

I tried with image, circleshape, but wasn't able to find a method that pastes or draws the circle to the image. I know i could do this (without SFML) with window forms and .Net but i'm upset of Sin, Cos, and those.

Can you give me some code example?
Thanks  :)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: I need to draw shapes and save to a file
« Reply #1 on: August 12, 2016, 11:14:26 pm »
Draw to a render texture (see tutorial), copy to image (see documentation of sf::Texture), save image to disk.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Tigre Pablito

  • Full Member
  • ***
  • Posts: 226
    • View Profile
    • Email
Re: I need to draw shapes and save to a file
« Reply #2 on: August 13, 2016, 03:00:36 am »
Thanks, eXpl0it3r!

I solved the issue

 

anything