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

Pages: [1]
1
Graphics / Re: Drawing Pixelated Shapes
« on: January 12, 2018, 04:18:12 pm »
Thanks. the shader is probably what I'm looking for, can't believe that I forgot those were a thing. I'll look into using a sf::RednerTexture too, but teh shaders probably what I need.

2
Graphics / Re: Drawing Pixelated Shapes
« on: January 12, 2018, 01:01:49 am »
That window is done using 0 as the antialiasing. In a moment I will post the code.

Edit:
The code:
#include "SFML\Graphics.hpp"


int main()
{

        sf::ContextSettings contSettings{};
        contSettings.antialiasingLevel = 0;

        sf::RectangleShape rect{ sf::Vector2f{ 150, 1 } };
        rect.setPosition( 500, 500);
        rect.rotate(32);

        sf::RenderWindow window{};
        window.create(sf::VideoMode{ 1080, 720 }, "BoxT", sf::Style::Default, contSettings);
        sf::View view{};
        view.zoom(.25);
        window.setView(view);

        while (window.isOpen()) {
                window.clear(sf::Color::Black);
                window.draw(rect);
                window.display();

                sf::Event ev;
                while (window.pollEvent(ev)) {
                        if (ev.type == sf::Event::Closed) {
                                window.close();
                        }
                }
        }

    return 0;
}
 

produces:

3
Graphics / Re: Drawing Pixelated Shapes
« on: January 11, 2018, 04:26:00 pm »
How'd that happen? Oh well, I fixed it, apologies for the inconvenience. Images are bigger than I though, but I don't have time to shrink them, rn, sorry. Thanks for the help.

4
Graphics / Drawing Pixelated Shapes
« on: January 11, 2018, 09:15:38 am »
I was wondering how I'd use the libraries to draw pixelly things without using a sprite, so I decided to start with a line. I tried drawing a line, using a rotated 1 pixel tall sf::RectangleShape, and then zooming into it using a view, and I got this:


Whereas what I want is more like this:


I'd also like to be able to draw circles and other shapes, and even render and rotate sprites like this if possible, but I figured I'd try with a line first to figure it out.

Its probably something simple. Regardless, I tried looking at other threads, but I wasn't sure what exactly to call this, and my searches came up with nothing. Anywho, thanks in advance for the help!

5
Graphics / Re: Sprite Movement Freezing/Jittering
« on: November 22, 2016, 02:22:31 am »
I have a nvidia geforce I think. Where is multithreading? Does it have anything to do with "thread optimization"? I went into the nvidia control panel and that's all I saw. Thanks for the help!

Update: Also, thread optimization was set to "Auto." I set it to both on and off, and ran the test. Both resulted in no change.

Update: I had to restart my pc for something, and the jittering stopped. I must have had something running that was slowing the pc. Next time I'll check what's running, thanks for the help!

6
Graphics / Sprite Movement Freezing/Jittering
« on: November 22, 2016, 12:34:57 am »
Hey so, I'm kinda new here, and I've been dinkin' around for a few weeks to try and get the hang of this. I noticed that what I've made so far (a pong clone from this: http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx tutorial and another simple program from scratch) had a wierd freezing/jittering every have second or so. I decided to write a new program from scratch to see if it was present there. Sure enough, about every half second or so the sprite would freeze and then update to where it should be. Any ideas? Here's the code for the test program:
// y.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "SFML\Graphics.hpp"


int main()
{
        sf::RenderWindow window(sf::VideoMode(720, 720), "hey");
        sf::Event event;

        sf::Texture texture;
        sf::Sprite sprite;
        texture.loadFromFile("images/box.png");
        sprite.setTexture(texture);
        sprite.setOrigin(sprite.getGlobalBounds().width / 2, sprite.getGlobalBounds().height / 2);
        sprite.setPosition(360, 700);
        while (window.isOpen()) {
                window.pollEvent(event);
                switch (event.type) {
                case sf::Event::Closed:
                        window.close();
                        break;
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
                {
                        sprite.move(-0.005, 0.0);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
                {
                        sprite.move(0.005, 0.0);
                }
                window.clear(sf::Color::Black);
                window.draw(sprite);
                window.display();
        }
        return 0;
}
 


I did some google searching and wasn't able to find a solution. Its probably super simple, sorry in advance for the trouble.

Pages: [1]