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

Pages: [1] 2 3 4
1
General discussions / Re: SFML Game Development -- A book on SFML
« on: September 03, 2013, 04:35:34 am »
Just bought the book, I am excited to see what I can learn from it. Always amazed by the support SFML has.

2
Graphics / Re: New coordinates based on view
« on: September 02, 2013, 09:21:59 am »
After tweaking a few things, the issue finally worked itself out so thanks for the help!

3
Graphics / Re: New coordinates based on view
« on: September 02, 2013, 04:48:11 am »
Awesome that worked perfectly for the sample but for my actual program I am still getting the same results. Bleh I hate programming lol.

4
Graphics / New coordinates based on view
« on: September 02, 2013, 04:18:39 am »
So the problem is that I am trying to click on the window to place an object on the screen. It works perfectly until I add views.

When I move the view to the right 100 pixels and click on the position of (300, 300), then the object is moved to the new view coordinates of (200, 300). I need the object to be drawn to the new view coordinates of (300, 300). I have experimented with the mapCoordsToPixel function but I can't get it working.

Here is the sample code:
Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
sf::RenderWindow window(sf::VideoMode(600, 400), "View");
window.setFramerateLimit(60);

sf::CircleShape circle;
circle.setFillColor(sf::Color::Black);
circle.setRadius(15);

sf::View view = window.getView();

while(window.isOpen())
{
sf::Event event;

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

if( event.type == sf::Event::MouseButtonReleased && event.mouseButton.button == sf::Mouse::Left )
{
circle.setPosition(sf::Mouse::getPosition(window).x, sf::Mouse::getPosition(window).y);
}

if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left) || sf::Keyboard::isKeyPressed(sf::Keyboard::A))
view.move(-5.f, 0.f);

if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right) || sf::Keyboard::isKeyPressed(sf::Keyboard::D))
view.move(5.f, 0.f);

if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up) || sf::Keyboard::isKeyPressed(sf::Keyboard::W))
view.move(0.f, -5.f);

if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down) || sf::Keyboard::isKeyPressed(sf::Keyboard::S))
view.move(0.f, 5.f);

window.clear(sf::Color::White);
window.setView(view);
window.draw(circle);
window.display();
}

return 0;
}


5
General discussions / New naming convention
« on: January 20, 2012, 06:40:43 pm »
I agree, the get/is prefix is very useful and I've never thought that it made the library look unprofessional or sub par compared to others. If anything it makes the library seem more simple to use and user friendly.

6
Graphics / Problem using static image and sprite variables
« on: January 12, 2012, 05:31:51 am »
Ah ok I see, good to know.

7
Graphics / Problem using static image and sprite variables
« on: January 11, 2012, 06:26:43 am »
Okay it's been a while since I've been programming but I'm back and I'm suffering from the same error. The thing is, when I use a static image or sprite variable, the program crashes and the "Lock.cpp" file is shown in Visual studio and the debugger points to
Code: [Select]

Lock::Lock(Mutex& mutex) :
myMutex(mutex)
{
    myMutex.Lock();
}


The program does not crash under release mode, ONLY debug. I am linking statically. Here is the code:

Code: [Select]

//example.hpp
#ifndef EXAMPLE_HPP_
#define EXAMPLE_HPP_

#include <SFML\Graphics.hpp>

class Example
{
static sf::Image image;
static sf::Sprite sprite;
};

#endif


Code: [Select]

//example.cpp
#include "example.hpp"

sf::Image Example::image;
sf::Sprite Example::sprite;


Code: [Select]

//main.cpp
#include <iostream>

int main()
{
}



Any advice is appreciated.

8
Graphics / static class with sf::Image/sf::Sprite member causes crash
« on: October 19, 2011, 08:30:16 am »
In my coding I have had problems with using static classes with sf::Image and sf::Sprite members.
When I comment out the variable, the program runs perfectly, but when the variable is a member of the static class, i get the mutex error:

Code: [Select]

myMutex(mutex)
{
    myMutex.Lock();
}


Oh and it runs fine in Release mode, just not Debug mode. Which leads me to believe it may be related to that damn ATI bug :evil:

What could cause this? I should probably post the code, i tried to replicate it in a small sample code but I haven't so far.

Edit: blah it is late, the ati bug doesn't have anything to do with debug/release i dont think.

9
Graphics / About images/sprites and alpha and getting an image color
« on: October 15, 2011, 06:59:03 am »
That's true, but what I'm really trying to do is set all of the barriers in a level to a single image.

That way I could just draw a single image, and i could just check collision against a single image. Though I'm not sure what kind of difference it would make.

I think I will just check against the individual barriers, but would it make much difference to have a separate image with all of the barriers copied to it and just draw that image?

10
Graphics / About images/sprites and alpha and getting an image color
« on: October 15, 2011, 03:33:16 am »
It is kind of hard to get an accurate title for this question.

Okay what I am trying to do is display a picture and lets say it is an empty square. It is simply just the outline of a square and the inside is transparent.

The sprite needs to be used to test collision, so the character can move freely inside where the picture is transparent, but the character can not move passed the colored walls.

Is it possible to get a position inside an image and tell if that spot is transparent or a specific color?

11
SFML projects / Legend of Dungeon
« on: June 30, 2011, 05:57:13 am »
I'd really like to try it out but this ATI driver bug prevents me from running the program. I have to reuninstall it.  :x

12
SFML projects / My 1st project xD
« on: June 12, 2011, 01:45:33 am »
I'd try it out but I don't have your images :P.

13
General / (Solved) Need help with errors after updating SFML
« on: May 29, 2011, 12:15:24 am »
Ok, I didn't use CMake to help setup SFML (I guess it is a requirement now?), but I just used it and got everything to work just fine. Thanks.

14
General / (Solved) Need help with errors after updating SFML
« on: May 28, 2011, 10:21:15 pm »
It is no problem Sir Demon, we have the same problem. I'm currently downloading MSVS 2010 to see if it works for me.

15
General / (Solved) Need help with errors after updating SFML
« on: May 27, 2011, 08:32:26 pm »
I'm not sure where that is or how to change it, but I haven't changed any settings since I updated SFML. One minute it was working and the next it wasn't. I have tried both static and dynamic libs though.

When I compiled SFML, i tried compiling certain libs to all libs to try out. I didn't try to change anything that I haven't done before :(.

Pages: [1] 2 3 4