The Header File:
Code: Select all
#pragma once
#include "Keyboard.h"
#include "Mouse.h"
#include "Graphics.h"
class Game
{
public:
Game( class MainWindow& wnd );
Game( const Game& ) = delete;
Game& operator=( const Game& ) = delete;
void Go();
private:
void ComposeFrame(int x = 1, int y = 1, int r = 0, int g = 0, int b = 0);
void UpdateModel();
/********************************/
/* User Functions */
/********************************/
private:
MainWindow& wnd;
Graphics gfx;
/********************************/
/* User Variables */
int Carx = 100, Cary = 100; //Car X And Y Starting Coordinates
public:
int Game::GetCarx(int x) //X Coordinate Getter
{
x = Carx;
return x;
}
int Game::GetCary(int y) // Y Coordinate Getter
{
y = Cary;
return y;
}
/********************************/
};
Code: Select all
Game::Game( MainWindow& wnd )
:
wnd( wnd ),
gfx( wnd )
{
}
void Game::Go()
{
gfx.BeginFrame();
UpdateModel();
ComposeFrame();
gfx.EndFrame();
}
void Game::UpdateModel()
{
}
void Game::ComposeFrame(int x, int y, int r, int g, int b)
{
int screen_height, screen_lenght, DrawX, DrawY;
GetCarx(DrawX); //Gets Car X and Y Coordinates Without Modisfyng them
GetCary(DrawY);
for (int DrawX; DrawX <= 200; DrawX++) //Suposed To Draw A Red Box
{
for (int DrawY; DrawY <= 300; DrawY++)
{
gfx.PutPixel(DrawX, DrawY, 200, 0, 0);
}
}
for (int screen_height = 0; screen_height <= 799; screen_height++) //Draws The Green layer on the bottom of the screen
{
for (int screen_lenght = 400; screen_lenght <= 599; screen_lenght++)
{
gfx.PutPixel(screen_height, screen_lenght, 0, 200, 0);
}
}
}
Code: Select all
[code]