[QUOTE=BlkDucky;28150267]:irony:
[editline]19th February 2011[/editline]
Got some basic combat going. Still don't have any text output on the actual screen, but, eh. :effort:
[media]http://gyazo.com/b589587f7545bf522e8e115e372f21de.png[/media][/QUOTE]
Do a class array with text inside it and just have like Datetime and Text just and do a foreach loop in your draw method and have a dead time or something and just do floating text it's very good
Quick question: How is a table in Lua passed to functions? For example, if I did something like this:
[cpp]
// This would return a new table that would be an instance of Player.
static int NetPlayer(lua_State *Lua)
{
// Allocate memory for a pointer to to object
Player** p = (Player**)lua_newuserdata(Lua, sizeof(Player*));
// Get arguments and create a instance
const char* Name = luaL_checkstring (Lua, 1);
int Level = luaL_checknumber (Lua, 2);
*p = new Player(Name, Level);
// Use global table 'Player' as metatable
lua_getglobal(L, "Player");
lua_setmetatable(L, -2);
return 1;
}
// This would create the metatable Player
static const luaL_Reg LuaPlayer::Functions[] = {
{"new", LuaPlayer::New},
{"getLevel", LuaPlayer::GetLevel},
{NULL, NULL}
};
void LuaPlayer::Register(lua_State *Lua)
{
luaL_register(Lua, "Player", LuaPlayer::Functions);
lua_pushvalue(Lua,-1);
lua_setfield(Lua, -2, "__index");
}
[/cpp]
[lua]
-- Create a new player named Bob @ level 10
local bob = Player:new("Bob", 10);
print("Bob is level: " .. bob:getLevel())
[/lua]
Would the C function LuaPlayer::getLevel have the table 'bob' passed as the first argument?
I'm currently working on the Matrix4 class of my OpenGL wrapper and I'm wondering if I should make it use column-major or row-major order. Of course OpenGL expects column-major order, but on the other hand it feels hacky to force the class to use column-major order too.
[b]Class uses column-major order[/b]
[list][*]Programmer can pass the internal float* array to OpenGL directly
[*]Difficult to program, as the order is non-standard in C++[/list]
[b]Class uses row-major order[/b]
[list][*]Code makes more sense, e.g.
[cpp]float identity[] = { 1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1 );[/cpp]
[*]Matrix requires transposing to be loaded in OpenGL[/list]
[QUOTE=Orki;28150766]Do a class array with text inside it and just have like Datetime and Text just and do a foreach loop in your draw method and have a dead time or something and just do floating text it's very good[/QUOTE]
No. Render the text to a render target and as the text is updated re-render to the render target. Use something like std::list<std::string> and pop text off the front when you are done with it.
[QUOTE=DevBug;28150781]Would the C function LuaPlayer::getLevel have the table 'bob' passed as the first argument?[/QUOTE]
These two lines are equivalent:
[lua]bob.getLevel( bob )
bob:getLevel()[/lua]
[QUOTE=Overv;28150887]These two lines are equivalent:
[lua]bob.getLevel( bob )
bob:getLevel()[/lua][/QUOTE]
Thanks.
i just replaced 215 lines of non working code that took me 2 days to write, with 15 lines of working code that took me 10 minutes to write
Fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu-
This is for a physics engine by the way
[QUOTE=Sakarias88;28149595]Working on some shaders again.
Working on a water fog shader.
The water gets more murky the deeper it is and it gets less murky if you are closer to the surface.
[img_thumb]http://img403.imageshack.us/img403/9825/39521511.jpg[/img_thumb]
I also managed to transform the water shader into a plastic blow-up tent shader.
[img_thumb]http://img827.imageshack.us/img827/3443/plastic.jpg[/img_thumb][/QUOTE]
What are you doing this in OpengL or DirectX?
Also is this for a school/uni thing or are you using tutorials?
If you're using tutorials could you link please?
[QUOTE=Orki;28150766]a class array with text inside it and just have like Datetime and Text just and do a foreach loop in your draw method and have a dead time or something and just do floating text it's very good[/QUOTE]
what
[QUOTE=DevBug;28150781]Quick question: How is a table in Lua passed to functions? For example, if I did something like this:
[cpp]
// This would return a new table that would be an instance of Player.
static int NetPlayer(lua_State *Lua)
{
// Allocate memory for a pointer to to object
Player** p = (Player**)lua_newuserdata(Lua, sizeof(Player*));
// Get arguments and create a instance
const char* Name = luaL_checkstring (Lua, 1);
int Level = luaL_checknumber (Lua, 2);
*p = new Player(Name, Level);
// Use global table 'Player' as metatable
lua_getglobal(L, "Player");
lua_setmetatable(L, -2);
return 1;
}
// This would create the metatable Player
static const luaL_Reg LuaPlayer::Functions[] = {
{"new", LuaPlayer::New},
{"getLevel", LuaPlayer::GetLevel},
{NULL, NULL}
};
void LuaPlayer::Register(lua_State *Lua)
{
luaL_register(Lua, "Player", LuaPlayer::Functions);
lua_pushvalue(Lua,-1);
lua_setfield(Lua, -2, "__index");
}
[/cpp]
[lua]
-- Create a new player named Bob @ level 10
local bob = Player:new("Bob", 10);
print("Bob is level: " .. bob:getLevel())
[/lua]
Would the C function LuaPlayer::getLevel have the table 'bob' passed as the first argument?[/QUOTE]
Stuff like this should probably go in the WDYNHW thread.
[QUOTE=BlkDucky;28150267]:irony:
[editline]19th February 2011[/editline]
Got some basic combat going. Still don't have any text output on the actual screen, but, eh. :effort:
[media]http://gyazo.com/b589587f7545bf522e8e115e372f21de.png[/media][/QUOTE]
Dude, you're amazing.
-snip-
-snip-
is it possible to write the direct content of a pointer (\nd thus a memory address) to a file?
And then later on read that file and write it to memory just like it was before?
[QUOTE=BlkDucky;28150267]Still don't have any text output on the actual screen[/QUOTE]
[img]http://gyazo.com/eac661ddd217929423425fad9b296d24.png[/img]
This'll do, I think. I think the font fits the game really well. y/n?
[editline]19th February 2011[/editline]
[QUOTE=spear;28151644]Dude, you're amazing.[/QUOTE]
I'm going to assume you meant to quote Sakarias88 and misclicked or something because that stuff is a lot more impressive. :v:
Edit: Wait, are you agreeing that the font fits well or because I'm not amazing? :saddowns:
[QUOTE=likesoursugar;28151657]That's the way opengl manage matrices but it's totally up to you.[/QUOTE]
I'm pretty sure that's not how OpenGL manages matrices. ([url]http://en.wikipedia.org/wiki/Row-major_order[/url])
I got pissed off writing a font renderer in D so I've gone back to my original codebase :v:
[img]http://img.meteornet.net/uploads/3s5lgax7p/ss.PNG[/img]
Need to fix up the lighting because it's pretty slow at the moment. Then I'll move on to fixing the networking and then start embedding lua so I can get some gameplay going.
[QUOTE=Overv;28151895]I'm pretty sure that's not how OpenGL manages matrices. ([url]http://en.wikipedia.org/wiki/Row-major_order[/url])[/QUOTE]
woops you're right.
[url]http://www.opengl.org/sdk/docs/man/xhtml/glMultMatrix.xml[/url] - deprecated but still the right order.
[quote]
If the current matrix is C and the coordinates to be transformed are v = v ⁡ 0 v ⁡ 1 v ⁡ 2 v ⁡ 3 , then the current transformation is C × v , or
c ⁡ 0 c ⁡ 4 c ⁡ 8 c ⁡ 12 c ⁡ 1 c ⁡ 5 c ⁡ 9 c ⁡ 13 c ⁡ 2 c ⁡ 6 c ⁡ 10 c ⁡ 14 c ⁡ 3 c ⁡ 7 c ⁡ 11 c ⁡ 15 × v ⁡ 0 v ⁡ 1 v ⁡ 2 v ⁡ 3
[/quote]
[QUOTE=Catdaemon;28151911]I got pissed off writing a font renderer in D so I've gone back to my original codebase :v:
[img_thumb]http://img.meteornet.net/uploads/3s5lgax7p/ss.PNG[/img_thumb]
Need to fix up the lighting because it's pretty slow at the moment. Then I'll move on to fixing the networking and then start embedding lua so I can get some gameplay going.[/QUOTE]
This seems familiar... Have you posted this before?
[QUOTE=BlkDucky;28151974]This seems familiar... Have you posted this before?[/QUOTE]
Yes, he has.
[QUOTE=BlkDucky;28151974]This seems familiar... Have you posted this before?[/QUOTE]
Yeah a long while ago. I gave up on the engine because I was having performance issues that I thought were related to the garbage collector.. but it turns out it was just my computer. It runs fine now I've fixed it. A huge waste of time all round.
I have however since then taken the liberty of stealing the tiles from space station 13 :v:
[QUOTE=Catdaemon;28151911]I got pissed off writing a font renderer in D so I've gone back to my original codeb....[/QUOTE]
Nice but could you please explain this :O
[img]http://gyazo.com/c536542a7abcf8130f82ed39a4296651.png[/img]
[QUOTE=likesoursugar;28152017]Nice but could you please explain this :O
[img_thumb]http://gyazo.com/c536542a7abcf8130f82ed39a4296651.png[/img_thumb][/QUOTE]
The lights are inside the walls. I currently have the positions hard coded but I changed the map. Causes weird glitches like that. I'm waiting on my friend to send me his RIFF library so I can compile it and change that :p
I love the look of that console!
[QUOTE=Richy19;28151809]is it possible to write the direct content of a pointer (\nd thus a memory address) to a file?
And then later on read that file and write it to memory just like it was before?[/QUOTE]
The content, yes. However you can't guarantee the same memory address when restoring it. And apparently weird stuff can happen if you just move memory around to create a non-POD type instead of using the appropriate constructor or operator.
Can't tell you specifics, though I remember Chandler saying that for classes with vtables that table could be destroyed.
Trying to use Farseer Physics with SFML but the shit just wont collide :(
[QUOTE=Frugle;28152415]Trying to use Farseer Physics with SFML but the shit just wont collide :([/QUOTE]
Did you do the right Meter/Pixel Conversion. Also in Farseer the Position is the center of the shape.
[QUOTE=Overv;28150796]I'm currently working on the Matrix4 class of my OpenGL wrapper and I'm wondering if I should make it use column-major or row-major order. Of course OpenGL expects column-major order, but on the other hand it feels hacky to force the class to use column-major order too.[/QUOTE]
Column major. You can easily switch to thinking in column major, too - it's all just conventions.
[QUOTE=commander204;28152502]Did you do the right Meter/Pixel Conversion. Also in Farseer the Position is the center of the shape.[/QUOTE]
Shit.. I had no idea about those.
[QUOTE=ZeekyHBomb;28152406]The content, yes. However you can't guarantee the same memory address when restoring it. And apparently weird stuff can happen if you just move memory around to create a non-POD type instead of using the appropriate constructor or operator.
Can't tell you specifics, though I remember Chandler saying that for classes with vtables that table could be destroyed.[/QUOTE]
yea it doesnt have to be the same memory address.
Its just to do some testing about making image files and other file types harder to view by others
[editline]19th February 2011[/editline]
[QUOTE=Frugle;28152651]Shit.. I had no idea about those.[/QUOTE]
Is it easier to use than box2D?
tried that a while back and it looked hard to mix them together.
--Oh wait seems farseer is C# only, nevermind
Sorry, you need to Log In to post a reply to this thread.