1
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.
Pages: [1] 2
2
Window / Re: sf::Keyboard question
« on: April 23, 2015, 10:17:21 pm »bool pressed = false;
//before loop
if (sf::Keyboard:IsKeyPressed(sf::Keyboard::S))
{
pressed = true;
}
//need the sprite to draw here if the key has been pressed once
if(pressed) drawSprite();
//before loop
if (sf::Keyboard:IsKeyPressed(sf::Keyboard::S))
{
pressed = true;
}
//need the sprite to draw here if the key has been pressed once
if(pressed) drawSprite();
Something like this?
3
General / Re: Help with changing a sprite direction
« on: April 23, 2015, 04:15:08 pm »
Try to use debugger(or just printf) to check which variable is problematic, ie its value is different from what you would expect it to be.
4
General / Re: Help with changing a sprite direction
« on: April 23, 2015, 02:32:59 pm »
First of all, why do you use "this->" everywhere? It's just a snippet but I'm quite sure you don't need to.
Secondly, why do you use separate vector for every direction? One will do better, also it would clean up your code.
It's hard to see what's going on, comment says bottom edge, code checks top edge, we do not know what's inside the move method and so on.
My guess would be that when you expect it to rebound you apply both direction up and direction down, which are cancelling each other, making it stop.
Secondly, why do you use separate vector for every direction? One will do better, also it would clean up your code.
It's hard to see what's going on, comment says bottom edge, code checks top edge, we do not know what's inside the move method and so on.
My guess would be that when you expect it to rebound you apply both direction up and direction down, which are cancelling each other, making it stop.
5
General / Re: Client-host networking strategy
« on: March 27, 2015, 04:05:28 pm »
Are you familiar with this? http://zeromq.org/
It's a very nice library that, I think, will satisfy your needs. It has a very good guidebook, be sure to read it.
@EDIT, I skimmed trough the post too fast first time and got it somewhat wrong. I've been doing something similar before and assumed you are making the same thing. That aside, it still might prove to be useful.
It's a very nice library that, I think, will satisfy your needs. It has a very good guidebook, be sure to read it.
@EDIT, I skimmed trough the post too fast first time and got it somewhat wrong. I've been doing something similar before and assumed you are making the same thing. That aside, it still might prove to be useful.
6
General / Re: NEW to sfml can someone offer me tips
« on: November 15, 2014, 01:08:29 pm »
Any tutorials?
http://sfml-dev.org/tutorials/2.1/
So what exactly is that?
Also, I recommend reading this:
https://www.packtpub.com/game-development/sfml-game-development
and maybe this:
http://gameprogrammingpatterns.com/
as well as any other book on this topic.
http://sfml-dev.org/tutorials/2.1/
So what exactly is that?
Also, I recommend reading this:
https://www.packtpub.com/game-development/sfml-game-development
and maybe this:
http://gameprogrammingpatterns.com/
as well as any other book on this topic.
7
Graphics / Re: Beginner Tile Map 2d
« on: February 09, 2014, 02:25:20 pm »
Hi.
First of all, you should start with learning about C++ basics.(if you haven't done it yet)
About SFML, I recommend this book:
http://www.packtpub.com/sfml-game-development/book
There are also a lot of useful tutorials on this website, such as an example of simple 2D tile map here:
http://www.sfml-dev.org/tutorials/2.1/graphics-vertex-array.php
Good luck!
First of all, you should start with learning about C++ basics.(if you haven't done it yet)
About SFML, I recommend this book:
http://www.packtpub.com/sfml-game-development/book
There are also a lot of useful tutorials on this website, such as an example of simple 2D tile map here:
http://www.sfml-dev.org/tutorials/2.1/graphics-vertex-array.php
Good luck!
8
General / Re: Battleship (Need help and idea with some codes)
« on: September 04, 2013, 08:59:18 pm »
First of all, I'd suggest you trying to make this game in OOP(object oriented programming), then the code will be a whole lot easier to modify, arrange and understand to other people. Also, then you could make classes, such as ship, or tiles of your map. With this logic it will be easier to make this game.
9
SFML projects / Re: My first space shooter
« on: August 31, 2013, 10:01:43 pm »
@Up
Yes, you're right. I just mainly thought about fixing the freezing, also as problem with detecting collisions is the other thing.
Yes, you're right. I just mainly thought about fixing the freezing, also as problem with detecting collisions is the other thing.
10
SFML projects / Re: My first space shooter
« on: August 31, 2013, 07:58:30 pm »
Hi. Your game is simple and fun, but while playing I found a way to cheat a bit.
When you're playing, hold the window bar with a mouse like you would like to move it, and wait like this for a bit. The game will freeze, but music will be still playing. When game is like this, spaceship will be "moving", but no collisions will be detected.
If you want to fix it, put the event loop to other thread, I've got my own fix, if you're interested.
Good luck with improving the game!
When you're playing, hold the window bar with a mouse like you would like to move it, and wait like this for a bit. The game will freeze, but music will be still playing. When game is like this, spaceship will be "moving", but no collisions will be detected.
If you want to fix it, put the event loop to other thread, I've got my own fix, if you're interested.
Good luck with improving the game!
11
General / Re: String iterators incompatibile
« on: August 31, 2013, 03:11:51 pm »
Clean rebuild did not helped, also I checked my runtime lib and it is Multhi-Threaded Debug DLL (/MDd). Changing to other options does not fix anything of course.
@Well, later problem just disappeared, strange though.
@Well, later problem just disappeared, strange though.
12
General / Re: String iterators incompatibile
« on: August 30, 2013, 10:32:26 pm »
Well, I checked even twice and I'm linking proper libs.
tbh, my earlier "app" worked without problems in debug mode.
tbh, my earlier "app" worked without problems in debug mode.
13
General / String iterators incompatibile
« on: August 30, 2013, 10:22:02 pm »
Hi.
I was making my SFML app, and everything was all right when i compiled it in release mode, but when I tried debug, an weird error occurred. It shows when app is already working and refers to xstring file:
By debugging I found what triggers that error:
Still, in release there is no problem.
I don't know what is exactly wrong, so I put it in "General" category.
Any ideas? I use VS2012.
Thanks for every response!
I was making my SFML app, and everything was all right when i compiled it in release mode, but when I tried debug, an weird error occurred. It shows when app is already working and refers to xstring file:
Program: C:\Windows\system32\MSVCP110D.dll
File: D:\programmes\visual-studio-2012\VC\INCLUDE\xstring
Line: 250
Expression: string iterators incompatible
File: D:\programmes\visual-studio-2012\VC\INCLUDE\xstring
Line: 250
Expression: string iterators incompatible
By debugging I found what triggers that error:
void ThreadedRenderWin::create_(sf::VideoMode mode_, const std::string& title_, unsigned long style_, const sf::ContextSettings& settings_)
{
eventThread.reset(new sf::Thread([&]()
{
sf::Lock createLock(createMutex);
sf::RenderWindow::create(mode_, title_, style_, settings_); //<-- This is the problematic function
setActive(false);
//Rest omitted
}));
eventThread->launch();
}
//////main.cpp
int main(){
NG::ThreadedRenderWin RenderWin;
RenderWin.create_(sf::VideoMode(800,680,32), "SFML");
//Event loop etc.
return 0;
}
{
eventThread.reset(new sf::Thread([&]()
{
sf::Lock createLock(createMutex);
sf::RenderWindow::create(mode_, title_, style_, settings_); //<-- This is the problematic function
setActive(false);
//Rest omitted
}));
eventThread->launch();
}
//////main.cpp
int main(){
NG::ThreadedRenderWin RenderWin;
RenderWin.create_(sf::VideoMode(800,680,32), "SFML");
//Event loop etc.
return 0;
}
Still, in release there is no problem.
I don't know what is exactly wrong, so I put it in "General" category.
Any ideas? I use VS2012.
Thanks for every response!
14
General / Using events with WinAPI.
« on: October 31, 2011, 09:06:54 pm »
Hm, maybe it would be better to make my own controls.
But I don't exactly know how to do it...
But I don't exactly know how to do it...
15
General / Using events with WinAPI.
« on: October 31, 2011, 06:58:46 pm »
So what I'm supposed to do?
Pages: [1] 2