iPhone Programming Course via Online Video, Worksheets and One-on-One Sessions
Friday, October 9, 2009
EDUmobile.ORG has launched an online iphone programming course that teaches candidates via Online Video, PDF Documents, One-on-One sessions and Weekly Worksheets.
For those who do not own a Mac, there is a facility offered to remotely login to access a Mac to carry out your programming from a normal PC connected to the Internet. Thus, one does not need to purchase or own a Mac.
The cost of the complete iphone development course is $200 and there is a 25% discount if you use the code AZV while registering. You can also opt to pay in 3 easy monthly installments.
Candidates get a certification on completion and an option where you also get to work and co-publish your first live industrial iphone project (game or application) on the official Apple Appstore, This means that you can essentially earn back the money and time that you put into this, many times over in a matter of a few months!
Visit http://edumobile.org/iphone-course.html to learn more about iphone tutorial
Chicken strip, a funny indonesian comic strip
Thursday, October 8, 2009
A really funny comic strip with themes of daily stuff and IT related things
http://chickenstrip.wordpress.com/
Shared via AddThis
Irrlicht code snippets
Tuesday, October 6, 2009
WRITE IMAGE TO FILE:Code:
IImage* image = Device.driver->createScreenShot();
if (image)
{
Device.driver->writeImageToFile(image, "c:\\images\\dump.jpeg");
Device.driver->writeImageToFile(image, "c:\\images\\dump.png");
Device.driver->writeImageToFile(image, "c:\\images\\dump.bmp");
Device.driver->writeImageToFile(image, "c:\\images\\dump.tga");
Device.driver->writeImageToFile(image, "c:\\images\\dump.jpg");
image->drop();
}
LOAD IMAGE (256X256) FROM FILE, CHANGE PIXEL AND SAVE:Code:
video::ITexture * image1 = driver->getTexture("d:\\x\\map.bmp");
//driver->makeColorKeyTexture(image1, core::position2d
u8 * ff=(u8 *)image1->lock();
IImage* im = driver->createImageFromData(image1->getColorFormat(), dimension2d
im->setPixel(100,100,SColor(255,255,0,0));
driver->writeImageToFile(im,"D:\\x\\map.bmp");
im->drop();
CHANGE CAPTION FUNCTION:Code:
void showCaptionVar(std::string txt)
{
std::string gio1=txt;
char gio2[512];
strcpy_s(gio2, gio1.c_str());
core::stringw gio3 = gio2;
device->setWindowCaption(gio3.c_str());
}
EVENTS:Code:
class mvm:public IEventReceiver
{
public:
bool OnEvent(const SEvent &e)
{
static bool pwheel=false;
if (e.EventType==EEVENT_TYPE::EET_MOUSE_INPUT_EVENT)
{
if (e.MouseInput.Wheel==-1)
{
}else if (e.MouseInput.Wheel==1)
{
}
if (e.MouseInput.Event==irr::EMIE_RMOUSE_PRESSED_DOWN)
{
mox=e.MouseInput.X;
moy=e.MouseInput.Y;
}
if (e.MouseInput.Event==irr::EMIE_RMOUSE_LEFT_UP)
{
}
if (e.MouseInput.Event==irr::EMIE_MOUSE_MOVED)
{
}
}
if(e.MouseInput.Wheel)
{
if (pwheel==false)
{
//middle button down event
pwheel=true;
}else{
//middle button up event
pwheel=false;
}
}
if (e.EventType==irr::EEVENT_TYPE::EET_GUI_EVENT)
{
s32 id = e.GUIEvent.Caller->getID();
switch (e.GUIEvent.EventType)
{
case gui::EGUI_EVENT_TYPE::EGET_BUTTON_CLICKED:
{
if (id==2)
{
}
break;
}
case gui::EGUI_EVENT_TYPE::EGET_ELEMENT_FOCUSED
{
if (id==2)
{
//gui::
z=z+10;
}
break;
}
}
}
if (e.EventType==EET_KEY_INPUT_EVENT)
{
switch (e.KeyInput.Key)
{
case KEY_KEY_W:
{
wasd[0]=e.KeyInput.PressedDown;
break;
}
case KEY_ESCAPE:
{
device->closeDevice();
break;
}
return true;
}
return false;
}
return false;
}
};
BASIC VARIABLES:Code:
#include "irrlicht.h"
#include
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
IrrlichtDevice * device;
video::IVideoDriver * driver;
scene::ISceneManager * smgr;
scene::ICameraSceneNode * cam;
irr::SIrrlichtCreationParameters pars;
pars.EventReceiver=&receiver;
pars.AntiAlias=true;
pars.Fullscreen=true;
pars.DriverType=video::EDT_DIRECT3D9;
pars.WindowSize=core::dimension2d
pars.Bits=32;
device = createDeviceEx(pars);
driver = device->getVideoDriver();
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
smgr = device->getSceneManager();
cam= smgr->addCameraSceneNode();
cam->setFarValue(50000.0f);
COLLISION DETECTION WITH BOUNDING BOXESCode:
bool collision(ISceneNode* one, ISceneNode* two) {
aabbox3d
b1 = one->getBoundingBox ();
b2 = two->getBoundingBox ();
one->getRelativeTransformation().transformBoxEx( b1 );
two->getRelativeTransformation().transformBoxEx( b2 );
return b1.intersectsWithBox( b2 );
}
//OTHER WAY
//bool collision(ISceneNode* one, ISceneNode* two) {
//if(one->getTransformedBoundingBox().intersectsWithBox(two->getTransformedBoundingBox())) {
//return (one->getTransformedBoundingBox().intersectsWithBox(two->getTransformedBoundingBox()));
//}
//return false;
//}
SHOW BOUNDING BOX (debugging)Code:
node->setDebugDataVisible(scene::EDS_BBOX);
MOVE NODECode:
core::vector3df v=node->getPosition();
v.X+=1.0f;
node->setPosition(vector3df(v));
TEXTURESCode:
irr::video::ITexture * texture[1];
texture[0]=driver->getTexture("c:/x/0.bmp");
texture[1]=driver->getTexture("c:/x/1.bmp");
node->setMaterialTexture(0,texture[0]);
node->setMaterialTexture(1,texture[1]);
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMaterialType(video::EMT_REFLECTION_2_LAYER);
REMOVE CONSOLE WINDOWCode:
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
int main()
{
return 0;
}
ATTACH TO BONE (Add Child to Joint)Code:
ISceneNode * bone=node->getJointNode("Bone1");
bone->addChild(node2);
CREATE BILLBOARDCode:
IBillboardSceneNode * bill = smgr->addBillboardSceneNode();
bill->setMaterialType(EMT_TRANSPARENT_ADD_COLOR );
bill->setMaterialTexture(0, driver->getTexture("c:/x/b1.bmp"));
bill->setMaterialFlag(video::EMF_LIGHTING, false);
bill->setSize(dimension2d
bill->setPosition(vector3df(1.0f, 0.0f, 110.0f));
ADD ANIMATORCode:
irr::scene::ISceneNodeAnimator * anim = smgr->createFlyCircleAnimator (core::vector3df(0,55,110),5.0f, 0.01,core::vector3df(1,0,1));
bill->addAnimator(anim);
anim->drop();
ADD LIGHTCode:
scene::ILightSceneNode* nodeLight = smgr->addLightSceneNode(0, core::vector3df(100, 100, 100),
video::SColorf(1.0f,1.0f,1.0f,1.0f),
20000.0f);
video::SLight light;
light.Direction = core::vector3df(100, 100, 0);
light.Type = video::ELT_DIRECTIONAL;
light.AmbientColor = video::SColorf(0.3f,0.3f,0.3f,1);
light.SpecularColor= video::SColorf(0.4f,0.4f,0.4f,1);
light.DiffuseColor = video::SColorf(1.0f,1.0f,1.0f,1);
light.CastShadows = false;
nodeLight->setLightData(light);
CREATE A PARTICLE SYSTEMCode:
// create a particle system
scene::IParticleSystemSceneNode* ps = smgr->addParticleSystemSceneNode(false);
scene::IParticleEmitter* em = ps->createBoxEmitter(
core::aabbox3d
core::vector3df(0.0f,-0.06f,0.0f), // initial direction
10,100, // emit rate
video::SColor(0,0,0,255), // darkest color
video::SColor(0,255,255,255), // brightest color
80,20000,0, // min and max age, angle
core::dimension2df(5.f,5.f), // min size
core::dimension2df(20.f,20.f)); // max size
ps->setEmitter(em); // this grabs the emitter
em->drop(); // so we can drop it here without deleting it
scene::IParticleAffector* paf = ps->createFadeOutParticleAffector();
ps->addAffector(paf); // same goes for the affector
paf->drop();
ps->setPosition(core::vector3df(10,450,0));
ps->setScale(core::vector3df(100,100,100));
ps->setMaterialFlag(video::EMF_LIGHTING, false);
ps->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
ps->setMaterialTexture(0, driver->getTexture("c:/x/b1.bmp"));
ps->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
CREATE WATER (addWaterSurfaceSceneNode)Code:
IAnimatedMesh* plane = smgr->addHillPlaneMesh("floor", // Name of mesh
core::dimension2d
core::dimension2d
0, //material
0, //hillheight
core::dimension2d
core::dimension2d
ISceneNode* sea = smgr->addWaterSurfaceSceneNode(plane->getMesh(0), 2.0f, 350.0f, 8.0f,0,-1,vector3df(0,0,0),vector3df(10,0,0),vector3df(1,1,1));
sea->setMaterialTexture(0, driver->getTexture("c:/x/sand.png"));
sea->setMaterialTexture(1, driver->getTexture("c:/x/water.png"));
sea->setMaterialFlag(EMF_LIGHTING, true);
sea->setMaterialType(video::EMT_REFLECTION_2_LAYER);
GET DISTANCE BETWEEN NODES (addWaterSurfaceSceneNode)Code:
ISceneNode* one;
ISceneNode* two;
one->getAbsolutePosition().getDistanceFrom(two->getAbsolutePosition());
NODE ANIMATIONCode:
myNode->setFrameLoop(1,15);
myNode->setAnimationSpeed(25);
CREATE FOGCode: driver->setFog(SColor(0,0, 0, 0),true, 150,220,0.01,false, false);
node->setMaterialFlag(video::EMF_FOG_ENABLE, true);
CREATE GUI ELEMENTCode: irr::gui::IGUIEnvironment *ige=smgr->getGUIEnvironment();
irr::gui::IGUIMeshViewer * gm=ige->addMeshViewer(rect
scene::IAnimatedMesh * mesh=smgr->getMesh("c:/x/cube.x");
gm->setMesh(mesh);
irr::gui::IGUIEditBox * txt=ige->addEditBox(L"giorgi",core::rect
GET NODE AT SCREEN 2D POSITION №1Code: scene::ISceneNode *node = smgr->getSceneCollisionManager()-> getSceneNodeFromScreenCoordinatesBB(position2d
GET NODE AT SCREEN 2D POSITION №2Code: core::line3d
line=smgr->getSceneCollisionManager()->getRayFromScreenCoordinates(position2d
scene::ISceneNode *nodeline = smgr->getSceneCollisionManager()->getSceneNodeFromRayBB(line,0x1,false);
GET NODE AT SCREEN 2D POSITION №3 (exact selection without bounding box)Code: int idd=0;
int curid=0;
scene::ITriangleSelector * sel[100];
void gio::add()
{
idd++;
scene::IAnimatedMesh * mesha=smgr->getMesh("c:/x/apple/apple.x");
scene::IAnimatedMeshSceneNode *nd=smgr->addAnimatedMeshSceneNode(mesha,0,idd,core::vector3df(xx, yy, zz));
sel[idd] = smgr->createOctTreeTriangleSelector(mesha, nd, 128);
//If you wish to select animated node you can use:
//sel[idd] = smgr->createTriangleSelectorFromBoundingBox(nd);
nd->setTriangleSelector(sel[idd]);
}
core::line3d
core::vector3df intersection;
core::triangle3df tri;
line=smgr->getSceneCollisionManager()->getRayFromScreenCoordinates(position2d
int k=0;
for(k=0; k<=idd; k++)
{
if (smgr->getSceneCollisionManager()->getCollisionPoint(line, sel[k], intersection, tri))
{
curid=k;
break;
}
}
scene::IAnimatedMeshSceneNode *curnode=smgr->getSceneNodeFromId(curid);
SELECTOR - INTERSECTION POINT WITH 1) CAMERA VIEW - 2) MOUSE 2D COORDINATES
Source: http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=34385Code: scene::IAnimatedMesh * ter = smgr->getMesh("c:/x/ter.3ds");
scene::ISceneNode * ternode=smgr->addOctTreeSceneNode(ter,0);
ternode->setMaterialFlag(video::EMF_LIGHTING,false);
scene::ITriangleSelector * selector = smgr->createOctTreeTriangleSelector(ter, ternode, 128);
ternode->setTriangleSelector(selector);
IBillboardSceneNode * bill = smgr->addBillboardSceneNode();
bill->setMaterialType(EMT_TRANSPARENT_ADD_COLOR );
bill->setMaterialTexture(0, driver->getTexture("c:/x/b1.bmp"));
bill->setMaterialFlag(video::EMF_LIGHTING, false);
bill->setSize(dimension2d
bill->setPosition(vector3df(1.0f, 0.0f, 110.0f));
core::line3d
//1) Intersection with camera:
line.start = cam->getPosition();
line.end = line.start + (cam->getTarget() - line.start).normalize() * 1000.0f;
//2) intersection with mousecoordinates:
//line=smgr->getSceneCollisionManager()->getRayFromScreenCoordinates(position2d
core::vector3df intersection;
core::triangle3df tri;
if (smgr->getSceneCollisionManager()->getCollisionPoint(line, selector, intersection, tri))
{
bill->setPosition(intersection);
}
