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

Pages: [1]
1
Graphics / [SFML 2.0] sf::View TextBox
« on: August 08, 2013, 10:16:16 pm »
Hey,

Wanted to try and create a TextBox using a texture font (glyphs).
I want to try this without using any third party library.

The problem I'm having:
Scrolling tiles with a sf::View is working well if it covers the entire window (800x600).
Creating a TextBox would practically be the same, however I don't want to use the entire window with the sf::View since I only need a small part for the TextBox (200x20) showing only the characters which should be visible. (for example, only the text that fits in the TextBox's width should be shown)

So my question is:
Is it possible to use a sf::View without making the fonts HUGE or using the entire window? Like a sub-view.
I'm guessing it has to do with the viewport like I have seen in some tutorials but fail to see how it would be related to my problem using scales..

Any ideas / tips on how to approach this would be appreciated.

2
Graphics / sf::VertexArray for multiple Tilesets.
« on: May 21, 2013, 11:02:52 pm »
Hi all,

After reading the documentation on the VertexArray class and textures I seem to be stuck.
It all works great.. for one tileset texture.
I have multiple tilesets which consists of 5 by 10 tiles (each tile is 32x32).

Positioning the x and y for both the screen (VertexArray.position) and the tileset (VertexArray.texCoords) is working fine.
I just need some help with how to handle multiple tilesets, I can't put my finger around this issue.

I am using SFML 2.0.
Any help or tips is highly appreciated!

3
Graphics / Bitmap font -> Chatbox (with scrollbar)
« on: February 14, 2013, 05:40:46 pm »
Hello all,

How would I go about creating a chatbox using nothing but a bitmap font.

The problem is creating the actual box with scrollable text (vertical scrollbar).
Can this be created with a view or are there better solutions?

Don't have any idea how to begin approaching this, any help is appreciated.

4
Graphics / sf::Sprite vector reference to sf::Texture vector
« on: November 27, 2012, 03:46:40 pm »
Well, I'm having a bit of a head-scratch here.
I understand that Sprites are references to Textures and the Textures need to be initialized for the Sprites to draw.

In this case, I have a vector of Textures in class TexMgr in which I store all tilesheets:
TexMgr.h:
std::vector<sf::Texture> tileSheets;
std::map<unsigned long, unsigned long> tileIDs;

TexMgr.cpp:
void TexMgr::addTilesheet(sf::Texture &tilesheet) {
        tileSheets.push_back(tilesheet);
}
 

Now I want to store each tile in each tilesheet of the previous vector into a seperate Sprite vector:
TexMgr.h:
std::vector<sf::Sprite> sprTiles;
TexMgr.cpp:
void TexMgr::addTile(sf::Sprite &tile, unsigned long id) {
        sprTiles.push_back(tile);
        tileIDs[id] = sprTiles.size() - 1;
}
 

and finally draw the sprite using:
sf::Sprite* TexMgr::getTileSpr(unsigned long id) {
        return &sprTiles[tileIDs[id]];
}
 

I don't think this is the correct way of doing things because the rendered Sprite is white.
Could anyone lighten me up, any help is appreciated.

5
Graphics / sf::Image -> sf::Texture -> sf::Sprite slow process
« on: November 23, 2012, 05:02:46 pm »
Why is it that loading textures from files is such a slow process.
I'm either doing something wrong, or SFML is just too slow for my needs.

I load each tile in a tilesheet into an sf::Image using a subRect. All goes well and is pretty fast too.
Now the real problem is getting it into a texture using texture.loadFromImage which well then be put into a sprite for rendering.

I need to use it this way because I need image.createMaskFromColor to filter a certain color.
Is there a way to avoid loadFromImage without removing the createMaskFromColor functionality?

(I'm using SFML 2.0)

Pages: [1]
anything