Jump to content

Josh

Staff
  • Posts

    23,145
  • Joined

  • Last visited

Posts posted by Josh

  1. This is the program I am using to test:

    #include "App.h"
    
    using namespace Leadwerks;
    
    App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {}
    
    App::~App() { delete world; delete window; }
    
    float angle=25;
    Joint* joint;
    
    bool App::Start()
    {
           window = Window::Create();
           context = Context::Create(window);
           world = World::Create();
           camera = Camera::Create();
           camera->Move(0,0,-4);
    
           Font* font = Font::Load("Fonts/arial.ttf",36);
           context->SetFont(font);
    
           return true;
    }
    
    bool App::Loop()
    {
           if (window->Closed() || window->KeyDown(Key::Escape)) return false;
    
           Time::Update();
           world->Update();
    
           context->SetColor(0,0,0,0);
           context->Clear();
    
           context->SetColor(1,1,1,1);
           context->SetBlendMode(Blend::Alpha);
           context->DrawText("Touch down index 0: " + String(window->TouchDown(0)),5,0);
           context->DrawText("Touch down index 1: " + String(window->TouchDown(1)),5,60);
           context->SetBlendMode(Blend::Solid);
    
           context->Sync();
    
           return true;
    }

     

    And I am using this code in AndroidActivity.Java:

    	@Override
    public boolean onTouchEvent(MotionEvent event) {
    	//Integer activePointer = (event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT);
    	//Integer activePointer = event.getActionIndex();
    
    	for (int i=0; i<event.getPointerCount(); ++i)
    	{
    		//Integer activePointer = event.getPointerId(0);
    		Integer mActivePointerId = event.getPointerId(i);
    		Integer activePointer = event.findPointerIndex(mActivePointerId);
    
    		Float x = event.getX(i);
    		Float y = event.getY(i);
    
    		switch (event.getAction() & MotionEvent.ACTION_MASK) {
    		case MotionEvent.ACTION_DOWN:
    		case MotionEvent.ACTION_POINTER_DOWN:
    			// Log.i("touchtest", "action_down " + activePointer.toString() +
    			// "(" + x + "," + y + ")");
    			androidRenderer.touch(x, y, activePointer);
    			break;
    		case MotionEvent.ACTION_MOVE:
    			// Log.i("touchtest", "action_move " + activePointer.toString() +
    			// "(" + x + "," + y + ")");
    			androidRenderer.move(x, y, activePointer);
    			break;
    		case MotionEvent.ACTION_UP:
    		case MotionEvent.ACTION_POINTER_UP:
    			// Log.i("touchtest", "action_up " + activePointer.toString() + "("
    			// + x + "," + y + ")");
    			androidRenderer.up(x, y, activePointer);
    			break;
    		}
    	}
    	return true;
    }

  2. Of course, their provided example code doesn't print anything out -_-

     

    The reason Android is free is because they could never charge for this.

     

    void printSamples(MotionEvent ev) {
        final int historySize = ev.getHistorySize();
        final int pointerCount = ev.getPointerCount();
        for (int h = 0; h < historySize; h++) {
            System.out.printf("At time %d:", ev.getHistoricalEventTime(h));
            for (int p = 0; p < pointerCount; p++) {
                System.out.printf("  pointer %d: (%f,%f)",
                    ev.getPointerId(p), ev.getHistoricalX(p, h), ev.getHistoricalY(p, h));
            }
        }
        System.out.printf("At time %d:", ev.getEventTime());
        for (int p = 0; p < pointerCount; p++) {
            System.out.printf("  pointer %d: (%f,%f)",
                ev.getPointerId(p), ev.getX(p), ev.getY(p));
        }
    }

  3. The terrain API is current;y not documented/supported because I can't guarantee it will work on all systems reliably (mobile), whereas building terrain in the editor will always work.

     

    The terrain constructor sets the pick mode to 2, so it should work.

     

    In an older version of the engine, terrain could not be picked.

     

    If you continue to have problems, please upload a simple example and I will debug it.

  4. I see. The ball joint matrix needs to indicate the pin direction. This will work in the update next week:

    #include "App.h"
    
    using namespace Leadwerks;
    
    App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {}
    
    App::~App() { delete world; delete window; }
    
    float angle=25;
    Joint* joint;
    
    bool App::Start()
    {
        window = Window::Create();
        context = Context::Create(window);
        world = World::Create();
        camera = Camera::Create();
        camera->Move(0,0,-4);
        Light* light = DirectionalLight::Create();
        light->SetRotation(35,35,0);
    
            Model* ground = Model::Box(20,1,20);
        Shape* shape=Shape::Box(0,0,0,0,0,0,20,1,20);
        ground->SetShape(shape);
        ground->SetMass(0);
    
       Model* box1 = Model::Box();
           box1->SetPosition(0,1.5,0);
           box1->SetColor(1,0,0,1);
           shape=Shape::Box();
           box1->SetShape(shape);
           box1->SetMass(20);
    
           Model* box2=(Model*)box1->Instance();
           box2->SetColor(0,1,0,1);
           box2->SetPosition(0,3,0);
           box2->SetMass(1);
    
           float cone=45;
           float twist=0;
    
           joint=Joint::Ball(0,2,0,box1,box2);
           joint->SetLimits(cone,twist);
           joint->EnableLimits();
    
           box2->AddTorque(200,200,200);
    
        return true;
    }
    
    bool App::Loop()
    {
        if (window->Closed() || window->KeyDown(Key::Escape)) return false;
    
        if (window->KeyDown(Key::Up)) angle+=1.0;
        if (window->KeyDown(Key::Down)) angle-=1.0;
        joint->SetAngle(angle);
        if (window->KeyHit(Key::Space))
        {
    		    if (!joint->MotorEnabled())
    		    {
    				    joint->EnableMotor();
    		    }
    		    else
    		    {
    				    joint->DisableMotor();
    		    }
        }
    
        Time::Update();
        world->Update();
        world->Render();
        context->Sync();
    
        return true;
    }

  5. Those clouds look really good. Typical particle clouds have no lighting or apparent edges. What did you do there, is it Klepto's work?

     

    For extremely overcast skies, I'd suggest combining those with a cloudy skybox, and the player wouldn't be able to distinguish between them.

    • Upvote 1
  6. I'm actually going to recommend against Wubi, after my experience yesterday. I believe it causes file IO problems, since the files are stored in an NTFS file system. I think it was causing my system to freeze up. I installed Ubuntu 12.04 64-bit onto a separate hard drive. I'm going to get a switch like this so I don't have to keep swapping cables:

    http://www.nikingstore.com/shop/orico-hd-pw6101-5-25-6-bay-sata-hdd-power-switch-860.html

     

    The dual-boot approach, in my experience, always leads to problems and makes it more difficult to reformat a drive.

    • Upvote 1
  7. At the moment I am working with Ubuntu 12.04 64-bit. I do not anticipate any trouble with 13.04 and 13.10 64-bit, though. When it is released there will be a definite supported version you should use, no guessing which one is the "right" one.

     

    As far as hardware goes, I recommend an AMD CPU with an Nvidia GEForce GPU. I just picked up an 8-core FX-8320 for my new dev machine.

     

    The Wubi installer is a Windows installer that will create a dual boot system for you and install Ubuntu. Works very well:

    http://www.ubuntu.com/download/desktop/windows-installer

     

    General tips for usage:

    -Any programs you download off the web should be extracted to a folder called (your user directory)/Applications.

    -Don't enter random stuff into the terminal you find when Googling things.

    -Don't try to customize the OS with alternate desktops, color schemes etc. You can do some cool things but if you're like me you'll most likely end up having to reinstall the OS.

    • Upvote 1
×
×
  • Create New...