Jump to content

gamecreator

Members
  • Posts

    4,937
  • Joined

  • Last visited

Everything posted by gamecreator

  1. If you're just looking to get the y position, you can get that with yourentityname->GetPosition().y;
  2. I would think so too. I'm not sure why it's a low priority. Seems like it would be just a few minutes of work to fix the template but I could be wrong here.
  3. You're almost there! That's the error you get when Leadwerks can't find the shader because the path is incorrect. Did you change the folder under Debugging, Working Directory to $(SolutionDir)\..\..\ (I forgot to specify Working Directory earlier but it was in the Debugging section. I edited my other post to clarify.) The good news is that should be the last thing to set up the project and you only need to do it when you start a new project. It doesn't take long once you know what you need to do.
  4. I don't code in Lua but can't you get this by getting how much time passed since the animation started (a variable you would store when you start the animation)?
  5. Not sure how to help with your error but try this and let me know if it works: Create a new project Open the SLN file Remove App.h and App.cpp from the Solution Explorer (under Source and Header Files folders) Replace the contents of main.cpp with this example: #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char *argv[]) { Leadwerks::Window* window = Leadwerks::Window::Create(); Context* context = Context::Create(window); while (true) { if (window->Closed() || window->KeyHit(Key::Escape)) break; context->SetColor(0.0, 0.0, 1.0); context->Clear(); //Draw some text centered on the screen std::string text = "Hello!"; Font* font = context->GetFont(); int x = context->GetWidth() / 2; int y = context->GetHeight() / 2; x -= font->GetTextWidth(text) / 2; y -= font->GetHeight() / 2; context->SetBlendMode(Blend::Alpha); context->SetColor(1.0, 1.0, 1.0); context->DrawText(text, x, y); context->SetBlendMode(Blend::Solid); context->Sync(); } return 0; } Right click on your project name in the Solution Explorer tab, click on Properties at the bottom. The Property Pages window should come up. Change the Configuration on the top left to All Configurations. Under Configuration Properties, General, you may have to change Windows SDK Version to 8.1 In the same window, under Debugging, Working Directory remove the two dots at the end so that it just says "$(SolutionDir)\..\..\" (I hope Josh fixes this eventually) Click OK. I then also switch to Release version near the top instead of Debug Does that run for you and print Hello! on a blue screen or do you get an error still?
  6. gamecreator

    error?

    Leadwerks is pretty good about creating a backup copy when it overwrites something. But you can always just make a backup copy of the source folder yourself before you update if you want.
  7. Admittedly I'm doing an odder side project more involving Steam than Leadwerks. I'll see if resetting the working folder will help. Edit: here's the code to help Leadwerks find the correct paths again: char buffer[MAX_PATH]; // Get full path and filename GetModuleFileName(NULL, buffer, MAX_PATH); std::string ourpath = buffer; // Remove filename from the end of the path ourpath = ourpath.substr(0, ourpath.find_last_of( "\\/" )); SetCurrentDirectory(ourpath.c_str());
  8. argv[0] doesn't seem to change and shows the correct working folder+filename. I also just dragged a file onto another project EXE I had and it couldn't load a font (the first thing I tried to load in the project) where it works fine otherwise.
  9. I have the following code: #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char *argv[]) { Leadwerks::Window* window = Leadwerks::Window::Create(); Context* context = Context::Create(window); Font* font = context->GetFont(); while(true) { if(window->Closed() || window->KeyHit(Key::Escape)) break; context->SetColor(0.0, 0.0, 1.0); context->Clear(); // Print argument to console if(argc>1) printf("%s\n",argv[1]); context->SetBlendMode(Blend::Alpha); context->SetColor(1.0, 1.0, 1.0); context->DrawText("Hello", 10, 10); context->SetBlendMode(Blend::Solid); context->Sync(); } return 0; } If you run the EXE by itself (or from Visual Studio) or if you drag a file from the same folder as the EXE, it runs as expected. However, if you drag a file from any other folder, the program fails to load drawtext.shader because it tries to find it in the wrong place. For example, dragging a file from C:\ says Error: Failed to load shader "C://Shaders/Drawing/drawtext.shader" Dragging a file from D:\Test folder says Error: Failed to load shader "D:/Test/Shaders/Drawing/drawtext.shader" etc. even though the project is in the C:\Users...Documents\Projects\ProjectName folder Seems like dragging a file onto the EXE shouldn't mess up anything loading. I could be doing something wrong but this seems like a bug. I'm on release version.
  10. I think I misunderstood you then. I thought you needed to code partly in Lua to use the GUI, which didn't make sense to me.
  11. I've mentioned it before that entire sections like Widget (GUI) and Sprite don't have a single C++ example and so you're forced to hunt and pick through whatever the community may have posted, and maybe to convert from Lua to C++ or the reverse, hoping you can figure the code out. Someone was kind enough to post a GUI tutorial but he claims C++ requires Lua, which I don't believe is correct.
  12. I always feel like these are more meaningful when there is something to compare them to. In this case: the current Leadwerks with the same scene.
  13. I think this was the latest: https://www.leadwerks.com/community/topic/6158-what-are-you-working-on/?do=findComment&comment=112213
  14. I'm surprised too though I suspect he has a list of pros and cons that a new engine name could bring.
  15. Really? I assume you'll want to wait before announcing it but do you already have a name in mind?
  16. Steam-free version: https://www.leadwerks.com/community/store/product/5-enterprise-edition-license/
  17. I ended up using fixed timestep code from here: https://gafferongames.com/post/fix_your_timestep/
  18. Yeah, it seems like double dipping and I agree that it's probably wrong. But that's the way it gets closest to the same height at all FPS. If I only do it when I add to y, the character jumps super high when frame rates are low.
  19. The Sleep function is what helps me test whether the jump is consistent. I can change any of the other numbers. But I'm hoping to have the character jump the same height with Sleep(1) (or no Sleep line at all) versus Sleep(100) versus Sleep(20). It shows the y velocity steadily decreasing (being effected by "gravity"). Edit: I tested this with simply with a box moving right and everything went as expected (almost the exact same distance no matter the FPS). So I'm pretty sure my code is somehow wrong but I don't see how.
  20. This should be really simple but I'm not sure what I'm doing wrong. I'm trying to make it so that my character jumps the same height on different computers. I made a really simple test program and below is the entire code. The problem is that the player jumps less and less high as the time in the sleep function is increased. What am I doing wrong? (I also just tried the Leadwerks Time::Delay function and it does the same thing.) #include "Leadwerks.h" using namespace Leadwerks; Light* light = NULL; float vy=0, y=0.4; float highesty=0; int main(int argc, const char *argv[]) { Leadwerks::Window* window = Leadwerks::Window::Create(); Context* context = Context::Create(window); World* world = World::Create(); Camera* camera = Camera::Create(); camera->SetRotation(0, 0, 0); camera->Move(0, 3, -6); Light* light = DirectionalLight::Create(); light->SetRotation(35, 35, 0); Model* ground = Model::Box(10, 1, 1); ground->SetColor(0.0, 0.5, 0.0); ground->SetPosition(0, -1, 0); Model* cliff = Model::Box(2, 5, 1); cliff->SetColor(0.3, 0.4, 0.9); cliff->SetPosition(2, 2, 0); Model* player = Model::Box(1, 1.8, 1); player->SetColor(1.0, 1.0, 1.0); player->SetPosition(0, 0.4, 0); while (true) { if(window->Closed() || window->KeyDown(Key::Escape)) return false; if(window->KeyHit(Key::Space)) // Jump pressed { vy=0.8; highesty=0; // Reset highest jump tracker } if(y>highesty) highesty=y; // Keep track of highest position vy-=0.05*Time::GetSpeed(); // Gravity y+=vy*Time::GetSpeed(); // Add velocity to y if(y<0.4) y=0.4; // Stop at ground player->SetPosition(0, y, 0); Leadwerks::Time::Update(); world->Update(); world->Render(); context->SetBlendMode(Blend::Alpha); context->SetColor(1.0, 1.0, 1.0); context->DrawText("highest y: "+String(highesty), 10, 10); context->DrawText("GetSpeed: "+String(Time::GetSpeed()), 10, 30); context->Sync(); Sleep(1); } return 0; }
  21. For the rotation, have you tried a different viewmode for the sprite? Also, I can't tell it's a quad from the screenshot but maybe I'm missing something. Are you saying it looks flat when animated? If so, you'll want additional effects. Typically the best effects are a combination of them (and I've had particles slow things down too so you have to be smart about it).
  22. Plays and sounds like the start of a movie trailer. I can already hear the movie guy's voice: "In a world..."
  23. I hope they'll continue to be easy to use. If they mostly stay the way they are, then my only other hope is that they're easy to reset. Like if a vehicle falls out the game area, it can be put back on the track easily with neutral settings. Like vehicle->SetPosition() and vehicle->Reset() or something. Or an easy remove and recreate.
  24. Middle one (the one that's just a link) says it's unavailable. Never clicked it before. I guess that explains why it can't embed it. The other two are ok.
  25. gamecreator

    YADC

    Anyone know anything similar and easy to use for C / C++?
×
×
  • Create New...