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

Pages: [1] 2
1
General / Re: Problem with storing generated pixel locations
« on: April 17, 2016, 08:56:40 pm »
Thank you very much ShadowMouse! I'm trying get into algorithm making, but this I just couldn't figure out.  :)

2
General / Re: Problem with storing generated pixel locations
« on: April 17, 2016, 05:11:12 pm »
Quote
I'm fairly sure the problem is knowing which pixels have been modified, not modifying the pixels themselves, in which case, I think you are going about it wrong. If you want to make pixels expanding out from the centre, just make a diamond shape of different sizes around the central pixel. e.g. first you start with a pixel x,y then you make a loop that does (x+1,y),(x-1,y),(x,y+1),(x,y-1), then make a loop that does (x+2,y),(x+1,y+1),(x,y+2),(x-1,y+1),(x-2,y),(x-1,y-1),(x,y-2),(x+1,y-1), etc.

EDIT: unless of course you do actually want to store all modified pixels and have the function go on forever as each one modifies all the ones around it, which will never stop.

Since I'm trying to create a image of 700 by 700, is there a way to do this automaticly? Otherwise my program would become huge.

EDIT: By the way, thank you. This is what I'm trying to do, but I will need to make something that can write the code you suggested for me

3
General / Re: Problem with storing generated pixel locations
« on: April 17, 2016, 02:34:14 pm »
I understand how to store the pixels color, but I'm wondering what would be a good way to store the location of the (newly generated) pixels. I'm already storing pixels in a sf::Image to create a texture by the way

4
General / [SOLVED] Problem with storing generated pixel locations
« on: April 17, 2016, 07:12:31 am »
So, I'm trying to create semi-random pixels, with the middle of the window as a starting point. My only problem is, that I need to store the x and y-axis of the new pixel that I generate.

So say, I have a single pixel (5, 5). Then first I want to generate a layer around that pixel (4,5), (5,4) (5,6) and (6,5) (I know how to do this). But after this, I want to generate a simular layer around the new pixels, and I would need to store there locations, and the locations of all pixels to come. Is there an easy way to to this? Because I wouldn't know of any on this scale. (I'm creating a image of 700 by 700 pixels)

Thanks for any help!

5
Graphics / Re: Pixel Drawing - 0- or 1-based?
« on: April 16, 2016, 10:41:46 am »
Having the same issue, but my theory is that Windows 10 draws over the top pixel of a program

6
Graphics / Question about sf::Image
« on: April 16, 2016, 10:40:24 am »
Is there a way to export an sf::Image as a .png (or any other image format)?

7
General / Re: Exception Thrown when trying to run program
« on: April 11, 2016, 04:33:45 pm »
I'm stupid as sh*t... I meant the second one to be white. Thanks for the help guys!


Edit:

Everything's working now. Thanks again!

8
General / Re: Exception Thrown when trying to run program
« on: April 11, 2016, 04:30:21 pm »
One more thing... It is running now, but I only get to see a black screen. Any ideas?

9
General / Re: Exception Thrown when trying to run program
« on: April 11, 2016, 04:21:27 pm »
Thanks!

10
General / Exception Thrown when trying to run program
« on: April 11, 2016, 04:15:31 pm »
Code: [Select]
#include "SFML\Graphics.hpp"
#include <random>
#include <ctime>

int main() {
   srand(time(NULL));
   sf::RenderWindow TestingWindow(sf::VideoMode(100, 100), "Testing Window");
   sf::Image img;
   sf::Texture txt;
   sf::Sprite spr;
   int x = 1, y = 1, z;
   while (y < 100){
      while (x < 100) {
         z = rand() % 2 + 1;
         if (z == 1) {
            img.setPixel(x, y, sf::Color::Black);
         }
         else {                                 
            img.setPixel(x, y, sf::Color::Black);
         }
         x++;
      }
      x = 1; y++;
   }
   txt.loadFromImage(img);
   spr.setTexture(txt);
   while (TestingWindow.isOpen())
   {
      sf::Event event;
      while (TestingWindow.pollEvent(event))
      {
         if (event.type == sf::Event::Closed)
            TestingWindow.close();
      }

      TestingWindow.clear();
      TestingWindow.draw(spr);
      TestingWindow.display();
   }
}


So.... I'm trying to run this program, and it should be creating a sort of fuzz you see on a faulty television, but everytime I run the program, this exception is thrown.

Unhandled exception at 0x6B8C5C98 (sfml-graphics-2.dll) in SFML 2.0 APPLICATION.exe: 0xC0000005: Access violation writing location 0x00000004.

Is there something I can do to fix this?


(And yes, I know there is a lack of comments. I'm trying to put more in my code, but I keep forgetting because I'm the only one who reads it)

11
Graphics / Re: sf::Sprite.getTexture() Help?
« on: January 02, 2016, 01:51:23 pm »
I'm so f*cking stupid... Thanks a lot for the help anyways, even though i'm a stupid twat.
Even though I answered your question (twice), I'm feeling generous.

(click to show/hide)

I'm so stupid. Thanks anyways for the help, hope this works wel XD.

12
Graphics / Re: sf::Sprite.getTexture() Help?
« on: January 02, 2016, 01:15:08 pm »
I'm trying to see if two textures are the same. The base texture (the texture itself) and the texture that is assigned to the sprite. I don't know how I would do this, mainly because I don't understand what the .getTexture returns and how to use it for a comparison.

13
Graphics / Re: sf::Sprite.getTexture() Help?
« on: January 02, 2016, 12:37:29 pm »
AMD A6-6310 APU, Windows 10. SFML 2.3. Visual Studio 2015 community. Everything else works fine, i'm just wondering how .getTexture could be used in an if-statement, and searching for it doesn't help.

14
Graphics / (SOLVED) sf::Sprite.getTexture() Help?
« on: January 02, 2016, 10:05:39 am »
Can someone show me how you would be able to do something like this?

Code: [Select]
if (Sprite[i].getTexture() == Texture) {
                      //code
}

I just can't get it to work.
Thank you for any help!

15
General / Re: Why is sf::String removing unknow ascii characters ?
« on: December 31, 2015, 01:55:17 pm »
Isn't there the L modifier? I'm not sure...

Pages: [1] 2