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

Pages: [1] 2 3
1
Hello.
Id like to request a possibility of sf::RenderTexture swapping ownership of its texture with sf::Texture.
Reasons being,
Code: [Select]
std::cout << sizeof(sf::RenderTexture) << std::endl;//488
std::cout << sizeof(sf::Texture) << std::endl;//32
My thought are that RenderTexture was supposed to be used as a drawing board and sf::Texture would be the paper that you actually draw on.

Related to topics:
http://en.sfml-dev.org/forums/index.php?topic=16178.0
http://en.sfml-dev.org/forums/index.php?topic=16174.0
Is it possible to expect such a feature?

2
Graphics / (Not bug)Bug with sfmlRenderTexture or i am doing it wrong
« on: August 25, 2014, 11:22:00 pm »
Hello.
In short what i want to do: I want to draw sf::Text once and save it as texture, then use texture to speed up drawing.

In short what i achieve: I draw text and save it as texture, all but last texture are white. I suspect the renderTexture deconstructor releases its texture and thus i am getting all white when using it.
But i have no clue what em i doing wrong.
Magic happens in Dialog::MakeText(...);
EDIT::Also the creating renderTexture does not fail.

Code: [Select]
class Dialog
{
public:
Dialog(std::string & str, int linkedObjectVecID = -1, int posX = -1, int posY = -1);
Dialog& operator=(Dialog & d);
Dialog(const Dialog & d);
void MakeText(sf::Font & font);

sf::Text txt;
sf::Texture tex;
sf::Sprite spr;
int linkedObjectVecID;
int posX, posY;
std::string str;
};

Dialog::Dialog(std::string & Str, int LinkedObjectVecID, int PosX, int PosY)
{
linkedObjectVecID = LinkedObjectVecID;
posX = PosX;
posY = PosY;
str = Str;
}

Dialog& Dialog::operator = (Dialog & d)
{
txt = d.txt;
tex = d.tex;
spr = d.spr;
linkedObjectVecID = d.linkedObjectVecID;
posX = d.posX;
posY = d.posY;
str = d.str;
return *this;
}
Dialog::Dialog(const Dialog & d)
{
txt = d.txt;
tex = d.tex;
spr = d.spr;
linkedObjectVecID = d.linkedObjectVecID;
posX = d.posX;
posY = d.posY;
str = d.str;
}

void Dialog::MakeText(sf::Font & font)
{
txt.setCharacterSize(32);
txt.setColor(sf::Color::White);
txt.setFont(font);
txt.setString(str);
txt.setPosition(-txt.getLocalBounds().left, -txt.getLocalBounds().top);
std::cout << "MakeText str:" << str << std::endl;

sf::RenderTexture renTex;
if (renTex.create(txt.getLocalBounds().width + txt.getLocalBounds().left * 2, txt.getLocalBounds().height + txt.getLocalBounds().top * 2) == false)
std::cout << "Dialog::MakeText Creating texture failed:" << std::endl;
renTex.draw(txt);
renTex.display();
//tex.create(renTex.getSize().x, renTex.getSize().y);
tex = renTex.getTexture();

spr.setTexture(tex);
//Set position on position
spr.setPosition(posX - (txt.getLocalBounds().width / 2), posY - txt.getLocalBounds().height - (txt.getLocalBounds().top * 2));
}

int main()
{
sf::View view;
view.setViewport(sf::FloatRect(0, 0, 1, 1));

sf::RenderWindow win;
sf::VideoMode vidMod(800,600,32);
win.create(vidMod, "hello", sf::Style::Default);
win.setFramerateLimit(100);
win.setView(view);

sf::Font arial;
arial.loadFromFile("arial.ttf");

std::vector<Dialog> listDialog;
listDialog.push_back(Dialog(std::string("Greeting traveler."), -1, 300, 300));
listDialog.back().MakeText(arial);
listDialog.push_back(Dialog(std::string("Two trees."), -1, 300, 100));
listDialog.back().MakeText(arial);
listDialog.push_back(Dialog(std::string("Derp"), -1, 300, 500));
listDialog.back().MakeText(arial);

bool done = false;
while(done == false)
{
win.clear();

sf::Event event;
while(win.pollEvent(event))
{
switch(event.type)
{
case sf::Event::Closed:
done = true;
break;
default:
break;
}
}

for (Dialog & d : listDialog)
win.draw(d.spr);

win.display();
}

return 0;
};

3
Graphics / sf::NonCopyable, can you tell me what in my class causes it.
« on: August 25, 2014, 01:16:41 pm »
I suppose something like sf::RenderTexture is NoNCopyable. I will just make it a pointer and transfer ownership when operator= called, but i got no clue what is NoNCopyable. Can you help me and point it out?

The error:
Code: [Select]
1>------ Build started: Project: TheRPG, Configuration: Release Win32 ------
1>  Chat.cpp
1>Chat.cpp(27): warning C4244: 'argument' : conversion from 'float' to 'unsigned int', possible loss of data
1>Chat.cpp(65): warning C4018: '>=' : signed/unsigned mismatch
1>C:\C++\Libs\SFML VS2013\include\SFML/Graphics/RenderTarget.hpp(419): error C2248: 'sf::NonCopyable::NonCopyable' : cannot access private member declared in class 'sf::NonCopyable'
1>          C:\C++\Libs\SFML VS2013\include\SFML/System/NonCopyable.hpp(67) : see declaration of 'sf::NonCopyable::NonCopyable'
1>          C:\C++\Libs\SFML VS2013\include\SFML/System/NonCopyable.hpp(42) : see declaration of 'sf::NonCopyable'
1>          This diagnostic occurred in the compiler generated function 'sf::RenderTarget::RenderTarget(const sf::RenderTarget &)'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

//Removing this line of code makes it go away, and compile as it should
void DialogHolder::AddDialog(Dialog & d)
{
listDialog.push_back(d);//This line here
}
Code: [Select]
//HPP
class Dialog
{
public:
Dialog(int linkedObjectVecID = -1, int posX = -1, int posY = -1);
Dialog(std::string & str, sf::Font & font, int linkedObjectVecID = -1, int posX = -1, int posY = -1);
void MakeText(std::string & str, sf::Font & font);
void Loop();

sf::Text txt;
sf::RenderTexture renTex;
sf::Sprite spr;

int linkedObjectVecID;
int posX, posY;
};

class DialogHolder
{
public:
DialogHolder(Font & ObjFont);

void AddDialog(Dialog & d);
void RemoveDialog(int vecID);
void Loop();
void Draw(sf::RenderWindow & renWin);

std::vector<Dialog> listDialog;
private:
Font & objFont;
};

//CPP
Dialog::Dialog(int LinkedObjectVecID, int PosX, int PosY)
{
linkedObjectVecID = LinkedObjectVecID;
posX = PosX;
posY = PosY;
}

Dialog::Dialog(std::string & str, sf::Font & font,int LinkedObjectVecID, int PosX, int PosY)
{
linkedObjectVecID = LinkedObjectVecID;
posX = PosX;
posY = PosY;
MakeText(str, font);
}
void Dialog::MakeText(std::string & str, sf::Font & font)
{
txt.setCharacterSize(32);
txt.setColor(sf::Color::White);
txt.setFont(font);
txt.setString(str);
txt.setPosition(-txt.getLocalBounds().left, -txt.getLocalBounds().top);

renTex.create(txt.getLocalBounds().width + txt.getLocalBounds().left * 2, txt.getLocalBounds().height + txt.getLocalBounds().top * 2);
renTex.draw(txt);
renTex.display();

spr.setTexture(renTex.getTexture(), true);
if (linkedObjectVecID != -1)
{//Set position on unit
Object & o = glob::objFunc.objObjectH->listObject[linkedObjectVecID];
spr.setPosition(o.pos.x + (o.size.x/2) - (txt.getLocalBounds().width / 2), o.pos.y - txt.getLocalBounds().height - (txt.getLocalBounds().top*2));
}
else
{//Set position on position
spr.setPosition(posX - (txt.getLocalBounds().width / 2), posY - txt.getLocalBounds().height - (txt.getLocalBounds().top * 2));
}
}

void Dialog::Loop()
{
if (linkedObjectVecID != -1)
{//Set position on unit
Object & o = glob::objFunc.objObjectH->listObject[linkedObjectVecID];
spr.setPosition(o.pos.x + (o.size.x / 2) - (txt.getLocalBounds().width / 2), o.pos.y - txt.getLocalBounds().height - (txt.getLocalBounds().top * 2));
}
}


DialogHolder::DialogHolder(Font & ObjFont)
: objFont(ObjFont)
{

}

void DialogHolder::AddDialog(Dialog & d)
{
listDialog.push_back(d);
}
void DialogHolder::RemoveDialog(int vecID)
{
if (vecID < 0 || vecID >= listDialog.size())
return;

//listDialog.erase(listDialog.begin() + vecID);
}


void DialogHolder::Loop()
{
for (Dialog & d : listDialog)
d.Loop();
}

void DialogHolder::Draw(sf::RenderWindow & renWin)
{
for (Dialog & d : listDialog)
renWin.draw(d.spr);
}


4
Graphics / How to make sf::RenderTexture i can manipulate
« on: August 24, 2014, 09:04:54 pm »
Hello.
I have idea: I want to draw text on screen but keep it efficient, so draw text onto renderTexture then use VertexArray to draw it on screen so save performance is the general idea.

But i am facing one thing, i cannot manipulate render texture, for example i want to delete part of it(making it transparent so i can put another text there).
Any ideas how to clear part of renderTexture.

This is how i drawn the text via vertexArray using renderTextures
Code: [Select]
int main()
{
sf::View view;
//view.setCenter(sf::Vector2f(400, 300));
view.setViewport(sf::FloatRect(0, 0, 1, 1));

sf::RenderWindow win;
sf::VideoMode vidMod(800,600,32);
win.create(vidMod, "hello", sf::Style::Default);
win.setFramerateLimit(100);
win.setView(view);

sf::RenderTexture renTex;
sf::Text txt;
sf::Font font;
sf::RectangleShape rec;
sf::VertexArray verArr;

font.loadFromFile("arial.ttf");

txt.setCharacterSize(24);
txt.setColor(sf::Color::Black);
txt.setFont(font);
txt.setString("Greeting young traveler!\nMay i be of any assistence?");
txt.setPosition(-txt.getLocalBounds().left, -txt.getLocalBounds().top);
sf::FloatRect tfr = txt.getLocalBounds();

rec.setPosition(-tfr.left, -tfr.top);
rec.setSize(sf::Vector2f(tfr.width + tfr.left, tfr.height + tfr.top*2));

renTex.create(tfr.width + tfr.left, tfr.height + tfr.top);
renTex.draw(txt);
renTex.display();

verArr.setPrimitiveType(sf::Quads);
for (int i = 0; i < 1; i++)
{
std::cout << " x:" << renTex.getSize().x << " y:" << renTex.getSize().y << std::endl;
verArr.append(sf::Vertex(sf::Vector2f(i, 0), sf::Color(255, 255, 255, 255), sf::Vector2f(0, 0)));
verArr.append(sf::Vertex(sf::Vector2f(i + renTex.getSize().x, 0), sf::Color(255, 255, 255, 255), sf::Vector2f(renTex.getSize().x, 0)));
verArr.append(sf::Vertex(sf::Vector2f(i + renTex.getSize().x, renTex.getSize().y), sf::Color(255, 255, 255, 255), sf::Vector2f(renTex.getSize().x, renTex.getSize().y)));
verArr.append(sf::Vertex(sf::Vector2f(i, +renTex.getSize().y), sf::Color(255, 255, 255, 255), sf::Vector2f(0, renTex.getSize().y)));
}
sf::RenderStates renSta;
renSta.texture = &renTex.getTexture();

bool done = false;
while(done == false)
{
win.clear();

sf::Event event;
while(win.pollEvent(event))
{
switch(event.type)
{
case sf::Event::Closed:
done = true;
break;
case sf::Event::KeyPressed:
switch(event.key.code)
{
case sf::Keyboard::K:
break;
default:
break;
}
break;
default:
break;
}
}
win.draw(rec);
//win.draw(spr);

win.draw(verArr, renSta);
win.display();
}

return 0;
};

5
Hello.
I am making : http://en.sfml-dev.org/forums/index.php?topic=14563.0
Working on conversation between units, i want to make floating text that will be used for:
"Long text ~30 to 100char", "battle numbers(heal,damage,effect, battle shouts)", "Hints", "NPC conversation and player to npc conversation".
So to assume there should be 500char worth of text on screen at a same time(at specific time not alwais), i was wondering if anybody did testing with sf::Text to render texture to render window or sf::Text to render window?

And generally to ask, any better ideas then just doing sf::Text and drawing at location?

6
Graphics / A question about textures and drawing
« on: June 13, 2014, 04:20:37 pm »
Hello.
I am wondering how to setup my sprites sheet for objects, tiles, and units...
Id personally put it in one big texture, but i was wondering If there are two draw calls with same texture, one after another, does it copy the texture again intro the gpu, or does it know not to copy texture again?

And if i wanted to find out something as this, would i read about GPUs, OpenGL or what?

7
Graphics / Can i link VertexArray for drawing in one call?
« on: June 04, 2014, 08:23:13 pm »
Hello.
Currently i am trying to design multy level height.

So i have a map that has 4 layers,(Floor,low,middle,high), i am not doing base layer for ground i am making objects, and i want them to be able to stack one up on other.
So if i made one vertex for each 320x320 pixel region, my issue is that whenever i add object, i don't want to reposition the whole vertex array if it is bellow another object.

If i add object to position x=0,y=0, with size w=32,h=32 at layer middle. vertexArray(VA) position will be 0-3
Now when i add another object at same position, but at layer floor VA(4-7), i need to switch those around so i will draw in correct order.
That is not issue on small scale, but i am not in small scale, and repositioning hundred vertices, for only one object is passable, but in case 10 objects tumbles from middle layer to low...

So if i make one vertexArray for each layer, i can just add intro it without any checks because objects cannot overlap, problem is that i do not know how to link the VertexArrays together for faster drawing or is it even possible, they will use same texture and renderStates.

I don't know a way to make this efficient atm.
Any suggestions would be gladly appreciated.
The point is to add and remove objects at runtime, and have them show per layer,(Draw order, floor->low->middle->high)) So if at one position we would have, (Candle-Floor, chair-low, bread-middle)
i would see chair with bread on it, no candle what so ever, and because i don't want to have over hundred of vertexArray draw calls i am asking for help.

8
Graphics / RenderTexture, cannot align with vertexArray
« on: April 21, 2014, 05:45:01 pm »
Hello.
When i am drawing sf::VertexArray onto a sf::RenderTexture, the sf::VertexArray is in global space and sf::RenderTexture is in local 0, 0 thus i do not know how to align those two so i would draw VertexArray with transform? that would set its world coordinate to 0, 0.

I have a sf::View that i use and it centers on a units X and Y coordinate.
i am using sfml coordinate system having 0, 0 at left down corner and x axis goes right intro + and y axis goes down intro +.

When unit is at x = 1000, y = 1000 and i want to draw something on screen i draw its position 1000, 1000 at it ends up in center of screen.
But now i have unit at x = 1000, y = 1000. The texture is supposed to start from XPos= (Unit.x - Screen_Width / 2), YPos= (Unit.y - Screen_Height / 2) but it starts with 0, thus when i draw vertexArray onto RenderTexture and then use sf::Sprite to set its position to (XPos, YPos), i don't see the VertexArray because it was out of bounds, how do i correct the position of vertexArray instead of repositioning all vertices each draw?
Code: [Select]
//Small preview code
sf::View view;
sf::RenderTexture renTex;
sf::VertexArray verArr;
sf::Vector2f unit;//Represents position
sf::RenderWindow renWin;
int Window_Width = 800;
int Window_Height = 600;
int block_unitSize = 32;
sf::renderState renState;//Used for texture

//Execution
renTex.create(Window_Width, Window_Height);//Create texture 800x600
unit = sf::Vector2f(1000.f, 1000.f);
view.setCenter(unit);
renWin.setView(view);
verArr.setPrimitiveType(sf::Quads);
//Square of a vertexArray with size of 32 at pos X,Y = 1000
verArr.append(sf::Vector2f(1000, 1000));
verArr.append(sf::Vector2f(1000+block_unitSize, 1000));
verArr.append(sf::Vector2f(1000+block_unitSize, 1000+block_unitSize));
verArr.append(sf::Vector2f(1000, 1000+block_unitSize));
//Draw verArr to renWin, the rectangle will be starting from center of screen going right down
renWin.draw(verArr, renState);
renTex.clear(sf::Color::Black);//Clear with black color
renTex.draw(verArr, renState);//The recatngle goes out of screen thus the whole renTex is black
renTex.display();
sf::Sprite spr;
spr.setTexture(renTex.getTexture());
spr.setPosition(view.getCenter().x - Window_Width /2, view.getCenter().y - Window_Height /2);
renWin.draw(spr);
So the question is, how do i get the VertexArray to draw at renTex and renWin the same thing at same position in this case?

9
Hello.
I would like to achieve night effect like from this video

It start from 0:40.
How do i achieve such a effect?
One thought is to make a Texture that will be completely black, and for each light draw following image


What are you suggestions?
The game is 2d, top down view
Example of what i attempted to make for night:


As it is clear, the light at day is too bright, but at night its colorless.
I achieve it by drawing a dark background then applying lights over it, and to be honest its not what i want visually.

10
SFML projects / The Wanderer - Lost in time
« on: March 03, 2014, 12:00:28 am »
"The project has stopped development"

"Hello World" BaneTrapper Here.
I'm self learned c++ programer with near three years of experience, my hobby is to make games along side that, i am dedicated, and persistent therefore i decided to start a team project because i did not have enough time to make each part of the game myself, currently i am just working on this project The Wanderer - Lost in time, which info you can find bellow  ;)

Acts In making:
Act 0:Demonstration
Act I: Seize the power!

Current team:
Developers: 2
Musicians: 2
Pixel Artists: 3
Story Writer: 1

Recruiting positions for:
NOTE: This project is hobby based, its focus is not to provide revenue, rather to be a learning experience along side joyful time.
-: Looking for environment builder, use tools made by us to create environment.(Make maps, take this off my hands so i can focus more on mechanics :) )

-: Looking for Pixel artist who is willing to make sprites for characters, and equipment pieces(Animations for walking, attack swing, attack bow, Cast magic, Dying/Death).

-: Also looking for developers who are willing to take a specific mechanic, and focus on it(Inventory(make items, control inventory GUI, make crafting / crafting recipes) or Menus(State machine is made, although we have some menus which are mid way done they need finishing as implementing what happends when button is pressed), and simmilar)

-: Looking for special effect creator, whatever you can make we need :). From Bird cheeps, to bush shaking, to swords clashing SE, up to spell explosion, spell tornado sound.
Whatever you can do i want it ;)

20-Sep-2015



We are designing a new world, in it characters, and areas with detailed story to experience.
My goal is to make the world dynamic, meaning your actions have impact on a world, and i am not talking about choice A or B such as, A will cause This, B will cause That. What i am talking about is a world that you can interact with everything, burning buildings, killing inhabitants of town, steal... everything has a effect. The world is alive(Meaning if you kill a towns farmer, there will be somebody who will replace him, the town needs a farmer...) and you are free to do anything anytime(Of course your actions have consequence, but if nobody saw you do it, you didn't do it...). My plan for story is for it to flow as you play, even if you engage in it or not, the clock ticks and world goes on.

Game play:
You will be in control of a single rpg character that is on his quest to unite the land under his banner. On his way he will encounter numerous characters that will require help, a interactive environment, a world to explore, and few ways to deal with certain issues. For his quest is tough, the hero will require help of some sort, companions, conquering land for his own, commanding towns, and leading his own army, All to unite the land under his banner! the quest worthy of a king, or a fool... It is yet to be told!

Quests:
No spoilers.

Official youtube: "BaneTrapper Dev" https://www.youtube.com/channel/UC8r76BkWbj9nRJL-kfSwfxA
You can find update videos there, i will try to be more regular. As in one update video each week or two.

What is to be expected in alpha:Single character control, Items that affect player (Consumables, Equipment), Environment to explore, Characters with story to tell, Quests and puzzles.

Update 5 20:Sep:2015:
I have started streaming the development, you can catch up here :

I stream Saturdays and Sundays when i wake up. If i am not working i will also stream during work days.
Added AI, currently it gets action from town what is required to do.(Harvesting and crafting). Unit will go out, harvest, and return resources.
It will also craft when town orders it as a action when it has resources to do so.
Also equipment is now dynamic, equipping a item piece has its own sprite that shows in game.
Some spell effects have been added, and updated.

11
Hello ::).
I have VertexArray holding mapSize of 50x50 that type is sf::PrimitiveType::Quads the size is 10,000
At one moment i draw 26x20 how do i implement culling on VertexArray?
I will adjust the storage as required to achieve good performance.

Unit VertexArray is holding ~50 units that type is sf::PrimitiveType::Quads and their position is at start pretty predictable but it gets chaotic as time passes because they move randomly so i have no idea how to achieve culling on them.
And The sizes of units and map can scale its not set that is why i want culling to allow me to go big.
Suggestions on sfml culling pls.

12
Hello.
I am trying to achieve a system that will handle events at 100 fps while game will run on 1-60 fps.
The issues is that the outer loop is not accurate and i will post my math, pretty sure it sould be working any tips/help?

The logic i am using goes something like this
if DesiredLoopLastTime - LastLoopTime > 0
then pause for DesiredLoopLastTime - LastLoopTime
This produces 67 fps instead of 100  :(

Code: [Select]
//Time.cpp
void Time::LoopTime()
{
//Pause here to make last loop last 10ms or desired amount
int tmpTime = threadClock.getElapsedTime().asMilliseconds();
if(10 - tmpTime > 0)
std::this_thread::sleep_for(std::chrono::milliseconds(10 - tmpTime));

dt = threadClock.restart().asMilliseconds();

if(isPaused)//Dont loop logic if paused
return;

//Thread
threadCounter++;
//Logic
logicAccumulated += dt;
if(logicAccumulated > logicRequired * 2)
logicAccumulated = logicRequired*2;
//Fps
fpsAccumulated += dt;
if(fpsAccumulated > fpsRequired)
{
fpsAccumulated -= fpsRequired;
//Update fps data
txtThread.setString("FPST:"+std::to_string(threadCounter));
threadCounter = 0;
txtLogic.setString("FPSL:"+std::to_string(logicCounter));
logicCounter = 0;
}
}

//Main.cpp
//The main while loop

while(objState.GetAppState() != en::AppState::APExit)
{
objTime.LoopTime();//Once per loop
if(objState.GetAppState() != en::AppState::APPause)
{
//objEvent.HandleEvents(objWin.Win, objState, objTime, en::EventHandleTypes::EHAll);//Once per loop //Of this type

while(objTime.logicAccumulated > objTime.logicRequired)//If logic update
{
objTime.logicAccumulated -= objTime.logicRequired;
objTime.LoopLogicTime();

objEvent.HandleEvents(objWin.Win, objState, objTime, en::EventHandleTypes::EHAll);//Once per loop //Of this type
objWin.Win.clear(sf::Color(0,0,0,255));

if(objState.GetGameState() == en::GameState::GSMainMenu)
{
objMenu.LoopMenu(objEvent, objState);
objMenu.DrawMenu(objWin.Win);
}
else if(objState.GetGameState() == en::GameState::GSGame)
{
objPlayer.LoopPlayer(objEntity, objEvent, objTime.logicRequired);
objMap.LoopMap(objEvent, objState);

objMap.DrawMap(objWin.Win);
objEntity.DrawEntity(objWin.Win);
objInventory.DrawInventory(objWin.Win);
}
else if(objState.GetGameState() == en::GameState::GSEditor)
{
objMap.LoopEditor(objEvent, objState);

objMap.DrawEditor(objWin.Win);
}
objTime.DrawTime(objWin.Win);
objEvent.ClearDataPerLoop();
}
}
else//App state == pause
{
objEvent.HandleEvents(objWin.Win, objState, objTime, en::EventHandleTypes::EHApp);//Once per loop //Of this type
}
objWin.Win.display();//Once per loop
}
This is Time and main while loop.
The inner FPS other called Logic fps is 60-61 but the Thread fps is not stable at all and varies from 60-100 and after 10-15 sec or app running it stops at ~67-70 and does not change.


EDIT::
Minimal example coming soon.

13
Hello.
Currently i am trying to design a class that would manage all drawing/sprites for each "unit" ingame.
And is that a good way to go if seeking for improved performance? if it is not then what is?

Currently i got idea of something like this
Code: [Select]
class BaseEntity//Each class that wants to be entity has to inherit this
{
int EntityVAPosition;//Vertex array position for destruction or editing
};
class EntityManager
{
public:
void AddEntity(BaseEntity & entity, sf::Vector2f Pos, sf::Vecto2f TexPos);
void RemoveEntity(BaseEntity);
};
The thinking with this is that entities will be added and removed from the VertexArray thus the options are:
1:Reconstruct the whole array each time that is done
2:Have empty holes in VertexArray and keep track of them and when entity is added fill them up.
this will most likely be a vertex array holding first index of empty VertexArray position.
When AddEntity is gonna be called, instead of appending at end its gonna check if(Vector.size > 0) and use the vertexFrom the list instead of expending the VertexArray, i think this will be efficient.

Each entity is gonna be 4Verices and the primitive type used is Quads

That being said, id like to get ideas from a tutorial on Entity manager using sfml.
I went digging but i think the name of what i am looking for is not called "Entity manager".

14
Graphics / Drawing text vs making a render texture once and then draw
« on: November 19, 2013, 11:42:16 pm »
Hello.
Hint:I simplified the question as best i know, therefore the request may seem a little OOD.

I am wondering the following since i have no idea how cpu consuming is to draw text?
Question 1:If i have wall of text is it more cpu efficient to draw to render texture(that will continue to live after current loop) and then draw the render texture each loop(to screen) or draw the text itself(to the screen).
Question 2:If i have text that is gonna change each 5 seconds that will hold about 20 characters, draw it onto render texture once and then use it until the text is changed upon witch time i will redraw the renderTexture or draw the text itself to the screen?

15
Hello, unsure if this is correct place to post this because i am unsure is this hardware or sfml related.
So to explain my issue the best i will first describe when it occurred.

I have a screen filled with map(as walkable terrain, grass), on this map there are sprites like barrel, houses and other stuff related.

The issue starts when i move camera, everything gets motion blur or like 60-75% transparency and is drawn again where it used to be before this loop, tried to get screenshot so many times but i failed every single time.

I do not understand what is the issue here, its like the old buffer got drawn again but with 60-75% transparency this time.
I do only have one display() call to render window and i am hoping you got some idea what i can do to turn it off.

What IMO i need to modify is GL states, turning off AntiAliasing and other shader effects, but i am no expect and i may be mistaken massively.

Pages: [1] 2 3