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.


Topics - pighead10

Pages: [1]
1
SFML projects / Immortui - 2D top down zombie puzzle/shooter game
« on: June 29, 2013, 03:09:05 pm »
I've been working with SFML to create this zombie puzzler on and off for a few months, and it's now been released on Desura!

I was working with an SFML 2 RC and TGUI to create this game, so as I neared the ending I tried to upgrade to the latest SFML and TGUI with success. Unfortunately I did not manage to port to linux or Mac. My lack of any experience with linux made compiling it extremely difficult for me, and once I had finally worked out how to use linux and its compilers, my code would compile but not run from some memory error. I did not port to mac because the mac I was going to compile everything on actually (physically) broke the day before I was going to!

If you are interested, check out the game's site. As I mentioned the game is on Desura and this site has a link to the Desura purchasing.
http://immortui.hogpog.co.uk


2
Graphics / Sizing RenderTexture resizes graphics
« on: October 29, 2012, 02:51:57 pm »
As I am using multiple views of the same screen I am drawing to a RenderTexture, which I then draw to the RenderWindow. At the beginning of my program the RenderTexture is created to twice the size of the window. I was expecting my rendering area to be increased (e.g. so the size of  the window was 600x600 but I could render to this texture at (800,800) ), but instead when I draw all my graphics were scaled up - so my 32x32 sprites became 64x64, and the positions were scaled - creating the RenderTexture double the size just stretched it.

Here is what I'm doing each rendering frame (in pseudocode):
rendertexture.clear()
window.clear()
rendertexture.setView(view)
rendertexture.draw(all)
rendertexture.display()
window.draw(rendertexture)
window.setView(minimap)
window.draw(rendertexture)
window.display()

I'm trying to have the minimap display the same screen as the main view except the area that is shows is double the size. If the RenderTexture didn't stretch I would be able to do this (SFML 2, but not the most up to date version).




3
Graphics / Drawing darkness around player
« on: October 15, 2012, 09:58:25 pm »
I have read a thread about this: http://en.sfml-dev.org/forums/index.php?topic=9320.0 but, even after looking at the example, I am unable to add this into my game.

I want a circle of just transparency - no white borders, or any pretty effects - to follow the player. The darkness layer will not always be present, as it needs to slowly fade in/out, so the rectangle which the circle is drawn on needs to be black and the same opacity as the darkness layer.

Here is what I have so far:

//class Darkness
sf::RenderTexture m_Layer;
        sf::RenderTexture m_lighttexture;
        sf::Sprite m_Sprite;
        sf::Sprite m_light;

/////
m_Layer.create(view->getSize().x,view->getSize().y);
        init_light();

void Darkness::init_light(){
        m_lighttexture.create(100,100);

        m_lighttexture.clear();

        sf::CircleShape temp(50);
        temp.setOrigin(50,50);
        temp.setFillColor(sf::Color(255,255,255,0));
        temp.setPosition(sf::Vector2f(50.f, 50.f));
        m_lighttexture.draw(temp, sf::BlendNone);

        m_light.setTexture(m_lighttexture.getTexture(),true);
        m_light.setOrigin(50,50);
}

and

void Darkness::render(){
        m_Layer.clear(sf::Color(0,0,0,opacity));
        if(displaylight){
                m_Layer.draw(m_light,sf::BlendNone);
        }
        m_Layer.display();

        m_Sprite.setTexture(m_Layer.getTexture());
        Game::window->draw(m_Sprite);
}

What happens is there is a black rectangle on top of the player at all times - not transparent.

4
Feature requests / Vector2- divide operator
« on: August 20, 2012, 03:07:22 pm »
I'm sure this has to have been mentioned before, but I have not been able to find anything mentioning it using the forum's search or google.

Why doesn't sf::Vector2 (I've only been using sf::Vector2f but I assume the problem is with the other types as well) have a divide operator? It seems like an obvious feature to have.

5
I'm using SFML 2.0, but NOT the newest version of it. GetFrameTime() exists and GetElapsedTime() returns an sf::Uint32.

Here is the code:

Code: [Select]
void AppStateManager::start(AppState* state){
changeAppState(state);
double frameTime = 1;
int startTime = 0;
while(!m_bShutdown){
sf::Clock clock;
if(!SfmlFramework::Singleton()->window->IsOpened())m_bShutdown = true;
SfmlFramework::Singleton()->window->Clear();


//capture input and handle application-wide events
sf::Event evt;
while(SfmlFramework::Singleton()->window->PollEvent(evt)){
switch(evt.Type){
case sf::Event::KeyPressed:
m_ActiveStateStack.back()->keyPressed(evt.Key.Code);
break;
case sf::Event::KeyReleased:
m_ActiveStateStack.back()->keyReleased(evt.Key.Code);
break;
case sf::Event::MouseMoved:
m_ActiveStateStack.back()->mouseMoved(sf::Vector2f(evt.MouseMove.X,evt.MouseMove.Y));
break;
case sf::Event::MouseButtonPressed:
m_ActiveStateStack.back()->mousePressed(evt.MouseButton.Button);
break;
case sf::Event::MouseButtonReleased:
m_ActiveStateStack.back()->mouseReleased(evt.MouseButton.Button);
break;
case sf::Event::Closed:
m_bShutdown = true;
break;
default:
break;
}
}
if(!m_bShutdown)
m_ActiveStateStack.back()->update(frameTime);

frameTime = clock.GetElapsedTime();
clock.Reset();
std::cout << frameTime << std::endl;

SfmlFramework::Singleton()->window->Display();
}

SfmlFramework::Singleton()->window->Close();

}

When run in visual c++ 2010, it outputs correctly - 2 2 2 2 2 2 2 2 2. When run on SOME computers standalone, it also runs correctly. However, on some other computers - mine included - when run standalone it outputs 0 for a while then outputs something close to 15. This is obviously causing a massive problem with my game as a lot of people are experiencing an issue where the movement is incorrect.

How can I fix this?

6
General / SFML 2.0 randomiser?
« on: January 28, 2012, 04:07:05 pm »
I can't find it in the documentation, is it removed?

7
Window / frameTime is always 0
« on: January 18, 2012, 05:04:11 pm »
The frametime is always 0 and I cannot understand why.

I am using sfml 2.0.

Code: [Select]
while(!m_bShutdown){
if(!SfmlFramework::Singleton()->window->IsOpened())m_bShutdown = true;



//capture input and handle application-wide events
sf::Event evt;
while(SfmlFramework::Singleton()->window->PollEvent(evt)){
switch(evt.Type){
case sf::Event::KeyPressed:
m_ActiveStateStack.back()->keyPressed(evt.Key.Code);
break;
case sf::Event::KeyReleased:
m_ActiveStateStack.back()->keyReleased(evt.Key.Code);
break;
case sf::Event::MouseMoved:
m_ActiveStateStack.back()->mouseMoved(sf::Vector2f(evt.MouseMove.X,evt.MouseMove.Y));
break;
case sf::Event::MouseButtonPressed:
m_ActiveStateStack.back()->mousePressed(evt.MouseButton.Button);
break;
case sf::Event::MouseButtonReleased:
m_ActiveStateStack.back()->mouseReleased(evt.MouseButton.Button);
break;
case sf::Event::Closed:
m_bShutdown = true;
break;
default:
break;
}
}
std::cout << "AppStateManager update " << frameTime << std::endl;
m_ActiveStateStack.back()->update(frameTime);

frameTime = SfmlFramework::Singleton()->window->GetFrameTime();
}

8
General / Mini-framework AppState rendering problem
« on: January 09, 2012, 08:07:53 pm »
I made a mini framework for sfml, based off a framework for a 3d rendering engine I have used. It uses "AppStates", which the program is constantly in one - for example, MenuState, GameState. These render a screen whenever one is entered.

In the rendering engine I used this came from, there were SceneManagers to organize the scenes and hold the data rendered in that SceneManager, including a camera which the 'viewport' would be set to. I am new to sfml and not familiar with the various features - is there anything like a SceneManager I could use to achieve the same affect, or would I have to create my own? (I'm assuming 'views' in SFML can be used to the same affect as the viewports - I haven't looked through that part much, please correct me if I am wrong).

Thanks in advance!

9
General / SFML 2.0 PostFX?
« on: December 29, 2011, 10:18:59 pm »
I am following the 1.6 tutorials using the 2.0 version of SFML, and I'm trying to use shaders. Instead of sf::PostFX which isn't there, I thought sf::Shader is the equivalent. Furthermore, I tried using the sf::Shader::SetTexture, which not only does not accept 'NULL' as its second argument so I don't know how to tell it to use the contents of the screen but half the functions in sf::Shader that are listed by visual studio don't seem to be in the documentation. sf::Shader::SetTexture isn't.

How can use the equivalent of postfx in 2.0?

10
General / OpenGL with SFML (dumb question)
« on: December 22, 2011, 07:24:11 pm »
dumb question: do I have to download something extra to use OpenGL with SFML? I try to use OpenGL code like

Code: [Select]
glClearDepth(1.f);

in my project following 1.6 tutorials with 2.0 but I just get 'identifier is undefined'

11
General / SFML 2.0 GetInput()
« on: December 22, 2011, 06:36:57 pm »
What should I use instead? I know sf::input got replaced by sf::Keyboard and sf::Mouse, but I cannot find any function like GetInput() in the documentation under Window. I'm trying to achieve something like this in the 1.6 tutorial:

Code: [Select]
// Get some useless input states, just to illustrate the tutorial
        bool         LeftKeyDown     = Input.IsKeyDown(sf::Key::Left);
        bool         RightButtonDown = Input.IsMouseButtonDown(sf::Mouse::Right);
        bool         JoyButton1Down  = Input.IsJoystickButtonDown(0, 1);
        unsigned int MouseX          = Input.GetMouseX();
        unsigned int MouseY          = Input.GetMouseY();
        int          JoystickX       = Input.GetJoystickAxis(1, sf::Joy::AxisZ);
        int          JoystickY       = Input.GetJoystickAxis(1, sf::Joy::AxisY);
        int          JoystickPOV     = Input.GetJoystickAxis(1, sf::Joy::AxisPOV);

12
General / [VC++10] The application failed to start/linker errors
« on: December 20, 2011, 01:02:53 pm »
I'm using visual studio 2010 express, and have build the 2.0 from source and am using the dynamic libraries. All dynamic and static libs are in VC/lib.

Additional library directories: sfml-system.lib, sfml-window.lib, sfml-graphics.lib (with -d for debug)

Building in debug:
I first get the error of
"general error c101008a: Failed to save the updated manifest to the file "Debug\SFMLTutorial.exe.embed.manifest". The parameter is incorrect."

Any more attempts to compile it and the error is:
This application has failed to start because the application configuration is incorrect.

Building in release:
I get linker errors:
Code: [Select]
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Window::~Window(void)" (__imp_??1Window@sf@@UAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Window::Window(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABUContextSettings@1@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z)
1>C:\Users\Samuel\Documents\Visual Studio 2010\Projects\SFMLTutorial\Release\SFMLTutorial.exe : fatal error LNK1120: 4 unresolved externals


Code I am using
Code: [Select]
#include <SFML/Window.hpp>
#include <iostream>

int main(){
sf::Window window(sf::VideoMode(800,600,32),"SFML window");
bool running = true;
while(running){
window.Display();
}
return EXIT_SUCCESS;
}


Project was a win32 console application with the "blank project" ticked.

Hope someone can help

EDIT: I forgot to hit apply when adding the libs in release. Release works fine now, runs as normal, but debug still has the error.

Pages: [1]