Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error C2280: 'olc::Sprite::Sprite(const olc::Sprite &)': attempting to reference a deleted function #51

Open
ItsNovaAndCrap opened this issue Feb 10, 2023 · 7 comments

Comments

@ItsNovaAndCrap
Copy link

I am on episode 2, and I just finished implementing everything. But when I build, I get this error:
error C2280: 'olc::Sprite::Sprite(const olc::Sprite &)': attempting to reference a deleted function

I don't know why its happening, but I do know it's coming from olc2C02.h (or in my case dvx2C02.h).
Here's my header:

#pragma once
#include <cstdint>
#include <memory>

#include "olcPixelGameEngine.h"

#include "Cartridge.h"

class dvx2C02
{
public:
	dvx2C02();
	~dvx2C02();

	olc::Sprite& GetScreen();
	olc::Sprite& GetNameTable(uint8_t i);
	olc::Sprite& GetPatternTable(uint8_t i);

	bool frame_complete = false;

	uint8_t cpuRead(uint16_t addr, bool rdonly = false);
	void cpuWrite(uint16_t addr, uint8_t data);
	uint8_t ppuRead(uint16_t addr, bool rdonly = false);
	void ppuWrite(uint16_t addr, uint8_t data);

	void ConnectCartridge(const std::shared_ptr<Cartridge>& cartridge);
	void clock();
private:
	uint8_t tblName[2][1024];
	uint8_t tblPattern[2][4096];
	uint8_t	tblPalette[32];

	olc::Pixel palScreen[0x40];
	olc::Sprite sprScreen = olc::Sprite(256, 240);     // <- The error is coming from this line.
	olc::Sprite sprNameTable[2] = { olc::Sprite(256, 240), olc::Sprite(256, 240) };
	olc::Sprite sprPatternTable[2] = { olc::Sprite(128, 128), olc::Sprite(128, 128) };

	int16_t scanline = 0;
	int16_t cycle = 0;

	std::shared_ptr<Cartridge> cart;
};
@OneLoneCoder
Copy link
Owner

PGE now has a slightly different set of rules regarding moving sprites, so use the version included in the NES repo, and not the latest PGE

@ItsNovaAndCrap
Copy link
Author

oh ok, thank you!

@ItsNovaAndCrap
Copy link
Author

pardon me for reopening, but do you know where i can find pge in the repo?

@OneLoneCoder
Copy link
Owner

Hmmmmmmmm..... I will look into this when I get to my PC 😂

@datapaganism
Copy link

Looking for a fix for this as well,
Thanks

@datapaganism
Copy link

I managed to get the part 7 of the emulator to compile,
I downloaded the latest PGE header release and commented out
image
Line 792 : Sprite(const olc::Sprite&) = delete;
to
Line 792 : //Sprite(const olc::Sprite&) = delete;

It seems to work fine

@brccabral
Copy link

If you are using PGE current version, just change the sprites to Pointers. The code in this repo for "Part #3" has the pointer implementation. If you just followed the video you won't notice it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants