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

Pages: 1 2 [3] 4
31
Window / Game engine object "owning" a window?
« on: January 30, 2011, 11:01:35 pm »
I'm not sure what to make of these non copyable resources. I'd like my Engine object to own a window and be in charge of that window for the entire duration of the game. I could make the window a global value but this is frowned upon I'm told. Instead I wanted to make an game Engine class that manages resources.

The following code won't work apparently.

Code: [Select]


class Engine
{
    public:
        Engine();
        ~Engine();

        //SFML members
        sf::RenderWindow my_window;
        list<Player> player_list;


};


// methods
Engine::Engine()
{
        my_window = sf::RenderWindow(sf::VideoMode(640, 480, 32), "Assult Match"); // this cannot be assigned

        my_window.Clear(sf::Color(0,255,64));
        my_window.Display();
};

Engine::~Engine()
{

};

32
General / Code::Blocks & Windows XP libgcc_s_dw2-1.dll
« on: January 30, 2011, 12:46:42 am »
I just noticed that Code::Blocks has a feature to "create a new SFML Project". Is this a shorter way to configure everything? It asks for a SFML path during the creation process but I'm not sure what folder to give it. If I just give it the path to. This seems like an ideal solution if it works well. I would love to have the compiler set the proper directories at the start of a project.

My current try gave an error.
http://img266.imageshack.us/img266/5636/hmmmy.png

33
General / Code::Blocks & Windows XP libgcc_s_dw2-1.dll
« on: January 30, 2011, 12:26:30 am »
Thank you very much. It appears to be working as intended now. I've selected Code::Blocks because I want to make the finished code portable.  :P

34
General / Code::Blocks & Windows XP libgcc_s_dw2-1.dll
« on: January 30, 2011, 12:17:06 am »
Here is the error I am getting.

I've followed the tutorial but come up short with the following. I'm compiling it on Windows after using Ubuntu before. Do I need to build something? I know that in the tutorial there was mention of downloading a MinGW 4.4 file but the tutorial does not tell what to do with it.


http://img9.imageshack.us/img9/3066/helpsf.png

35
Window / Screen has no synchronization.
« on: January 14, 2011, 06:03:27 am »
Certainly, I don't know what I was thinking not posting code too.

Code: [Select]


#include <SFML/Graphics.hpp>

int main()
{
    // Create the main window
    sf::RenderWindow App(sf::VideoMode(800, 600),"nothing");
    App.SetFramerateLimit(60);

// Start the game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            if (Event.Type == sf::Event::MouseMoved)
                App.Close();

            if (Event.Type == sf::Event::KeyPressed)
                App.Close();

        }

        // Clear screen
        App.Clear();

        // Draw the sprite
        for(int i = 0; i < 100; i++)
        {
            sf::Shape new_shape = sf::Shape::Circle(rand() % 800, rand() % 600, rand() % 32 + 32,sf::Color(rand() % 255, rand() % 255, rand() % 255, 128));

            if(rand() % 2)
            {
                new_shape.SetBlendMode(sf::Blend::Add);
            }

            App.Draw(new_shape);
        }
        // Update the window
        App.Display();
    }

    return EXIT_SUCCESS;
}


I was told earlier that SetFramerateLimit() should not be used with UseVerticalSync(). Ideally I want my game to both render at 60 frames per second and also not tear the screen because verticle synching is not enabled. I want the events in the game to be locked into cycles rather than time so even when frame rate changes from machine to machine game events will be on a per frame update basis.

36
Window / Screen has no synchronization.
« on: January 14, 2011, 03:50:25 am »
What is the proper way to set the refresh rate to 60 frames per second and also ensure there is no screen tearing? I seem to recall the two functions "don't get along".

This is the problem:
http://img834.imageshack.us/img834/7626/screenshotsu.png

37
Window / Ideas for making user defined controls?
« on: January 09, 2011, 11:43:03 pm »
Thanks for the ideas. Things get a little tricky with this kind of stuff.

38
Window / Ideas for making user defined controls?
« on: January 09, 2011, 03:57:28 am »
Within the limits of C++ what would be a good way to give each instance of a Player type object configurable controls? This question has come while designing my video game because sometimes a player might want to use a joypad and other times they might want to use a keyboard. If I create a two player game and only one player has a joystick one will be forced to use the keyboard and this needs to be dynamic because input hardware changes from computer to computer.

So given a basic player class how should they store and react to custom control schemes? I certainly cannot have the same input methods for players 1 and 2 even though they both control an instance of a Player object.

39
Graphics / How might I implement a "subtraction" blend mode?
« on: January 05, 2011, 10:39:05 am »
Thanks Laurent.

I just wanted to make sure that I wasn't missing something.

40
Graphics / How might I implement a "subtraction" blend mode?
« on: January 05, 2011, 09:23:54 am »
While looking through the SFML tutorials, I've noticed that it offers some blending modes. I was wondering if it is possible to create a blending mode that subtracts the values of the source from the destination? Is there a way to do this for a Sprite? I know an entire shader can be written but is there a way to do such a thing for just one Sprite object? I'm trying to create the effect of transparent material layers that darken. Something like how stacking colored plastic sunglasses lenses gives a darker result.  8)

41
Graphics / SFML line drawing method produces odd results...
« on: December 31, 2010, 11:45:36 pm »
Ah OK, that explains how lines can have a width component. If they are indeed treated as rotated rectangles that would explain the odd thick sections. I may have to find a workaround for proper 1 pixel lines it seems. I'm going to get around to OpenGL more but getting a handle on SFML seems to be enough right now. Thanks for the clarification.

42
Graphics / SFML line drawing method produces odd results...
« on: December 31, 2010, 09:45:42 pm »
I've noticed that drawing angular lines in SFML often produces lines of inconsistent width. Shown below, some of the lines have odd double pixel thick areas which occur during certain angles. These lines are drawn with a 1.0 thickness value.


43
General discussions / SFML's OOP handling of primitives.
« on: December 31, 2010, 10:45:33 am »
I know I've touched on this briefly before but I am curious about primitives being objects. I can see polygons as objects because most of the time the programmer needs to store points and data. Lines seem a bit odd however to make objects for a graphics library.

I've been pondering making a game with line style graphics (like we see in the 80's). It seems like kind of a waste to keep beating on the RAM frame after frame making multiple calls to create line objects just to have an image. I can understand sprites and polygons being good objects to model with static data but perhaps we could be given lower level access to simply drawing directly to the window without creating many many simple line objects? It seems a bit wasteful to have to store a line in memory just to render it to a window.

I'm just curious about the need for objectless drawing commands for more simple and dynamic shapes that must be constantly changed.

I'm very new to SFML so I don't have a lot of room to speak, I'd just like to know if there is any interest in directly rendering to a window without storing data in an object first.

Speaking of drawing directly to a window, is there a possibility of using fast raster warping and distortion effects without dabbling into OpenGL?

Thanks

44
General / SFML 1.6 files for Microsoft Visual C++ 2010
« on: December 23, 2010, 07:49:28 am »
I was just thinking somebody should post the compiled files. It is really a pain that Microsoft had produced an IDE that cannot interact with prior files totally.

I started out using Dev-C++ (like every other n00b). I switched to Visual C++ 2010 just to use this library. Is this the way Microsoft has been doing these things? Shooting all the programmers in the foot each time a new IDE is released?

Anyway I wish I had this topic earlier, the video on Youtube is helpful enough but it would be great to have this file added to the installation section of the main site. Rebuilding the 2008 version is a bit of a hassle. Especially when one is new to Visual C++ 2010.

45
General / Please evaluate my code for correctness + Visual C++ 2010
« on: December 18, 2010, 09:43:07 am »
Thanks again for your dedication.

I'm still trying to get a handle on how the events are bound to the window. If an object needs to check for an event they must first go through the window correct?

Does this mean that every game element that checks for events needs to have a pointer or reference to an event generating window?  :idea:

Pages: 1 2 [3] 4
anything