Author Topic: Programming Megathread  (Read 106327 times)

that would be jade my amigo
I knew I recognized it. I considered that for something but wound up going with handlebars over it, and later discovering nunjucks, which I decided to switch to, because I love jinja2
jade just doesn't feel like html. which is weird

so i asked my parents to get me a javascript for dummies book and they got me a java one, should we return it or are they similar enough to not bother?

so i asked my parents to get me a javascript for dummies book and they got me a java one, should we return it or are they similar enough to not bother?

javascript is very different from java. ask them to return it.

javascript is very different from java. ask them to return it.
okie

so i asked my parents to get me a javascript for dummies book and they got me a java one, should we return it or are they similar enough to not bother?
Classic


so i asked my parents to get me a javascript for dummies book and they got me a java one, should we return it or are they similar enough to not bother?
learning java isn't a bad idea though
could use it for once you're done with javascript and want to move into other things

learning java isn't a bad idea though
could use it for once you're done with javascript and want to move into other things

yeah but think about installing node.js and trying to learn javascript with a java book off of that

that'd be painful

yeah but think about installing node.js and trying to learn javascript with a java book off of that

that'd be painful
would not recommend using the book for the wrong purpose
but I would recommend using the book for the correct purpose later

one probably wouldn't play tennis with an apple
but one may eat the apple after done playing tennis
(if you do play tennis with an apple, show me a picture of the apple/equipment/players/court afterwards please)

would not recommend using the book for the wrong purpose
but I would recommend using the book for the correct purpose later

one probably wouldn't play tennis with an apple
but one may eat the apple after done playing tennis
(if you do play tennis with an apple, show me a picture of the apple/equipment/players/court afterwards please)

ah I see what you mean now, good idea


I recently got stuck while making a C++11/SDL game engine, and I can use some advice.
Ideally, what I want to do is the following:
1. create enumeration representing all sprites to add to a spritebank
2. create a vector of filenames, and using the enumeration add each filename to the vector
3. go through all loaded filenames, and using the enum create sprites with specific properties

but I can't quite find a way to do the second and third step without having my compiler belch a bunch of errors. Any ideas as to how to get it to work? The code I used is below (feel free to say if there's any info missing)


//application class that starts the program//
std::vector<std::string> files;

class App : public Event
{
    private:
        bool Running; //Running flag

        enum sprite_file
        {
            SPRITE_RING1 = 0,
            SPRITE_RING2 = 1,
            SPRITE_END = 2
        };

        SDL_Window* graphicsWindow; //The window
        SDL_Renderer* graphicsRenderer; //The renderer
        TTF_Font* globalFont; //The global font

        Timer capTimer; //Frames per second cap timer

        SpriteBank rings; //Collection of sprites
        std::string currentSprite; //Filename of sprite in use
[...]
//initialization function within App//
//Initialize spritebank
   if(!rings.Init(graphicsRenderer))
   {
      printf("Failed to load sprites!");
   }

   //Add two sprites
   files.emplace(SPRITE_RING1, "media/img/ring/ring1.png");
   files.emplace(SPRITE_RING2, "media/img/ring/ring2.png");

   //Add two sprites
   for(auto filename : files)
   {
      switch(this->sprite_file)
      {
         case SPRITE_RING1:
         {
            rings.AddSprite(filename,
                        40,
                        40,
                        40,
                        20,
                        20);
            break;
         }

         case SPRITE_RING2:
         {
            rings.AddSprite(filename,
                        40,
                        40,
                        40,
                        20,
                        20);
            break;
         }
         default: continue; break;
      }
   }

   currentSprite = SPRITE_RING1;


EDIT: The file.emplace() functions give this error, switch(this->sprite_file) gives this, and the alternative, switch(sprite_file) gives this
« Last Edit: August 11, 2016, 10:56:36 PM by Glass Joe »

I don't see where you declared 'files'
Also the compiler errors would be nice to see

I don't see where you declared 'files'
Also the compiler errors would be nice to see
stuff, my b for forgetting to include those things, I edited the main post to include them now

My problem is that my attention span is only a few days so I can never get big projects done. Does anyone have any advice to stay motivated?