Jump to content

aiaf

Members
  • Posts

    720
  • Joined

  • Last visited

Posts posted by aiaf

  1. Hello,

     

    Im trying to execute some code(in App Loop()) that updates my game objects every 5 seconds.

    I tried implementing a timer using functions from Time api, but i wasnt very succesfull.

    If someone have some code like this that works ill be happy to see.

     

    So i went on and used Leadwerks thread:

     

    Mutex *mutex = NULL;

    long Updater::tick = 0;

     

    Object* UpdateTick(Object* object)

    {

    while(1)

    {

    mutex->Lock();

    Updater::tick++;

    System::Print("tick: " + String(Updater::tick));

    mutex->Unlock();

     

    Leadwerks::Time::Delay(5000);

    }

     

    return NULL;

    }

     

    Updater::Updater(std::vector<Unit *> *units) {

    this->units = units;

     

    mutex = Mutex::Create();

    thread = Thread::Create(UpdateTick);

    }

     

    Is it possible to pass an custom object to the Thread EntryPoint ?

     

    static Thread* Create(Object* EntryPoint(Object* o), Object* o=NULL)

    Something like Thread::Create(UpdateTick, myObjectHere).

     

    I think im missing something, maybe is another way of dooing this.

     

    Thanks

  2. Hello

     

    Wanted to replace the mouse cursor with something else, so i draw a * character.

    When i look around with the camera the * character it wobbles around, leaving some drawing marks.

     

    I need the crosshair to stay put at the center of screen and move smoothly,

    any ideea how to solve this ?

     

    if(!console->isMainMenuMode()) {

    context->SetBlendMode(Blend::Alpha);

    context->DrawText("*", player->currentMousePosition.x, player->currentMousePosition.y);

    context->SetBlendMode(Blend::Solid);

    }

     

     

    Camera is setup as below:

     

    camera->Move(camMovement);

    currentMousePosition = window->GetMousePosition();

    mouseDifference.x = currentMousePosition.x - centerMouse.x;

    mouseDifference.y = currentMousePosition.y - centerMouse.y;

    camRotation.x += mouseDifference.y / mouseSensitivity;

    camRotation.y += mouseDifference.x / mouseSensitivity;

    camera->SetRotation(camRotation);

    window->SetMousePosition(centerMouse.x, centerMouse.y)

  3. Hello,

     

    I wanted to build my project on windows also, so i installed the latest visual studio community 2015 ( i think is visual studio version 14).

    It compiles just fine but at the linking stage i got this kind of erros:

     

    2>Leadwerks.lib(Leadwerks.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1800' doesn't match value '1900' in main.obj

    2>Leadwerks.lib(String.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1800' doesn't match value '1900' in main.obj

    2>Leadwerks.lib(FileSystem.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1800' doesn't match value '1900' in main.obj

     

    Seems to not be compatible with the static lib from Leadwerks.

     

    Any way to fix this ? besides me installing some older version of visual studio

    Maybe a static lib version built for visual studio 14

     

    Thanks

  4. Just started with Leadwerks.Heres a way to build a project with cmake on linux.

     

    Start from an existing project (lets call it Proj):

     

    Copy

    ~/.steam/steamapps/common/Leadwerks

    into Source/Libs.

    Now you have Proj/Source/Libs/Leadwerks (this directory contains all the header files and static libs needed).

     

    Can use this Libs dir to add any other external libs you need.

     

    Here is the CMakeLists.txt:

    CMakeLists.txt

     

    Copy to the root of the project.

    cmake . and make

     

     

    Will work on windows also with some modifications.

     

    ~/Documents/Leadwerks/Projects/test/Projects/Linux/Proj check the codeblocks project (Proj.cbp, Proj.depend) if you need to add more to the CMakeLists.txt.

     

    Hope this helps.

  5. Start from an existing project (lets call it Proj):

     

    Copy

    ~/.steam/steamapps/common/Leadwerks

    into Source/Libs.

    Now you have Proj/Source/Libs/Leadwerks (this directory contains all the header files and static libs needed).

     

    Can use this Libs dir to add any other external libs you need.

     

    Here is the CMakeLists.txt:

    CMakeLists.txt

     

    Copy to the root of the project.

    cmake . and make

     

     

    Will work on windows also with some modifications.

     

    ~/Documents/Leadwerks/Projects/test/Projects/Linux/Proj check the codeblocks project (Proj.cbp, Proj.depend) if you need to add more to the CMakeLists.txt

     

    Hope this helps.

×
×
  • Create New...