brainchemicals


Headings

todo:
link to showcase
Link to Raspberry Pi OS
Link to Allegro library stuff
link to C++ talk

Showcase

Games made with SDL2

Thirteen Ball Infinite Line Line Bet
Primarily a button bashing game. You must clear the balls off the table by adding values to 13. A maths game whereby only using the 4 middle numbers allows the whole grid to be filled. A simple betting game on sticks (lines). Place bets on whether or not the lines (sticks) will cross.
game image game image game inage

Pi - the mini game

Outline and description of an idea.

And so the story of Pi goes... Climbing out of a dug hole in his garden, Pi enters his house of his deserting parents. He finds many creatures roaming the house (lost, and he helps them) and finds notes placed around from his father warning him of his mother. The house has a basement, first floor, bedroom areas and an attic. It is in one bedroom (his parents) where he finds his dad's robotic-like corpse damaged by a shotgun blast to the head. Pi wonders if he is a robot too, like the creatures, and like his dad? We find Pi's mother in the attic who has decayed and broken down so badly she has destroyed it all. Pi was thrown outside to save him.



I do like how programmers had to work with older machines. ... more ? ...
BBC BASIC language ...



Get something showing up
Prepare a simple 3D scene
Use touch to find a primitive in the world

Some code lessons

So I found curly brackets to be quite powerful when defining and declaring. An extra character here and there changes everything

Curly braces and declarations

class Screen
{
    public:
    void Render(){};
};

void Screen::Render()
{
}

// Error : redefinition of Render()

Don't forget to set nullptr

Set nullptr after deleting

// my very humbled explanation
int* i = new int[5];
delete[] i;
if(i != nullptr) std:cout << "Nope. We didn\'t set.";

i = nullptr;
if(i != nullptr) std::cout << "Nope. Oh dear.";

std::cout << "Yup. Set.";

When learning about overloading and using base classes, it can cause naming issues...

Conflicting names

class CMenu
{
	public:
	int x = 8;
};

class CGame : public CMenu
{
	public:
	CMenu menu{};

	int x = 0;
};
	
int main(int argc, char *argv[])
{
	CGame game;

	std::cout << "CGame x is " << game.x
		<< " and CMenu x is " << game.menu.x;
}

I'm sure this seems confusing...

A vector holding itself

struct Rect
{
    int x{0};
    int y{0};
};

struct BossRect : Rect
{
    std::vector<BossRect> br{};
};

int main(int argc, char *argv[])
{
        BossRect boss{};
        boss.x=10; boss.y=99;

        boss.br.push_back(boss);
        
        std::cout << "x " << boss.br[0].x
        	<< " y " << boss.br[0].y;
}