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

Pages: 1 ... 17 18 [19] 20 21
271
Did you select "empty project" when creating your project?

272
Window / Re: Detect if number has been pressed?
« on: April 24, 2015, 06:21:48 pm »
Code: [Select]
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Num1) && sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Num2))
{
    //code here
}
This should do it. Of course you can replace 1 and 2 with whatever you want, or use Numpad instead of Num like Rosme said if you want.

273
SFML projects / Re: SFGUI (0.2.3 released)
« on: April 24, 2015, 06:12:57 pm »
On a slightly different topic, can I just say how amazing this library looks? I'm planning my A level course work at the moment (which I'm of course going to ridiculously overdo) and this is perfect. To be honest, I'm surprised this does come as a part of sfml so you'd have sfml-graphics,sfml-audio,sfml-window,sfml-gui,sfml-network and sfml-system. The only thing that confuses me is that on the linking section of the website it seems to presume the use of CMake. I've never really looked into it, but as far as I know I've never used CMake (though code::blocks may use it when linking for all I know about it) and I didn't think it was necessary.

274
Graphics / Glitchy display when dragging window offscreen
« on: April 23, 2015, 06:31:47 pm »
I'm not sure if this is a problem with anything I'm doing or with SFML as it has happened in every program I've ever written. If you grab the window and drag it offscreen then back onscreen, the window fills with fairly random repeated graphics and it only updates when you release the mouse. Is there anything that can be done about this or is it just a problem with SFML?

275
General / Re: Help with changing a sprite direction
« on: April 23, 2015, 06:27:51 pm »
*scraps entire long attempt at being helpful and starts again because misread your code*
You are not actually permenantly changing anything in your if loops. If you put a velocity variable in your struct instead of speed and then just multiply the x or y value by -1 when you collide with the edge, and then move by velocity in the program loop then it should work okay. Hope this helps. If you still don't get it, I'll try making an simple example.

P.S. repeated initialization in a game loop is a bad idea partially because it is inefficient and partially because it resets the value every time and this can be confusing.

P.P.S. I would advise against names like ptpf as it can be difficult for other people to know what it means.

276
Graphics / Re: != symbol error with sf::CircleShape
« on: April 22, 2015, 09:33:49 pm »
Try:
Code: [Select]
while(ball.getGlobalBounds().x != 400 || ball.getGlobalBounds().y != -260){
or (I think)
Code: [Select]
while(ball.getGlobalBounds() != sf::FloatRect(400,-260)){

277
Graphics / Re: something on my screen in sprite
« on: April 19, 2015, 08:14:31 pm »
You should not store the texture inside the alien class, because it is needlessly duplicated for every alien. Pass a texture reference to the alien's constructor instead.
Is there any reason not to take this further and do the following? Pass a sprite reference in the constructor, then use float positions in the class, give the class a draw function that should be called between window.clear() and window.display() and then make each call of the draw function move the refenced sprite (which can be shared between objects) to the correct position and print it on the screen. Thus making many objects that use the same texture only uses one texture and one sprite.

278
Graphics / Re: something on my screen in sprite
« on: April 19, 2015, 07:59:27 pm »
I'd advise making a class for the alien and putting a sprite and texture in it as a simple space invaders game shouldn't be too processor expensive pretty much however you do it. YOu then make an array of the alien class and they all have their own sprite. If you're certain about making all the aliens in a single texture, try looking at rendertextures and make one by drawing a grid of aliens to it. Also, use the NEW TOPIC button rather than the NEW POLL button to open a new thread.

279
General discussions / Re: idea needed
« on: April 18, 2015, 10:24:08 pm »
Why are you writing it as windows specific?

280
General / Re: Resource textures
« on: April 14, 2015, 09:33:35 pm »
Not sure if this is exactly what you are looking for but if you can use Gimp, it can export images as c source code which can be included in a header file and referenced via loadFromMemory().

281
General / Re: [please read] Error with newly installed SFML
« on: April 12, 2015, 11:55:51 am »
Could you post your code please. I know you said you did exactly as in the tutorial but it is possible that there is some error that isn't in linking as it is very easy to overlook them sometimes. Also, are you linking statically or dynamically?

282
General / Re: I want to make 3D games. (newb question alert)
« on: April 12, 2015, 11:51:43 am »
A quick search of the forums yielded this from eXpl0it3r:
Quote
the topic 3D has been discussed numerous times and the answer will never change... ::)
SFML only provides 2D functionality period.

Also OpenGL is always needed with SFML but you don't have to explicitly link it, except if you were going to do some custom drawing.
If you want 3D you can use some other simple libraries like Irrlicht or do everything on your own with SFML as window 'creator' and OpenGL.
This seems to sum things up pretty well: if you want to do 3d and use SFML, you pretty much have to do it yourself and use SFML for other parts of your program like window/audio etc.

283
Graphics / Re: sf::RenderWindow problem
« on: April 12, 2015, 11:45:35 am »
I would suggest editing the code so that mode is set to a fixed value and isn't changed by the program. Then try mode as 0,1 and 2 by changing the initialisation to see in which part of the program the problem is. If this doesn't change anything then you've narrowed down the problem to the initialisation, the draw call or the event handling. This may not completely solve the problem but it has helped me in the past and if you know where the problem is then it is a lot easier to correct. It is, after all entirely possible that the window contruction is okay and the problem is elsewhere which is stopping it from showing.

Also, why have you included <iostream> and <cmath>?

284
Graphics / Re: Best way to create an Arrow-Shape
« on: April 06, 2015, 07:11:28 pm »
This might be a stupid suggestion, but is there any reason not to just make a sprite and texture using that arrow image you posted earlier or another one if you wanted a different style?

285
General / Re: Sick of trying static linking with 2.2
« on: February 07, 2015, 09:22:16 pm »
I'd been really confused by this as well. But that image by eXpl0ir3r is so useful. Putting that in the tutorial would make it a lot easier to understand.

Pages: 1 ... 17 18 [19] 20 21