Jump to content

  • Log In with Google      Sign In   
  • Create Account


Psilobe

Member Since 30 Jan 2009
Offline Last Active Feb 21 2013 12:14 AM

#5026560 Fragmenting a mesh using csg operations

Posted by Psilobe on 28 January 2013 - 04:41 PM

Interesting. At first I thought using csg for this would be a good idea but as it would seem that implementing csg from scratch would be out of the question because it would probably take too much time. But experimenting with this using a ready made library might be a fun thing to do if I have the time sometime.

 

That last article was really interesting and took up several interesting topics, thanks!




#5011381 Game from Scratch ? C++

Posted by Psilobe on 16 December 2012 - 04:36 PM

Learning a language is important but what is even more so is that you understand different programming principles. Functions, variables, comparisons, operators, containers, loops etc.

I suggest starting with writing small programs that do different things, not just games. Find different ways to manipulate data. Find and solve your own small problems. Try to implement a basic sorting algorithm, that sort of stuff.

When it comes to simple games that doesn't require anything fancy I generally divide the code in to three parts. Input, read user input and handle it accordingly. Update, update the game state accordingly to the game rules. Drawing, draw everything to the screen.

If I want to put together a simple game I just need to figure out how to represent the game state and then fill in these three functions.


#4993345 Lua troubles

Posted by Psilobe on 24 October 2012 - 01:06 AM

nox_pp I've also found that site when searching for info. Anyway thanks, got it to work after switching place with luaL_dofile() and init() and changed the number of arguments.

I thought there were three arguments since the c++ function I want to call from lua takes three arguments bat the call was for the lua function which only took one. And I needed the lua function to deliver a class pointer as argument when calling my spawn function from lua.

So a big thanks to you! Posted Image


#4992904 Lua troubles

Posted by Psilobe on 22 October 2012 - 03:16 PM

I'm learning how to use lua together with c++ but I've run in to some problems where I got an access violation which I cant sort out and after searching and reading I must finally ask for help.

At the bottom at the lua_call I get the access violation and I'm using lua 5.2



[source lang="cpp"]static void spTr(cMap *m,int x, int y){ m->spawnTree(x,y);}static int spTrWra(lua_State *L){ int n = lua_gettop(L); if(n!=3) { lua_pushstring(L, "Wrong number of arguments"); lua_error(L); } if(!lua_islightuserdata(L,1)) { lua_pushstring(L, "wrong data type"); lua_error(L); } cMap* M = (cMap*)lua_touserdata(L,1); int x = lua_tointeger(L,2); int y = lua_tointeger(L,3); spTr(M,x,y); return 0;}[/source]


PARTNERS