int main(int argc, char **argv) { static KCmdLineOptions options[] = { {"show", I18N_NOOP("Show window on startup"), 0}, {"kwalletd", I18N_NOOP("For use by kwalletd only"), 0}, {"+name", I18N_NOOP("A wallet name"), 0}, KCmdLineLastOption }; KAboutData about("kwalletmanager", I18N_NOOP("KDE Wallet Manager"), "1.1", I18N_NOOP("KDE Wallet Management Tool"), KAboutData::License_GPL, I18N_NOOP("(c) 2003,2004 George Staikos"), 0, "http://www.kde.org/"); about.addAuthor("George Staikos", I18N_NOOP("Primary author and maintainer"), "*****@*****.**"); about.addAuthor("Isaac Clerencia", I18N_NOOP("Developer"), "*****@*****.**"); KCmdLineArgs::init(argc, argv, &about); KCmdLineArgs::addCmdLineOptions(options); if (!KUniqueApplication::start()) { return 0; } MyApp a; KWalletManager wm; wm.setCaption(i18n("KDE Wallet Manager")); a.setMainWidget(&wm); KGlobal::dirs()->addResourceType("kwallet", "share/apps/kwallet"); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if (args->isSet("show")) { wm.show(); } if (args->isSet("kwalletd")) { wm.kwalletdLaunch(); } for (int i = 0; i < args->count(); ++i) { QString fn = QFileInfo(args->arg(i)).absFilePath(); KMimeType::Ptr ptr; if (QFile::exists(fn) && (ptr = KMimeType::findByFileContent(fn)) && ptr->is("application/x-kde-wallet")) { wm.openWalletFile(fn); } else { wm.openWallet(args->arg(i)); } } args->clear(); return a.exec(); }
int main(int argc,char *argv[]) { AGMain main; MyApp app; AntargisView *av=new AntargisView(0,AGRect(0,0,100,100),Pos3D(0,0,0)); int x,y,z; int w=64; int s=0; Terrain t(16,16); AGSurface ms; int test=4; if(argc>1) test=atoi(argv[1]); if(test==1) { ms=test1(); av->insert(new VoxelImage(ms,Pos3D(0,0,0))); } if(test==2) { ms=ball(); av->insert(new VoxelImage(ms,Pos3D(0,0,0))); } else if(test==3) { ms=getTerrain(t.getInfo(2,0)); av->insert(new VoxelImage(ms,Pos3D(0,0,0))); } else if(test==4) { ms=getTerrain(t.getInfo(1,0)); av->insert(new VoxelImage(ms,Pos3D(0,0,0))); ms=getTerrain(t.getInfo(2,0)); av->insert(new VoxelImage(ms,Pos3D(64,0,0))); ms=getTerrain(t.getInfo(1,1)); av->insert(new VoxelImage(ms,Pos3D(32,0,-32))); ms=getTerrain(t.getInfo(2,1)); av->insert(new VoxelImage(ms,Pos3D(64+32,0,-32))); } else if(test==5) { int x,y; for(int x=0;x<4;x++) for(int y=0;y<4;y++) { ms=getTerrain(t.getInfo(x,y)); av->insert(new VoxelImage(ms,Pos3D(x*64+(y%2)*32,0,-y*32))); } } else if(test==6) { SplineMap<float> m(16,16,50); SplineMap<float> gm(16,16,20); int w=64; VoxelView v(w,w*2,Pos3D(0,0,0),true); for(int x=0;x<w;x++) for(int z=0;z<w;z++) { float mx=x/16.0; float mz=z/16.0; float h=m.get(mx,mz); for(int y=0;y<h;y++) { float a=std::min(1.0f,h-y); // cdebug(a); v.set(Pos3D(x,y,z),Color(0xAA,0xAA,0,a)); } // grass above float gh=rand()%int(gm.get(mx,mz)); if(gh>0) for(int y=0;y<gh;y++) { float a=1.0f-(y/gh); // cdebug(a); v.set(Pos3D(x,y+h,z),Color(0,0xAA,0,a)); } } /* // small ball above for(int x=0;x<8;x++) for(int y=0;y<8;y++) for(int z=0;z<8;z++) { int mx=x-4; int my=y-4; int mz=z-4; if(sqrt(mx*mx+my*my+mz*mz)<4) v.set(Pos3D(x+10,y+40,z+20),Color(0xAA,0,0)); } */ av->insert(new VoxelImage(v.getSurface(),Pos3D(0,0,0))); } else if(test==7) { float v0=-20; float v1=60; float v2=60; float v3=-20; float v4=0; float v5=0; float v6=0; int x; SDL_Surface *s=getScreen().surface(); Color c(0,0,1); for(x=0;x<32;x++) { int y=spline2(x/32.0,v0,v1,v2);//,v3); sge_PutPixel(s,x,y+50,c.toColor(s)); } for(x=0;x<32;x++) { int y=spline2(x/32.0,v1,v2,v3);//,v4); sge_PutPixel(s,x+32,y+50,c.toColor(s)); } for(x=0;x<32;x++) { int y=spline2(x/32.0,v2,v3,v4);//,v5); sge_PutPixel(s,x+64,y+50,c.toColor(s)); } for(x=0;x<32;x++) { int y=spline2(x/32.0,v3,v4,v5);//,v6); sge_PutPixel(s,x+96,y+50,c.toColor(s)); } SDL_Flip(s); // SDL_Delay(1000); } else if(test==8) { float v0=-20; float v1=60; float v2=60; float v3=-20; float v4=0; float v5=0; float v6=0; int x; SDL_Surface *s=getScreen().surface(); Color c(1,0,1); for(x=0;x<32;x++) { int y=spline3(x/32.0,v0,v1,v2,v3); sge_PutPixel(s,x,y+50,c.toColor(s)); } for(x=0;x<32;x++) { int y=spline3(x/32.0,v1,v2,v3,v4); sge_PutPixel(s,x+32,y+50,c.toColor(s)); } for(x=0;x<32;x++) { int y=spline3(x/32.0,v2,v3,v4,v5); sge_PutPixel(s,x+64,y+50,c.toColor(s)); } for(x=0;x<32;x++) { int y=spline3(x/32.0,v3,v4,v5,v6); sge_PutPixel(s,x+96,y+50,c.toColor(s)); } SDL_Flip(s); // SDL_Delay(1000); } else if(test==9) { SplineMap<float> m(64,64,50); int w=64; VoxelView v(w,w*2,Pos3D(0,0,0),false); int z=0; for(int x=0;x<w;x++) { float h=20+x/16.0; for(int y=0;y<h;y++) { float a=std::min(1.0f,h-y); // if(a<1) if(a>0) { cdebug(a); v.set(Pos3D(x,y,z),Color(0xFF,0xFF,0xFF,a));//Color(0xAA*a,0xAA*a,0));//,a)); } } } av->insert(new VoxelImage(v.getSurface(),Pos3D(0,0,0))); } else if(test==10) { SDL_Surface *s=getScreen().surface(); for(int x=0;x<100;x++) { float h=20+x/16.0; for(int y=0;y<h;y++) { float a=std::min(1.0f,h-y); if(a>0) { sge_PutPixelAlpha(s,x,100-y,SDL_MapRGBA(s->format,0xFF,0xFF,0xFF,a*0xFF),a*0xFF); } } } SDL_Flip(s); SDL_Delay(1000); } else if(test==11 || test==12) { int w=8; SplineMap<float> m(POINTS_PER_TILE*(w+2),POINTS_PER_TILE*(w+2),40); SplineMap<float> gm(POINTS_PER_TILE*(w+2),POINTS_PER_TILE*(w+2),10); if(test==12) w=2; for(int y=0;y<w;y++) for(int x=0;x<w;x++) { int mx=x*(POINTS_PER_TILE); int my=y*(POINTS_PER_TILE/2); if(y&1) mx+=(POINTS_PER_TILE/2); av->insert(new VoxelImage(makeTerrainTile(m,gm,mx,my),Pos3D(mx*TILE_WIDTH/POINTS_PER_TILE,0,my*TILE_WIDTH/POINTS_PER_TILE))); } } else if(test==13) { AGSurface s=makeWaterTile(); av->insert(new VoxelImage(s,Pos3D(64,0,0))); av->insert(new VoxelImage(s,Pos3D(0,0,0))); av->insert(new VoxelImage(s,Pos3D(64+32,0,32))); av->insert(new VoxelImage(s,Pos3D(32,0,32))); av->insert(new VoxelImage(s,Pos3D(64+32,0,-32))); av->insert(new VoxelImage(s,Pos3D(32,0,-32))); } else if(test==14) { AGSurface s=makeWaterTile(); std::string ms=toPNG(s.surface()); s=fromPNG(ms); av->insert(new VoxelImage(s,Pos3D(64,0,0))); } app.setMainWidget(av); app.run(); }