exploring golgotha source code
BTW, the above was me. I''ve had that site for over a year. Anyway lotsa luck with the Golgotha source. It''s a major mess.
quote: Original post by Hootie
BTW, the above was me. I''ve had that site for over a year. Anyway lotsa luck with the Golgotha source. It''s a major mess.
He could''ve just done it for the ''fun'' of it. ha ha.
Or maybe he just wanted to learn stuff. Learning by doing is always the best way.
By the way. Anybody know if someone has tried to translate the source to VB?
Also, Would any of this source work on BeOS????
BeS
It's Da BOMB Baby!!!
BeSIt's Da BOMB Baby!!!. o O ~ A little nonsense now and then,is relished by the wisest men~ O o .-- Willy Wonka
The first class to get to know is the application class
''i4_application_class''. This class takes care of initilization
and cleanup of the major subsystems and provides methods for
getting input, updating, and displaying. This is the typical
MVC (model, veiw, controller) division of labor. The methods
are called ''get_input'', ''calc_model'', and ''refresh'' and should
be overriden in your derived app class to do whats right for
your application.
Below is a simple example program that loads a file and quits
on the first loop. The ''init'' method is overriden but in this
case its not needed because the only call I make is to the
base class ''init'' method. The ''calc_model'' function calls
''LoadFile'' and then ''quit''. Calling quit causes a break out
of the main loop after the function returns. The LoadFile
function is an example of how to read a file. I wont explain
that class right now but its pretty similar to other file
classes I''ve seen.
This description is probably not very good so if you have any
questions let me know.
- Brad
#include "app/app.h"
#include "file/file.h"
#include "string/string.h"
static void LoadFile(void)
{
i4_const_str fileName("project.i4");
i4_file_class *fp = i4_open(fileName, I4_READ);
if (fp != NULL)
{
char buffer[128];
fp->read(buffer, sizeof(buffer));
delete fp;
}
}
class test_app : public i4_application_class {
public:
void init()
{
i4_application_class::init();
}
void calc_model()
{
LoadFile();
quit();
}
char *name()
{
return "test_app";
}
};
void i4_main(w32 argc, i4_const_str *argv)
{
test_app test;
test.run();
}
---------------------------------------
Here is the project file in i4_make format
[executable gamedev]
use file=../../i4/project.i4 app
use file=../../i4/project.i4 X11_display
use file=../../i4/project.i4 dx5_display
use file=../../i4/project.i4 math
use file=../../i4/project.i4 lisp
use file=../../render/project.i4 render
gamedev.cc
It can be converted to a VC++ project as described earlier.
''i4_application_class''. This class takes care of initilization
and cleanup of the major subsystems and provides methods for
getting input, updating, and displaying. This is the typical
MVC (model, veiw, controller) division of labor. The methods
are called ''get_input'', ''calc_model'', and ''refresh'' and should
be overriden in your derived app class to do whats right for
your application.
Below is a simple example program that loads a file and quits
on the first loop. The ''init'' method is overriden but in this
case its not needed because the only call I make is to the
base class ''init'' method. The ''calc_model'' function calls
''LoadFile'' and then ''quit''. Calling quit causes a break out
of the main loop after the function returns. The LoadFile
function is an example of how to read a file. I wont explain
that class right now but its pretty similar to other file
classes I''ve seen.
This description is probably not very good so if you have any
questions let me know.
- Brad
#include "app/app.h"
#include "file/file.h"
#include "string/string.h"
static void LoadFile(void)
{
i4_const_str fileName("project.i4");
i4_file_class *fp = i4_open(fileName, I4_READ);
if (fp != NULL)
{
char buffer[128];
fp->read(buffer, sizeof(buffer));
delete fp;
}
}
class test_app : public i4_application_class {
public:
void init()
{
i4_application_class::init();
}
void calc_model()
{
LoadFile();
quit();
}
char *name()
{
return "test_app";
}
};
void i4_main(w32 argc, i4_const_str *argv)
{
test_app test;
test.run();
}
---------------------------------------
Here is the project file in i4_make format
[executable gamedev]
use file=../../i4/project.i4 app
use file=../../i4/project.i4 X11_display
use file=../../i4/project.i4 dx5_display
use file=../../i4/project.i4 math
use file=../../i4/project.i4 lisp
use file=../../render/project.i4 render
gamedev.cc
It can be converted to a VC++ project as described earlier.
- Brad Pickeringhttp://home.earthlink.net/~uubp/Home for organically grown games
Below is an example of how to read and get values from golgotha config files. These files are usually stored in .res files. here is an example:
------------- test.res -----------
a = 5
b = 6
op = "add"
------------- end ----------------
// this function demonstrates loading a string resource
// file and getting some values
static void GetStringResources(void)
{
// load a string resource file
i4_string_man.load("test.res");
// get some integer values
int a = i4getn("a");
int b = i4getn("b");
// get a string value
const i4_const_str &op = i4gets("op");
// do something
int r;
if (i4_const_str("add") == op)
r = a + b;
else if (i4_const_str("sub") == op)
r = a - b;
// set a string resource from memory
char buffer[512];
sprintf(buffer, "result = %d\n", r);
i4_string_man.load_buffer(buffer, "buffer");
}
- Brad Pickering
http://home.earthlink.net/~uubp/
Home for organically grown games
------------- test.res -----------
a = 5
b = 6
op = "add"
------------- end ----------------
// this function demonstrates loading a string resource
// file and getting some values
static void GetStringResources(void)
{
// load a string resource file
i4_string_man.load("test.res");
// get some integer values
int a = i4getn("a");
int b = i4getn("b");
// get a string value
const i4_const_str &op = i4gets("op");
// do something
int r;
if (i4_const_str("add") == op)
r = a + b;
else if (i4_const_str("sub") == op)
r = a - b;
// set a string resource from memory
char buffer[512];
sprintf(buffer, "result = %d\n", r);
i4_string_man.load_buffer(buffer, "buffer");
}
- Brad Pickering
http://home.earthlink.net/~uubp/
Home for organically grown games
- Brad Pickeringhttp://home.earthlink.net/~uubp/Home for organically grown games
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement