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

Matija_Javor_zadaca1_DBele #346

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions Cvijet.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
#include "Cvijet.h"
using namespace sf;




Cvijet::Cvijet(RenderWindow* window)
{
this->window = window;
}

void Cvijet::draw()
{
sf::RectangleShape pozadina(sf::Vector2f(800, 600));
pozadina.setFillColor(sf::Color(173,216, 230));
pozadina.setPosition(0, 0);

sf::RectangleShape trava(sf::Vector2f(800, 25));
trava.setFillColor(sf::Color(0, 255, 0));
trava.setPosition(0, 550);

sf::RectangleShape zemlja(sf::Vector2f(800, 25));
zemlja.setFillColor(sf::Color(97, 51, 24));
zemlja.setPosition(0, 575);

sf::RectangleShape stabljika(sf::Vector2f(150.f, 12.f));
stabljika.setFillColor(sf::Color(1, 110, 20));
stabljika.setPosition(400, 400);
stabljika.rotate(90.f);

sf::CircleShape tucak(40.f, 9);
tucak.setFillColor(sf::Color(255,194,0));
tucak.setPosition(355, 350);

sf::CircleShape latica1(30.f);
latica1.setPosition(365, 320);
latica1.setFillColor(sf::Color(75, 0, 130));

sf::CircleShape latica2(30.f);
latica2.setPosition(390, 330);
latica2.setFillColor(sf::Color(75, 0, 130));

sf::CircleShape latica3(30.f);
latica3.setPosition(405, 350);
latica3.setFillColor(sf::Color(75, 0, 130));

sf::CircleShape latica4(30.f);
latica4.setPosition(400, 380);
latica4.setFillColor(sf::Color(75, 0, 130));

sf::CircleShape latica5(30.f);
latica5.setPosition(385, 395);
latica5.setFillColor(sf::Color(75, 0, 130));

sf::CircleShape latica6(30.f);
latica6.setPosition(350, 395);
latica6.setFillColor(sf::Color(75, 0, 130));

sf::CircleShape latica7(30.f);
latica7.setPosition(335, 380);
latica7.setFillColor(sf::Color(75, 0, 130));

sf::CircleShape latica8(30.f);
latica8.setPosition(330, 355);
latica8.setFillColor(sf::Color(75, 0, 130));

sf::CircleShape latica9(30.f);
latica9.setPosition(335, 335);
latica9.setFillColor(sf::Color(75, 0, 130));

sf::ConvexShape list;
list.setPointCount(13);

list.setPoint(0, sf::Vector2f(0.f, 0.f));
list.setPoint(1, sf::Vector2f(-15.f, 15.f));
list.setPoint(2, sf::Vector2f(-6.f, 15.f));
list.setPoint(3, sf::Vector2f(-25.f, 30.f));
list.setPoint(4, sf::Vector2f(-14.f, 30.f));
list.setPoint(5, sf::Vector2f(-28.f, 45.f));
list.setPoint(6, sf::Vector2f(0.f, 60.f));
list.setPoint(7, sf::Vector2f(28.f, 45.f));
list.setPoint(8, sf::Vector2f(14.f, 30.f));
list.setPoint(9, sf::Vector2f(25.f, 30.f));
list.setPoint(10, sf::Vector2f(6.f, 15.f));
list.setPoint(11, sf::Vector2f(15.f, 15.f));
list.setPoint(12, sf::Vector2f(0.f, 0.f));
list.setPosition(400, 520);
list.setFillColor(sf::Color(0, 128, 0));
list.rotate(127.f);

sf::ConvexShape list2;
list2.setPointCount(13);

list2.setPoint(0, sf::Vector2f(0.f, 0.f));
list2.setPoint(1, sf::Vector2f(-15.f, 15.f));
list2.setPoint(2, sf::Vector2f(-6.f, 15.f));
list2.setPoint(3, sf::Vector2f(-25.f, 30.f));
list2.setPoint(4, sf::Vector2f(-14.f, 30.f));
list2.setPoint(5, sf::Vector2f(-28.f, 45.f));
list2.setPoint(6, sf::Vector2f(0.f, 60.f));
list2.setPoint(7, sf::Vector2f(28.f, 45.f));
list2.setPoint(8, sf::Vector2f(14.f, 30.f));
list2.setPoint(9, sf::Vector2f(25.f, 30.f));
list2.setPoint(10, sf::Vector2f(6.f, 15.f));
list2.setPoint(11, sf::Vector2f(15.f, 15.f));
list2.setPoint(12, sf::Vector2f(0.f, 0.f));
list2.setPosition(390, 510);
list2.setFillColor(sf::Color(0, 128, 0));
list2.rotate(250.f);

sf::ConvexShape sunce;
sunce.setPointCount(40);
sunce.setFillColor(sf::Color(255,255,0));

float vanjskiR = 100.0f;
float unutarnjiR = 50.0f;
float yPos = 100.0f;

float rast_kut = 360.0f / 20;
float trenutni_kut = 0.0f;

static float xPos = -100.0f;
xPos += 3.0f;

for (int i = 0; i < 20; ++i) {

float kut = trenutni_kut + i * rast_kut;
float vanjskiX = xPos + vanjskiR * cos(kut * 3.14159f / 180);
float vanjskiY = yPos + vanjskiR * sin(kut * 3.14159f / 180);
float unutarnjiX = xPos + unutarnjiR * cos((kut + rast_kut) * 3.14159f / 180);
float unutarnjiY = yPos + unutarnjiR * sin((kut + rast_kut) * 3.14159f / 180);

sunce.setPoint(i * 2, sf::Vector2f(vanjskiX, vanjskiY));
sunce.setPoint(i * 2 + 1, sf::Vector2f(unutarnjiX, unutarnjiY));
}





window->draw(pozadina);
window->draw(zemlja);
window->draw(trava);
window->draw(stabljika);
window->draw(latica1);
window->draw(latica2);
window->draw(latica3);
window->draw(latica4);
window->draw(latica5);
window->draw(latica6);
window->draw(latica7);
window->draw(latica8);
window->draw(latica9);
window->draw(list);
window->draw(list2);
window->draw(tucak);
window->draw(sunce);
}


22 changes: 22 additions & 0 deletions Cvijet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once
#include <SFML/Graphics.hpp>
using namespace std;


class Cvijet
{
private:
sf::RenderWindow* window;
sf::CircleShape circle;
sf::RectangleShape line;
sf::ConvexShape convex;




public:
Cvijet(sf::RenderWindow* window);
void draw();

};

26 changes: 26 additions & 0 deletions Source.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <SFML/Graphics.hpp>
#include "Cvijet.h"

int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "Hello, SFML world!");
window.setFramerateLimit(60);
Cvijet cvijet(&window);

while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{

if (event.type == sf::Event::Closed)
window.close();
}

window.clear();
cvijet.draw();
window.display();
}

return 0;
}
167 changes: 167 additions & 0 deletions SpaDomacaZadaca01.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{27E5E2CC-0412-4F77-917C-6285F9D6F224}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>SpaDomacaZadaca01</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>SFML_STATIC;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>D:\Temp\SPA DZ01 SFML\SFML-2.4.2\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>D:\Temp\SPA DZ01 SFML\SFML-2.4.2\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>opengl32.lib; freetype.lib; jpeg.lib; winmm.lib; sfml-graphics-s-d.lib; sfml-window-s-d.lib; sfml-system-s-d.lib; kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>SFML_STATIC; _DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\SFML-2.5.1\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>..\SFML-2.5.1\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>opengl32.lib; freetype.lib; winmm.lib; sfml-graphics-s-d.lib; sfml-window-s-d.lib; sfml-system-s-d.lib; kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>SFML_STATIC;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>D:\Temp\SPA DZ01 SFML\SFML-2.4.2\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>D:\Temp\SPA DZ01 SFML\SFML-2.4.2\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>opengl32.lib; freetype.lib; jpeg.lib; winmm.lib; sfml-graphics-s-d.lib; sfml-window-s-d.lib; sfml-system-s-d.lib; kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>SFML_STATIC; NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\SFML-2.5.1\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>..\SFML-2.5.1\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>opengl32.lib; freetype.lib; winmm.lib; sfml-graphics-s-d.lib; sfml-window-s-d.lib; sfml-system-s-d.lib; kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Cvijet.cpp" />
<ClCompile Include="Source.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Cvijet.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Loading