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

Pages: [1]
1
DotNet / Text render issue
« on: October 11, 2018, 02:45:28 am »
Hi,

Version: .NET 2.4

I'm trying to simply draw text and I'm wondering if anyone else is experiencing this issue. The issue is that the text isn't displaying correctly, it's missing characters and has strange gaps in between characters.
What is interesting is I'm getting similar but different results per-run of my application. I have not attempted to replicate the problem, but I will if no one else has or is experiencing this issue.

Trying to draw "Loading: 100%"
Run 1 (Notice the huge gap):

Run 2 (Notice the missing "1"):


Trying to draw "Hello, World" (Not sure what's going on here):

2
General / Drawing to render window freezes
« on: February 20, 2015, 09:50:22 am »
Hello, I have two classes:
Object
ObjectManager

I store all of my objects inside the ObjectManager class with a vector. I update all objects in one function which works perfectly. But when it comes to drawing them all in another function the game freezes. I even tried getting the object to just draw a RectangleShape & it still freezes. But when I comment out the draw function inside the object itself it is fine. So I think it might have to do with drawing to the window?

Here is my draw code for the object manager:

mWindow:
sf::RenderWindow                *mWindow;

void ObjectManager::draw()
{
        // Draw all of our drawable objects
        for (std::vector<Object*>::iterator it = objectList.begin(); it != objectList.end(); ++it)
        {
                (*it)->draw(mWindow);

        }
}
 

Here is the function above it that updates the objects (and it works):

void ObjectManager::draw()
{
void ObjectManager::update(sf::Time &delta)
{
        // Update all of our objects on the list
        for (std::vector<Object*>::iterator it = objectList.begin(); it != objectList.end(); ++it)
        {
                (*it)->update(delta);
                std::cout << "draw" << std::endl;
        }

        // Set there draw priority by depth
        std::sort(objectList.begin(), objectList.end(), sortByDepth);
}
 

3
General / Custom draw order (depth)
« on: November 01, 2014, 05:54:23 pm »
Hello, I am quite new to C++ and SFML. I have made a few small games from SFML so far and am really enjoying it. Right now I am trying to create an RPG game, then I realised that unlike my other simpler games I've made previously, this game requires a draw order. I was a little bit stumped on how to do this at first, I tried searching on the forums but couldn't quite get a good understanding.

I have been trying to figure out the best & easiest way to draw sprites in a specific order related to their depth. At the moment the class I have made seems to work so far (see code below) , even though I still need to add a few more features. Am I on the right track for this? Sorry if this is in the wrong section of the forums. Thanks in advance.

Here is what I have come up with so far:


void SceneGraph::addToList(Entity entity, int depth)
{
    //drawList.emplace(depth, entity);
    drawList.insert ( std::pair<int,Entity>(depth,entity) );
}

void SceneGraph::updateList(sf::Time &deltaTime)
{
    // Put our current draw list into a new container
    tempDrawList.insert(drawList.begin(), drawList.end());
    //tempDrawList = drawList;
    // Clear our current draw list
    drawList.clear();
    //
    for(std::multimap<int, Entity>::iterator it=tempDrawList.begin(); it!=tempDrawList.end(); it++)
    {
        // Add our new updated depth to the list
        addToList((*it).second, (*it).second.getDepth());
    }
    // Clear the temp list now we're done with it
    tempDrawList.clear();

}


void SceneGraph::draw(sf::RenderWindow& target)
{
    for(std::multimap<int, Entity>::iterator it=drawList.begin(); it!=drawList.end(); it++)
    {
        (*it).second.draw(target);
    }

}

 

Pages: [1]