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

Pages: [1]
SFML projects / Re: "Our Dear Paper Fighters" - Top down shooter
« on: March 23, 2016, 01:25:01 pm »
Love the art style and the idea :D (that firewall tho :P)
The only 'bad' thing for me is that those fast paced games make me a little sick :S

Buen trabajo!

General / Re: Tiled to SFML using lua.
« on: November 26, 2015, 09:54:48 am »
OK so,what you do is put the value you want at the top of the stack and then get it as an integer.

I will check the manpages and see if I can understand this.


General / Tiled to SFML using lua.
« on: November 25, 2015, 11:08:41 pm »
Hey guys!

I found Tiled (http://www.mapeditor.org/) quite a while ago (I was using Unity) and found it really useful.

I want to be able to load "tiled.lua" files into my C++ program.

I am using LuaBridge(https://github.com/vinniefalco/LuaBridge) to do most of the heavy lifting.

But now I am stuck.
Let me show you how a Tiled map looks in lua:

  version = ""
  luaversion = ""
    name = "Rock"
    name = "Grass"

So yeah it is a lot of information in a table.

Using LuaBridge you can use: getGlobal(luaState,"key") to get a handler to that key value and then cast it into the apropiate type.
But,how do I "get" things without using a name(a char*) just using an id for example like:

lua_State* L = luaL_newstate();
luaL_dofile(L, "../data/scripts/untitled.lua");
lua_pcall(L, 0, 0, 0);
LuaRef globalData = getGlobal(L, "globalData");
LuaRef someKey = getGlobal(L,2);//How to do this

I am not sure how it should be done :C

Sorry it the answer is really obvious but I can´t find it :C

General / Re: Using a singleton pattern for a resource manager.
« on: November 23, 2015, 03:09:57 pm »
Thanks for your time and help guys, I ended up encapsulating it into a singleton, I think its cleaner than having to reference in around the code.

See you.

General / Re: Using a singleton pattern for a resource manager.
« on: November 23, 2015, 01:17:58 pm »
Your options are:
  • Don't use global classes
  • Don't instantiate classes in the global scope

I suggest to not use global classes, it makes a lot harder to reason about your application. Instead just pass around references to your resource manager and reduce the points where its used.

Yeah I tried to reference it to the objects that need to use it but at the end it goes really deep and it is just a nightmare.
Then the singleton will work right? As it just holds a pointer.
See you!

General / Using a singleton pattern for a resource manager.
« on: November 23, 2015, 12:16:02 pm »
Before getting to the question let me explain my problem.

I´ve made a simple ResourceManager where I could add/get resources (sf::Textures,sf::Font etc) and I made it static inside a "Types" file (yeah , you start seeing the problem :D )

When I close the app it will crash (ntdll exception), that confused me a lot.I put down a few breakpoint and the exception was outside of my app.
So I searched google for an answer and I found that I can not use static global things with SFML because we dont know when they will be destroyed and that will cause a few problems.

After this small introduction ;) , now the question.

How do I make a static/global class?

Can I use a singleton pattern like this:

#include <string>

class Logger{
   static Logger* Instance();
   bool openLogFile(std::string logFile);
   void writeToLogFile();
   bool closeLogFile();

   Logger(){};  // Private so that it can  not be called
   Logger(Logger const&){};             // copy constructor is private
   Logger& operator=(Logger const&){};  // assignment operator is private
   static Logger* m_pInstance;

That pattern holds the class as a static pointer, will be this a problem?

Thank you guys!

SFML projects / Re: Screenshot Thread
« on: August 19, 2015, 12:37:48 am »
Working on my engine using SFML :D really happy with the result!

I just made a few classes and objects to work with the API (loving it) I will keep adding more stuff!

Pages: [1]