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

Pages: [1]
1
Graphics / Help with .setTextureRect
« on: April 16, 2012, 05:23:58 am »
Okay so heres my code sorry if its messy I'm just playing with stuff right now  :-\

Code: [Select]
#include "stdafx.h"
#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

#define ScreenWidth 800
#define ScreenHeight 600


using namespace std;
using namespace sf;

int main()
{
int SourceFrameX = 0;
int SourceFrameY  = 0;
int SourceFrameXO = 32;
int SourceFrameYO = 64;

RenderWindow GameWindow(VideoMode(ScreenWidth, ScreenHeight, 32), "Window");


float ZombposX = 400;
float ZombposY = 300;

Texture ZombieT;
if(!ZombieT.loadFromFile("ZombSprite.png")) return EXIT_FAILURE;

Sprite ZombieS;
ZombieS.setTexture(ZombieT);

while(GameWindow.isOpen())
{
Event MainEvent;
while(GameWindow.pollEvent(MainEvent))
{
if(MainEvent.type == Event::Closed) GameWindow.close();
if(Keyboard::isKeyPressed(Keyboard::D))
{
ZombposX ++;
(SourceFrameX + 32);
(SourceFrameXO + 32);
//ZombieS.setTextureRect(IntRect(SourceFrameX, SourceFrameY, SourceFrameXO, SourceFrameYO));
}
if(Keyboard::isKeyPressed(Keyboard::A))
{
ZombposX --;
(SourceFrameX + 32);
(SourceFrameXO + 32);
//ZombieS.setTextureRect(IntRect(32, 0, 64, 64));
}
if(!Keyboard::isKeyPressed(Keyboard::D))
{
//ZombieS.setTextureRect(IntRect(0, 0, 32, 64));
}

}

ZombieS.setTextureRect(IntRect(32, 0, 64, 64));
ZombieS.setPosition(ZombposX, ZombposY);
GameWindow.clear();
GameWindow.draw(ZombieS);
GameWindow.display();
GameWindow.setVerticalSyncEnabled(true);
}
return EXIT_SUCCESS;
}

I'm trying to display the second sprite on my sheet, the sheets 128x128 and each sprite is 32x64 so at the bottom it should display the second sprite on the sheet but instead this is what I get.



its showing two zombies on me  :'(

So I would be very grateful if someone could explain what I'm doing wrong.

2
SFML projects / Re: Thor 2.0
« on: April 15, 2012, 07:09:29 pm »
Quote
Make sure to copy the FindSFML.cmake file to the cmake modules folder (search earlier in this thread for more details on this).
I found the post thanks.


Quote
What generator do you use? For Visual Studio 2010 and g++ there are precompiled libraries, so there's no need to build.

In case you want to use the newest SFML, you should rather checkout the Thor 2.0 development version. For Thor 1.1, you must use the SFML revision provided with Thor.

and I do use Visual Studio so yeah, guess I'll be getting Thor 2.0 instead.

Thanks for your help  :D

3
SFML projects / Re: Thor 2.0
« on: April 15, 2012, 05:34:53 am »
Okay, so for the past three days now I've been trying to build Thor 1.1 and just can't get it to work. Whenever I click configure the "SFML_INCLUDE_DIR" option gives me an error. I've set that option to C:\SFML\SFML2\include (that where its stored on my computer) and it always just says its not found . :-\

So could ya help tell me what mistakes I'm making? Also I am using SFML 2.0 and followed this tutorial
 http://sfmlcoder.wordpress.com/2011/06/15/building-sfml-2-nmake/
 Sorry for being incompetent  :'(

Pages: [1]