Default Constructors required for template classes
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
06a0ac20f5
commit
dba7479803
8
Block.cpp
Normal file
8
Block.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include "Block.h"
|
||||
|
||||
Block::Block(int x, int y, int R, int B, int G)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
color = std::make_tuple(R, G, B);
|
||||
}
|
14
Block.h
Normal file
14
Block.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <tuple>
|
||||
|
||||
class Block
|
||||
{
|
||||
public:
|
||||
Block(){};
|
||||
Block(int x, int y, int R, int B, int G);
|
||||
void display(float CameraX, float CameraY, float Zoom);
|
||||
private:
|
||||
int X;
|
||||
int Y;
|
||||
std::tuple<int, int, int> color;
|
||||
};
|
Binary file not shown.
11
main.cpp
11
main.cpp
@ -1,5 +1,7 @@
|
||||
#define OLC_PGE_APPLICATION
|
||||
#include "pixelGameEngine.h"
|
||||
#include <unordered_map>
|
||||
#include "Block.h"
|
||||
|
||||
class Example : public olc::PixelGameEngine
|
||||
{
|
||||
@ -10,20 +12,17 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
std::unordered_map<int,Block> Blocks;
|
||||
bool OnUserCreate() override
|
||||
{
|
||||
// Called once at the start, so create things here
|
||||
Blocks[126]=Block(25,10,255,255,255);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnUserUpdate(float fElapsedTime) override
|
||||
{
|
||||
ConsoleShow(olc::ESCAPE,false);
|
||||
// called once per frame
|
||||
for (int x = 0; x < ScreenWidth(); x++)
|
||||
for (int y = 0; y < ScreenHeight(); y++)
|
||||
Draw(x, y, olc::Pixel(rand() % 255, rand() % 255, rand()% 255));
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user