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

Pages: [1]
1
Graphics / Tilemap problem: rotated tile-sprite
« on: March 01, 2012, 02:37:25 pm »
i didnt changed to SFML 2.0 because there is no official release yet.
Im afraid i have to update my code to often when i use it before it is "ready"

But when you say "Hey fool, change to SFML 2.0! It is worth it!" i surely will update...
(and then bomb you with questions you have to answer ;)  )

2
Graphics / Tilemap problem: rotated tile-sprite
« on: March 01, 2012, 01:27:17 pm »
as you can see on line two of the code smoothing is allready set off

3
Graphics / Tilemap problem: rotated tile-sprite
« on: March 01, 2012, 12:46:14 pm »
Hi there,
im currently trying to get my tilemap working.
mostly it works fine, but to reduce the number of
needed tiles i added the abillity to rotate a tile.
But when i actually do that i get some nasty black lines.
(See the pic i added)
Here is the code i use:
( Tilesize is 50)
Code: [Select]

MapTile.LoadFromFile("data/img/TileSet.png");
MapTile.SetSmooth(false);
maptile.SetImage(MapTile);
maptile.SetCenter(25,25);
mousetile.SetImage(MapTile);
mousetile.SetCenter(25,25);

...

// Draw Map-Tiles
for (int i = View::GetViewRect().Left/TileSize; i<View::GetViewRect().Right/TileSize && i<Game::GetMapWidth();i++)
{
for (int j = View::GetViewRect().Top/TileSize; j<View::GetViewRect().Bottom/TileSize && j<Game::GetMapHeight();j++)
{
maptile.SetPosition(i*TileSize+25,j*TileSize+25);
sf::IntRect SubRect;
if(Map[i][j]._tile==0)
{
emptytile.SetPosition(i*TileSize,j*TileSize);
renderWindow.Draw(emptytile);
}
if(Map[i][j]._tile==1)  
{
SubRect.Left=0;
SubRect.Top=0;
SubRect.Right=50;
SubRect.Bottom=50;
}
if(Map[i][j]._tile==2)
{
SubRect.Left=50;
SubRect.Top=0;
SubRect.Right=100;
SubRect.Bottom=50;
}
if(Map[i][j]._tile==3)
{
SubRect.Left=0;
SubRect.Top=50;
SubRect.Right=50;
SubRect.Bottom=100;
}
if(Map[i][j]._tile==4)
{
SubRect.Left=50;
SubRect.Top=50;
SubRect.Right=100;
SubRect.Bottom=100;
}
if(Map[i][j]._tile!=0)
{
maptile.SetSubRect(SubRect);
maptile.SetRotation(Map[i][j]._direction*90);
renderWindow.Draw(maptile);
}
}
}


can someone help me with this?


4
Graphics / Rect.Intersects trouble
« on: January 19, 2012, 07:20:00 pm »
Laurent you rock!
You code this awesome SFML-thing AND solved my problem.
*thumbs up*
(i also will name all my kids after you)

5
Graphics / Rect.Intersects trouble
« on: January 19, 2012, 05:01:22 pm »
its simply "test.cpp"

6
Graphics / Rect.Intersects trouble
« on: January 19, 2012, 04:49:50 pm »
stdafx.h:
Code: [Select]
#pragma once

#include "targetver.h"

#define WIN32_LEAN_AND_MEAN             // Selten verwendete Teile der Windows-Header nicht einbinden.
// Windows-Headerdateien:
#include <windows.h>

// C RunTime-Headerdateien
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>


targetver.h:

Code: [Select]

#pragma once
#include <SDKDDKVer.h>


and by the way: im using SFML1.6

7
Graphics / Rect.Intersects trouble
« on: January 19, 2012, 03:23:34 pm »
But what could it be?
Under Linker->additional dependencies i got:
sfml-graphics-d.lib;sfml-window-d.lib;sfml-main.lib;sfml-system-d.lib;sfml-audio-d.lib;

under C++-> Preprocessor : SFML_DYNAMIC;

nothing more changed from standard values

8
Graphics / Rect.Intersects trouble
« on: January 19, 2012, 09:24:19 am »
Hey there,
i got some problem with a collision-test im doing at the moment. Also im still kinda noobish at C++ so i cant figure out whats wrong by myself. Hope you can help me.
Code works just fine without that Intersects Line.

Here is my (full) Code:

Code: [Select]

#include "stdafx.h"
#include <SFML\Graphics.hpp>
#include <SFML\System.hpp>
#include <SFML\Window.hpp>


int main()
{
    // Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Collision-Test");//,sf::Style::Fullscreen);
const sf::Input& Input = App.GetInput();

// Rects

sf::Rect<int> HRect;
sf::Rect<int> ORect(200,200,240,240);

// Init Player (20x30px)
sf::Image HeroIMG;
sf::Sprite HeroSprite;
float Speed;
HeroIMG.LoadFromFile("data/img/hero.bmp");
HeroSprite.SetImage(HeroIMG);
HeroSprite.SetPosition(400.f, 300.f);
HeroSprite.SetCenter(11,22);
Speed=100.f;

// Init Rect (40x40px)
sf::Image RectIMG;
sf::Sprite Rect;
RectIMG.LoadFromFile("data/img/rect.bmp");
Rect.SetImage(RectIMG);
Rect.SetPosition(200.f,200.f);
    // Start game loop
sf::FloatRect RenderRect;
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
App.Close();

if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
            App.Close();

        }

// Update Player
float ElapsedTime = App.GetFrameTime();

sf::Vector2f Position=HeroSprite.GetPosition();
HRect.Left=Position.x;
HRect.Top=Position.y;
HRect.Right=Position.x+20;
HRect.Bottom=Position.y+30;


// Move the PlayerSprite
if (App.GetInput().IsKeyDown(sf::Key::A)) HeroSprite.Move(-Speed * ElapsedTime, 0);
if (App.GetInput().IsKeyDown(sf::Key::D)) HeroSprite.Move( Speed * ElapsedTime, 0);
if (App.GetInput().IsKeyDown(sf::Key::W))   HeroSprite.Move(0, -Speed * ElapsedTime);
if (App.GetInput().IsKeyDown(sf::Key::S)) HeroSprite.Move(0,  Speed * ElapsedTime);

if(HRect.Intersects(ORect))
{
HeroSprite.SetPosition(500,500);
}

        // Clear the screen (fill it with black color
        App.Clear();

// render Player
App.Draw(Rect);
App.Draw(HeroSprite);

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}



Error:

1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(104): error C2589: '(': Ungültiges Token auf der rechten Seite von '::'
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(102): Bei der Kompilierung der  Klassen-template der bool sf::Rect<T>::Intersects(const sf::Rect<T> &,sf::Rect<T> *) const-Memberfunktion
1>          with
1>          [
1>              T=int
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\glyph.hpp(54): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template "sf::Rect<T>".
1>          with
1>          [
1>              T=int
1>          ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(104): error C2059: Syntaxfehler: '::'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(105): error C2589: '(': Ungültiges Token auf der rechten Seite von '::'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(106): error C2589: '(': Ungültiges Token auf der rechten Seite von '::'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(107): error C2589: '(': Ungültiges Token auf der rechten Seite von '::'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(110): error C2065: 'Overlapping': nichtdeklarierter Bezeichner
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(110): error C2228: Links von ".Left" muss sich eine Klasse/Struktur/Union befinden.
1>          Typ ist ''unknown-type''
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(110): error C2065: 'Overlapping': nichtdeklarierter Bezeichner
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(110): error C2228: Links von ".Right" muss sich eine Klasse/Struktur/Union befinden.
1>          Typ ist ''unknown-type''
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(110): error C2065: 'Overlapping': nichtdeklarierter Bezeichner
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(110): error C2228: Links von ".Top" muss sich eine Klasse/Struktur/Union befinden.
1>          Typ ist ''unknown-type''
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(110): error C2065: 'Overlapping': nichtdeklarierter Bezeichner
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(110): error C2228: Links von ".Bottom" muss sich eine Klasse/Struktur/Union befinden.
1>          Typ ist ''unknown-type''
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\sfml\graphics\rect.inl(113): error C2065: 'Overlapping': nichtdeklarierter Bezeichner

PS: Sorry for bad english and german-error logs (as i am german)

Pages: [1]
anything