Its almost bedtime already for me. We are a few timezones off :D.

I've attached the modified gfxtest.cc that I used to test the new
code. You can do what you want with it.

Let me know if there is anything else that needs worked on!


On Feb 8, 2008 2:45 PM, Tyler Nielsen <[EMAIL PROTECTED]> wrote:
> Well, I'm not going to complain when he's doing so much more, faster than I
> have been.  My plan is to get this stuff commited tonight after I put the
> kids to bed.  (Roughly 8 hours from now).  If you have a usage example, it
> will help speed up my testing.  But anything you want to do before I commit
> is fine.  If you want me to hold off until you make one more pass that's
> fine also.
>
> Tyler
>
>
>
> On Feb 8, 2008 2:31 PM, Rian Shelley <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> > On Feb 8, 2008 2:05 PM, Kai Sterker <[EMAIL PROTECTED]> wrote:
> > > On Feb 8, 2008 5:41 PM, Rian Shelley <[EMAIL PROTECTED]> wrote:
> > >
> > > > I believe that I have successfully implemented all of your
> suggestions:
> > >
> > > That was fast :-).
> > It doesnt take much time, I just have to sit down and do it
> >
> >
> > >
> > > > All of the underscores in the method names should be gone
> > >
> > > Oops. Should have been the other way round (i.e. conditional_purge or
> > > set_max_mem). Sorry, if I confused you.
> >
> > I guess I'm not used to using them, so I was going through and
> > correcting all of my usual style mistakes :D
> >
> >
> > >
> > >
> > > One final thing that could be done now, is generating the Python
> > > wrappers for the new cache class. That is usually achieved by
> > > including new classes in the corresponding module under
> > > src/py-wrappers/adonthell. In our case, that would be adding the line
> > > '%include "gfx/surfacecacher.h"' to the end of py_gfx.i. SWIG will
> > > then take care of the rest.
> >
> > I've done a lot of C++ and a lot of Python, but this will be the first
> > time I've ever done both...
> >
> >
> > >
> > > With the wrapper in place, a test script could be written (see
> > > examples in the test/ directory) that would serve two purposes:
> > > * act as a usage example
> > > * allow (some) regression testing in case of code changes
> >
> > I've actually already written one. I just didn't include it in the zip
> file.
> >
> >
> > >
> > > Since Tyler will integrate your code with his own, I'm not sure how
> > > much sense it makes to do that right now, as things might change a
> > > bit. But if you want to get more familiar with that aspect of the
> > > engine, you could give it a shot.
> >
> > I'll wait and see what he thinks.
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > Adonthell-devel mailing list
> > Adonthell-devel@nongnu.org
> > http://lists.nongnu.org/mailman/listinfo/adonthell-devel
> >
>
>
> _______________________________________________
> Adonthell-devel mailing list
> Adonthell-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/adonthell-devel
>
>
#include <iostream>
#include "gfx/gfx.h"
#include "base/timer.h"
using std::cout;
//#include "main/adonthell.h"

//class AdonthellApp : public adonthell::app
//{

int main(int argc, char * argv[])
//int main()
{
	gfx::init("sdl");
	gfx::screen::set_video_mode(640, 480);
	gfx::screen::get_surface()->fillrect(0,0,100,100,0x0000ff);
	const gfx::surface * s = gfx::surface_cache("catseye.png");
	int j;
	for (j = 0; j < 100; j++)
		s->draw(rand() % 640,rand() % 480);
	gfx::screen::update();
	s->draw(10, 10);
	gfx::screen::update();
	//*
	for (j = 0; j < 100; j++)
	{
		cout << "catseye.png has " << gfx::surfaces->countsurface("catseye.png") << " references\n";
		cout << "surfaces is using " << gfx::surfaces->getusedmem() << " bytes out of " << gfx::surfaces->getmaxmem() << " bytes\n";
		const gfx::surface* t = gfx::surfaces->getsurfaceonly("catseye.png");
	}
	for (j = 0; j < 101; j++)
	{
		cout << "catseye.png has " << gfx::surfaces->countsurface("catseye.png") << " references\n";
		cout << "surfaces is using " << gfx::surfaces->getusedmem() << " bytes out of " << gfx::surfaces->getmaxmem() << " bytes\n";
		gfx::surfaces->freesurface("catseye.png");
	}
	gfx::surfaces->purge();
	cout << "catseye.png has " << gfx::surfaces->countsurface("catseye.png") << " references\n";
	cout << "surfaces is using " << gfx::surfaces->getusedmem() << " bytes out of " << gfx::surfaces->getmaxmem() << " bytes\n";
	gfx::surfaces->freesurface("catseye.png");
	
	gfx::surfaces->setmaxmem(1000);
	const gfx::surfaceref* test = gfx::surfaces->getsurface("catseye.png");
	cout << "catseye.png has " << gfx::surfaces->countsurface("catseye.png") << " references when created as a reference\n";
	cout << "surfaces is using " << gfx::surfaces->getusedmem() << " bytes out of " << gfx::surfaces->getmaxmem() << " bytes\n";
	delete test;
	gfx::surfaces->conditionalpurge();

	cout << "catseye.png has " << gfx::surfaces->countsurface("catseye.png") << " references\n";
	cout << "surfaces is using " << gfx::surfaces->getusedmem() << " bytes out of " << gfx::surfaces->getmaxmem() << " bytes\n";

	// */
	base::timer::sleep(2000);
	return 0;
}
//} theApp;
_______________________________________________
Adonthell-devel mailing list
Adonthell-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/adonthell-devel

Reply via email to