Setting up Scroll

I'm having trouble following the Scroll tutorial, probably missed something obvious. I've got Scroll setup an included properly I think (using VS 2017), and added the .h and .cpp files as directed in the tutorial. I don't see any mention of what to do with the original .cpp file that was generated when the project is created, so it is still in the project. At that point, I can't compile because both the project .cpp and the new OrxScroll.cpp files have a main function defined. So I tried removing the original project's .cpp file. That will compile, but crashes hard if I try to run it. Looks like the .ini files cannot be found for some reason.

Let me know what I've missed and how to proceed. Looking forward to trying this out.

Comments

  • I did find a way to fix this, but not sure why following the tutorial doesn't work for me. I had to add a bootstrap function to the class and specify the ini file to load, otherwise, it can't find the file for some reason. I tried again on another fresh project, but it seems to be necessary to add the bootstrap function in order to work. My steps are to create a project using the init script, add the Scroll include folder to the project's include folders, compile and run. This results in the error shown in the original post. Hopefully someone will be able to see what I've done wrong. In any case, here is the bootstrap function that fixes the issue for me. This is hard coded to load the debug config file at the moment. Surely there is a better way.

    `
    orxSTATUS OrxScroll::Bootstrap() const
    {

    // Add "../data/config" to the list of locations that config files can be loaded from
    orxResource_AddStorage(orxCONFIG_KZ_RESOURCE_GROUP, "../data/config", orxFALSE);
    
    // Loads a specific config file 
    orxConfig_Load("ScrollTestd.ini");
    
    return orxSTATUS_FAILURE;
    

    }
    `

  • As I mentioned, the tutorial is a few years old, so there might be some things that have changed since.
    The .inl files are used at compile time, so if they weren't found, you wouldn't be able to compile.
    The initial message does say that it can't load the config file ScrollTestd.ini and then it tells us that it can create MainViewport, which cascades from the first error.

    That being said, you should only need to specify the path to your config files from inside the Bootstrap method, you shouldn't need to load the file manually.

  • Scroll tutorials were updated and cleaned up in recent times, but perhaps I missed something. @funemaker what tutorial did you start with? I'll double check it.

  • Ok. Maybe I'm misunderstanding you when you write "The .inl files are used at compile time, so if they weren't found, you wouldn't be able to compile." I just removed them from my project to confirm this, but I can still clean and rebuild with no error. I'm using VS 2017 if that is relevant.

    In any case, it sounds like adding a Boostrap function is necessary. When you say, "specify the path to your config files", I assume that is done with the line

    orxResource_AddStorage(orxCONFIG_KZ_RESOURCE_GROUP, "../data/config", orxFALSE);

    Correct? But if that is all I do, I still get the same error. I can only eliminate the error by manually loading ScrollTestd.ini (or ScrollTest.ini of course)

  • Hi @sausage, I started with the Introduction to Scroll tutorial.

    https//wiki.orx-project.org/en/tutorials/community/acksys/scroll0

    So one line I didn't fully understand is:

    "First, create a new project linking to the SVN Embedded Dynamic version of Orx."

    I setup orx by using the instructions on the "Welcome" link, compiling it, and then generating new projects using the init command. Should that work with this tutorial?

    thanks!
    Jon

  • By the way, I hope my posts on this didn't come across as any kind of a complaint about the tutorials or orx or scroll. I have nothing but appreciation for the help you guys have been handing out and the resources on the website. It's really good stuff. Today I had my 11 yr old son start going through the beginner's guide and he made it up to part 14 before taking a break...everything worked perfectly and he loves tweaking the character's behavior (gravity, damping, jump impulse, etc) in the ini files!

  • edited November 10

    Nice, I love hearing that. My 10 year old kid hasn't tried orx yet, but she's been doing things in Scratch for a few years now, I guess I should introduce her to it at some point. :) Also no worries about the questions, we're here for that and I don't think you came out as complaining, at least I didn't perceive it this way!

    Just to make sure, you really can't compile without the .inl (Scroll.inl, ScrollBase.inl, ScrollObject.inl), as that's where Scroll's code is. That being said, they don't need to be in your project as they get directly included (inl stand for inlined) and that's how they get compiled, not from the project itself. If you were to delete the files, you wouldn't be able to compile anymore.

    As for the path, it seems fine as long as ../data/config is the correct path from where your executable is. Now I'm wondering if your executable is called ScrollTestd.exe, otherwise it wouldn't find the default config file. The way it works is that the default config file uses the same name as the executable, but with the extension changed to .ini.

  • Thanks @iarwain, I'm glad I did not come off the wrong way. I don't do much forum posting so wanted to make sure.

    Yes, Scratch is a great way to get the kids interested and we've had our share of it. I probably tried to start my guys a little early on this stuff (we've messed around a lot with Godot and even Unreal) and hopefully I didn't make them hate programming by doing that! A cool thing is my daughter (15) is now getting proficient with Java and when she asks for help with her homework, I can see she has really gotten the object oriented concept and knows how to apply it. The rest is really just experience of making stuff I think!

    As to compiling..probably we are talking about different things. Your posts seems to reference ".in1" files. (I can't tell if that is a numeral 1 or the letter "l", but it isn't an "i") I thought before maybe that was a typo, but looks like it is intentional, and if it is common c++ thing, I wouldn't recognize it. I can get around ok in c++ (enough to cause trouble probably!) but not much more than that.

    So, the error message I see is about the "ini" file being missing. Am I confused on this? The ini file obviously doesn't contain the Scroll code, so I do think we are mis-communicating somehow. I also couldn't understand how the "ini" files are used in compiling.

    Lastly, yes, my exe is ScrollTest.exe or ScrollTestd.exe for the debug build.

    Let me know if that clarifies anything (or makes it worse :smile: )

  • Right, that forum font doesn't help.

    So .INL, as in INLined, is an extension I picked, it's not a standard and in the end the extension itself doesn't matter. They're just C++ code files that are included directly from the headers and are compiled inside the same translation unit.
    This makes it really easy to integrate Scroll, or at least that was the intent, as one doesn't need to modify their project/solution and simply add includes to Scroll.h and ScrollObject.h where they need them. The rest of the code (inside the .INL files) gets pulled from there.

    The fact it doesn't load your config file (.INI this time, which, as you noted, is completely unrelated to the .INL files) by default is more puzzling. Would you mind making an archive of your project so I could have a closer look?

    Regarding your daughter, it's nice that she found her marks with Java. I hope she enjoys programming.

  • I'm not sure she enjoys it, but maybe understanding it is the first step! :smile:

    I zipped my project and made it available here:

    https://app.box.com/s/7oo0ce29ynrekrddui830jknijzdt2v5

    Let me know if that link works and what you find.

    thanks!

  • The link worked and I just realized what I missed in one of your earlier posts!
    The bootstrap function is returning orxSTATUS_FAILURE in your case. Which is the way to tell orx to not load the default config file. That's why it's working when you load it manually.
    If you were to change it to orxSTATUS_SUCCESS, then orx will load the default config file as usual.

  • Ah, yes. That works. I must have copied that from another tutorial on how to set the .ini to any arbitrary file and missed the significance of the return type! Thanks.

Sign In or Register to comment.