Skip to content

Commit

Permalink
Release current version
Browse files Browse the repository at this point in the history
  • Loading branch information
tiutenkov committed May 26, 2021
0 parents commit 5a830bc
Show file tree
Hide file tree
Showing 30 changed files with 1,109 additions and 0 deletions.
849 changes: 849 additions & 0 deletions Header.cpp

Large diffs are not rendered by default.

131 changes: 131 additions & 0 deletions Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#include <SFML/Graphics.hpp>
#include <ctime>
#include <windows.h>
#include <iostream>
#include <math.h>

using namespace sf;

extern int masbottom[3];
extern int masright[3];
extern int masleft[3];
extern int masup[3];
extern int counter;
extern int icounter;

extern int counterofall;

extern int countertriangle;
extern int countersquare;
extern int counterpentagon;
extern const int radius;
extern int delay;

class Point
{
public:
virtual int getterx1() = 0;
virtual int gettery1() = 0;

Point(int x1, int y1);
Point();
protected:
int x1;
int y1;
};

class Triangle : public Point {

public:
Triangle(int x1, int y1, int x2, int y2, int x3, int y3, int movex, int movey);
Triangle();
Triangle(const Triangle& triangle);
Triangle* increasemas(Triangle mas[], int countertriangle, int exsisti);
Triangle* delmas(Triangle mas[], int& countertriangle);

int checkforexistence(Triangle mas[], int countertriangle);
virtual int getterx1();
virtual int getterx2();
virtual int getterx3();
virtual int gettery1();
virtual int gettery2();
virtual int gettery3();
virtual int gettermovex();
virtual int gettermovey();
virtual int gettercolorR();
virtual int gettercolorG();
virtual int gettercolorB();
virtual int gettercenterx();
virtual int gettercentery();
virtual int getterhp();
virtual void setterhp(int hp);
virtual void border();
virtual void move();
protected:
int x2;
int x3;
int y2;
int y3;
int centerx;
int centery;
int hp;
int color[3];
int movex;
int movey;
int temp;

};




class Square : public Triangle {
public:
Square(int x1, int y1, int x2, int y2, int x3, int y3, int movex, int movey, int x4, int y4);
Square();
Square(const Square& square);

Square* increasemas(Square mas[], int countertsquare, int exsisti);
Square* delmas(Square mas[], int& countertsquare);
int checkforexistence(Square mas[], int countertsquare);

virtual int getterx4();
virtual int gettery4();
protected:
int x4;
int y4;
};



class Pentagon : public Square {

public:
Pentagon(int x1, int y1, int x2, int y2, int x3, int y3, int movex, int movey, int x4, int y4, int x5, int y5);
Pentagon();
virtual int getterx5();
virtual int gettery5();
Pentagon* increasemas(Pentagon mas[], int countertpentagon, int exsisti);
Pentagon* delmas(Pentagon mas[], int& countertpentagon);
int checkforexistence(Pentagon mas[], int counterpentagon);
protected:
int x5;
int y5;
};

template <typename T, typename T1>
int touch(T& obj1, T1& obj2) {
unsigned int katet1, katet2;
katet1 = obj1.gettermovex() - obj2.gettermovex();
katet2 = obj1.gettermovey() - obj2.gettermovey();
if (sqrt(katet1 * katet1 + katet2 * katet2) <= (radius + radius))
{
return 1;
}
else
return 0;
}
void draw(RenderWindow& window, Triangle*& triangle, Square*& square, Pentagon*& pentagon, Sprite iHP[]);
int Objects(RenderWindow& window, Triangle*& triangle, Square*& square, Pentagon*& pentagon, Texture Cloud[], Texture Heart);
int check(RenderWindow& window);
void menu(RenderWindow& window);
Binary file added Images/HP2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/HP3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Heart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/birthportal1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/birthportal2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/birthportal3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/cloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/cloud1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/cloud2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/exit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/exit1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/exit2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/exit3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/exits.psd
Binary file not shown.
Binary file added Images/fon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/fonforgame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/fonforgame1.psd
Binary file not shown.
Binary file added Images/fonmenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/heart, cloud.psd
Binary file not shown.
Binary file added Images/hp1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/portal.psd
Binary file not shown.
Binary file added Images/start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/startexit.psd
Binary file not shown.
Binary file added Images/zast.psd
Binary file not shown.
Binary file added Images/Без имени-3.psd
Binary file not shown.
Binary file added Images/Без имени1-1.psd
Diff not rendered.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Курсовая работа / Course work

## _По дисциплине: «Объектно-ориентированное программирование»_

## _Тема: «Реализация некоторого компьютерного мира»_

#

### Технологии ООП, использованные в работе:

- Инкапсуляция.
- Наследование: 4 класса, один из которых абстрактный.
- Полиморфизм: использование конструкторов, а так же их перегрузки.
- Виртуальные функции.
- Множественное наследование (наследование 3-х классов).
- Конструкторы копирования.
- Параметры по умолчанию.
- Использование объектов в качестве аргументов или возвращаемых значений.
111 changes: 111 additions & 0 deletions Source.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#include <SFML/Graphics.hpp>
#include <ctime>
#include <windows.h>
#include <iostream>
#include <math.h>
#include "Header.h"

using namespace sf;

int main()
{
srand(time(0));
Triangle* triangle = new Triangle[1]
{
{0, 0, 0, 20, 20, 10, 20, 20}
};

Square* square = new Square[1]
{
{0, 0, 0, 20, 20, 20, 300, 400, 20, 0}
};

Pentagon* pentagon = new Pentagon[1]
{
{0, 0, 12, 15, 27, 15, 400, 400, 39, 0, 20, -15}
};
RenderWindow window(VideoMode(1300, 700), "LUDOJOP!");
menu(window);
Clock clock;
//std::cout << triangle.gettercenterx() << " " << triangle.gettercentery() << std::endl;
//std::cout << square.gettercenterx() << " " << square.gettercentery() << std::endl;

Texture Background;
Background.loadFromFile("Images/fonforgame.png");

Sprite iBackground;
iBackground.setTexture(Background);


Texture Portal[3];
Portal[0].loadFromFile("Images/birthportal1.png");
Portal[1].loadFromFile("Images/birthportal2.png");
Portal[2].loadFromFile("Images/birthportal3.png");

Texture Heart;
Heart.loadFromFile("Images/Heart.png");


Texture Cloud[3];
Cloud[0].loadFromFile("Images/cloud.png");
Cloud[1].loadFromFile("Images/cloud1.png");
Cloud[2].loadFromFile("Images/cloud2.png");

Texture HP1;
HP1.loadFromFile("Images/HP1.png");

Texture HP2;
HP2.loadFromFile("Images/HP2.png");

Texture HP3;
HP3.loadFromFile("Images/HP3.png");



Sprite iHP[3];
iHP[0].setTexture(HP1);
iHP[1].setTexture(HP2);
iHP[2].setTexture(HP3);

int iforportal = 0;
int cloudcounter = 0;
int portalcounter = 0;



while (window.isOpen())
{
float time = clock.getElapsedTime().asMicroseconds();
Event event;
while (window.pollEvent(event))
{
if (event.type == Event::Closed)
window.close();
}

Sprite iPortal[3];
if (portalcounter == 50)
{
portalcounter = 0;
iforportal++;
}
portalcounter++;
if (iforportal == 3)
{
iforportal = 0;
}

iPortal[iforportal].setTexture(Portal[iforportal]);
iPortal[iforportal].setPosition(570, -22);


window.draw(iPortal[iforportal]);
draw(window, triangle, square, pentagon, iHP);
Objects(window, triangle, square, pentagon, Cloud, Heart);
delay--;

window.display();
window.draw(iBackground);
}
return 0;
}

0 comments on commit 5a830bc

Please sign in to comment.