Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
ebf8497
Adding sprites
oBornToCreateo Apr 16, 2018
e804baf
Weard bug
oBornToCreateo Apr 17, 2018
c8403e8
Vector class added
oBornToCreateo Apr 21, 2018
8beadab
furder changes to vec2 class
oBornToCreateo Apr 21, 2018
45ec69a
some chnges
oBornToCreateo Apr 21, 2018
5c708a4
Boolean operations added to vec2
oBornToCreateo Apr 21, 2018
b361341
code for help
oBornToCreateo Apr 22, 2018
e8a3aa3
Done Vec and line in graphics fully functional
oBornToCreateo Apr 22, 2018
43281ba
Clean
oBornToCreateo Apr 22, 2018
ad7ccac
Merge pull request #1 from oBornToCreateo/PopUpMenu
oBornToCreateo Apr 22, 2018
eb0d0db
aded utility functions for draw arc circle and line, some visual bugs
oBornToCreateo Apr 28, 2018
bd22561
test code
oBornToCreateo Apr 28, 2018
ce54adc
Fixed Bug caused by menu (gaps in shapes)
oBornToCreateo May 1, 2018
758de42
Added thin line shape drawing algorithms radius and centre controlled…
oBornToCreateo May 1, 2018
eeab153
Changed pair to Vei2
oBornToCreateo May 6, 2018
edd66a4
Cleanup
oBornToCreateo May 6, 2018
4cd9e6b
Spotted little bug passing collor without radius
oBornToCreateo May 6, 2018
52d0117
Finally 3 point circle done
oBornToCreateo May 17, 2018
430634f
Function calculating slope of line
oBornToCreateo May 17, 2018
fbe4c74
Oops forgot to commit
oBornToCreateo May 17, 2018
c8d2450
Change of naming convencion
oBornToCreateo May 24, 2018
cd2d471
Fixing return type name
oBornToCreateo May 26, 2018
bc98eb0
Function to draw circle throught 3 points
oBornToCreateo May 26, 2018
9c6953c
Hange of naming convention
oBornToCreateo May 26, 2018
3a4b0e1
Debugged and running
oBornToCreateo May 26, 2018
e66c048
Aded circle class
oBornToCreateo Jun 4, 2018
11d91b0
Cosmetic changes
oBornToCreateo Jun 4, 2018
ce90b40
Fixed halfmemory casting prblem in x64 mode
oBornToCreateo Jun 10, 2018
9ea5867
Refactorisation of circle drawing and inicialisation routine
oBornToCreateo Jun 10, 2018
33a5dd4
Mathematical changes
oBornToCreateo Jun 10, 2018
ba392cc
Utility changes
oBornToCreateo Jun 15, 2018
dcc8172
Anoying warning fixed
oBornToCreateo Jun 15, 2018
750d690
Added Coordinate trasformer to the pipeline
oBornToCreateo Jun 15, 2018
9797e9d
Vector class was rewriten
oBornToCreateo Jun 19, 2018
c45e0ab
Added coordinate trasformer and Star
oBornToCreateo Jun 19, 2018
55ca4ce
Changed return value for get pos
oBornToCreateo Jun 21, 2018
83bc5e6
Deleted un used functions
oBornToCreateo Jun 22, 2018
d12c6c2
Code for state machine
oBornToCreateo Jun 22, 2018
3a76bb4
State machine continuation
oBornToCreateo Jun 22, 2018
69698da
Calling circle form pop up menu implemented
oBornToCreateo Jun 24, 2018
fca212f
fixed CT point coordinate conversion template bug
oBornToCreateo Jun 27, 2018
731571a
Circe drawing and selecting routine fully functional
oBornToCreateo Jun 27, 2018
960c244
added circle erasing functionality thanx chili
oBornToCreateo Jun 29, 2018
7862b23
Merge pull request #2 from oBornToCreateo/dev
oBornToCreateo Jun 29, 2018
e717aa2
Conversion equals operator
oBornToCreateo Jul 1, 2018
ab28a87
Aded -= += operators for points and enabled constructor point/vector …
oBornToCreateo Jul 4, 2018
8b22e87
Added camera trasformations to the pipeline (via arrow keys)
oBornToCreateo Jul 4, 2018
623f09c
Re edited Return type for mouse get pos
oBornToCreateo Jul 4, 2018
1191191
VIP Camera mouse controling and scaling entites
oBornToCreateo Jul 4, 2018
a57bce1
Added missing piace of documentation
oBornToCreateo Jul 4, 2018
f83eb06
Added whell press/release controll
oBornToCreateo Jul 7, 2018
b1ed0e6
Merge pull request #3 from oBornToCreateo/mouse_whel_press_imput
oBornToCreateo Jul 7, 2018
4c6de36
Made calculate centre fully private, changed selection margin from 4p…
oBornToCreateo Jul 9, 2018
65c740e
Probbably after adding new functionality to the frame work like OnWhe…
oBornToCreateo Jul 9, 2018
f34be9e
Refactoring name of method call from circle class SetTrueSelectionFla…
oBornToCreateo Jul 9, 2018
aac5e30
Added new funcionality possibility to remove seletionflag by combinin…
oBornToCreateo Jul 9, 2018
16cdf71
Change of naming convenction of enum class MWShapeState from Shape
oBornToCreateo Jul 9, 2018
348ac52
Polimorphism implementation problems asking for help on the forum
oBornToCreateo Jul 13, 2018
88a4289
Program is still working bugs fixed
oBornToCreateo Jul 13, 2018
286f3ec
Change of naming convencion! Changed shape and circle to JC_Circle an…
oBornToCreateo Jul 13, 2018
f5fec80
Created Menu items for 3point circle and line segment
oBornToCreateo Jul 14, 2018
45678ed
Added possibility to draw line in the problam Selecting not yet imple…
oBornToCreateo Jul 14, 2018
dbe91ad
Made possible to draw line while circle is created, Utility changes
oBornToCreateo Jul 14, 2018
4ae66a9
Adding Piaces of documentation to the Circle.h explaining creation of…
oBornToCreateo Jul 14, 2018
aadb9c1
Ortographic mistake in the Circle.h documentation
oBornToCreateo Jul 14, 2018
4530884
Getting read of old implementation
oBornToCreateo Jul 14, 2018
3cff885
Spotted Creation bug in coinstructor of Circle class (Circle from 3 p…
oBornToCreateo Jul 15, 2018
1b6bb3c
Added posibility to draw Line segment
oBornToCreateo Jul 15, 2018
5bf2de3
Added licence coment
oBornToCreateo Jul 15, 2018
1527172
Removed math functions from Circle class
oBornToCreateo Jul 16, 2018
b1ee67e
Dynamic 3 point circle drawing, implemented boolean operators for poi…
oBornToCreateo Jul 16, 2018
7b32217
Added posibility to draw closed Poliline with camera manipulations
oBornToCreateo Jul 20, 2018
1686a13
Added ability to draw line when 3 point circle is created
oBornToCreateo Jul 20, 2018
0485f20
Refactorisation of 3 point creation stages
oBornToCreateo Jul 20, 2018
d3edb40
Added point scalar multiplication
oBornToCreateo Jul 22, 2018
7e222b9
To three point circle added statements preventing creation of the cir…
oBornToCreateo Jul 22, 2018
b08c676
Fixed graphical issue causing 3point circle to do not display when P.…
oBornToCreateo Jul 22, 2018
72467dc
Getting read of star drawclosed poliline form frame work
oBornToCreateo Jul 22, 2018
db581fe
Selection of line implemented
oBornToCreateo Mar 17, 2019
2db66d2
Posibility to make description
oBornToCreateo Mar 18, 2019
625a724
Update of message layout
oBornToCreateo Mar 19, 2019
ff71a14
New circle drawing algorithm
oBornToCreateo Mar 20, 2019
248670e
Ability to draw bezier cuves
oBornToCreateo Mar 23, 2019
176b0df
Project cleanup
oBornToCreateo Mar 26, 2019
a0e7269
Added polio line drawing routine and prepared JC_MP_bbezier for imple…
oBornToCreateo Mar 30, 2019
39e3353
Fixsed poli line selection error
oBornToCreateo Apr 1, 2019
c7bb834
Prepared frame work foer text writting
oBornToCreateo Apr 1, 2019
d57086f
Merge pull request #4 from oBornToCreateo/dev
oBornToCreateo Apr 1, 2019
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
11 changes: 7 additions & 4 deletions Chili Framework 2016.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2035
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Engine", "Engine\Engine.vcxproj", "{FFCA512B-49FC-4FC8-8A73-C4F87D322FF2}"
EndProject
Expand All @@ -15,8 +15,8 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FFCA512B-49FC-4FC8-8A73-C4F87D322FF2}.Debug|x64.ActiveCfg = Debug|x64
{FFCA512B-49FC-4FC8-8A73-C4F87D322FF2}.Debug|x64.Build.0 = Debug|x64
{FFCA512B-49FC-4FC8-8A73-C4F87D322FF2}.Debug|x86.ActiveCfg = Debug|Win32
{FFCA512B-49FC-4FC8-8A73-C4F87D322FF2}.Debug|x86.Build.0 = Debug|Win32
{FFCA512B-49FC-4FC8-8A73-C4F87D322FF2}.Debug|x86.ActiveCfg = Debug|x64
{FFCA512B-49FC-4FC8-8A73-C4F87D322FF2}.Debug|x86.Build.0 = Debug|x64
{FFCA512B-49FC-4FC8-8A73-C4F87D322FF2}.Release|x64.ActiveCfg = Release|x64
{FFCA512B-49FC-4FC8-8A73-C4F87D322FF2}.Release|x64.Build.0 = Release|x64
{FFCA512B-49FC-4FC8-8A73-C4F87D322FF2}.Release|x86.ActiveCfg = Release|Win32
Expand All @@ -25,4 +25,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8E96B628-7273-433B-B7CE-8284E30105BC}
EndGlobalSection
EndGlobal
40 changes: 40 additions & 0 deletions Engine/ALIB_Bezier.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#pragma once

#include "JC_Shape.h"
#include "Camera.h"

class ALIB_Bezier : public JC_Shape
{
public:
ALIB_Bezier(JC_Point2d P, JC_Point2d Q, JC_Point2d R,Color color_in = Colors::White)
:
P(P),
Q(Q),
R(R),
JC_Shape(color_in)
{}

void Draw(Camera cam) override
{
cam.DrawBezier(P, Q, R, Base_Color);
}
bool IsInRange(const JC_Point2d& M) override
{
return false;
}

std::wstring MakeDescription() override
{

std::wstring PosP = L"X: " + std::to_wstring(P.x) + L"\n Y: " + std::to_wstring(P.y);
std::wstring PosQ = L"X: " + std::to_wstring(Q.x) + L"\n Y: " + std::to_wstring(Q.y);
std::wstring PosR = L"X: " + std::to_wstring(R.x) + L"\n Y: " + std::to_wstring(R.y);

return std::wstring(L"First point:\n " + PosP + L"Second point:\n " + PosQ + L"Third point:\n " + PosR);

}

private:
JC_Point2d P, Q, R;

};
100 changes: 100 additions & 0 deletions Engine/Camera.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#pragma once

#include "CordinateTrasformerh.h"
#include "JC_Vector2.h"

//Camera class should be responsible for scaling onad trafromation of the drawn objects
//It is the part of the screen pipeline

class Camera
{
public:
Camera (CoordinateTrasformer& ct)
:
ct(ct)
{}

JC_Point2d GetPos()const
{
return Camera_Pos;
}

void MoveBy(const JC_Vector2d& offset)
{
Camera_Pos += offset;
}

void MoweTo(const JC_Point2d pos_in)
{
Camera_Pos = pos_in;
}

void SetScale(double new_scale)
{
scale = new_scale;
}

double GetScale() const
{
return scale;
}

void DrawLine(JC_Point2d P_in, JC_Point2d Q_in, Color Color_in)
{
P_in -= Camera_Pos;
Q_in -= Camera_Pos;
ct.DrawLine(std::move(P_in), std::move(Q_in), std::move(Color_in));
}
void DrawPoliLine(std::vector<JC_Point2d> point_data, Color Color_in)
{
for (auto &P : point_data)
{
P -= Camera_Pos;
}

ct.DrawPoliLine(std::move(point_data), std::move(Color_in));
}
void DrawBezier(JC_Point2d P_in, JC_Point2d Q_in, JC_Point2d R_in, Color Color_in)
{
P_in -= Camera_Pos;
Q_in -= Camera_Pos;
R_in -= Camera_Pos;
ct.DrawBezier(std::move(P_in), std::move(Q_in), std::move(R_in) ,std::move(Color_in));
}

void DrawMPBezier(std::vector<JC_Point2d> point_data, Color Color_in)
{
for (auto &P : point_data)
{
P -= Camera_Pos;
}

ct.DrawMPBezier(std::move(point_data), std::move(Color_in));
}

void DrawCircle(JC_Point2d pos, double radius, int t, Color Color_in)
{
pos -= Camera_Pos;
ct.DrawCircle(std::move(pos), std::move(radius), t, std::move(Color_in));
}

// trasforms Point screen coordinates to mathematical coordinates regardles from cmaera position

template <typename T> JC_Point2<T> TrasformPoint(JC_Point2<T> input)
{
//fixes disconection between screen and math coordinates
input.x += (T)(Camera_Pos.x);
input.y -= (T)(Camera_Pos.y);

JC_Vector2<T> offset = { (T)(Graphics::ScreenWidth / 2), (T)(Graphics::ScreenHeight / 2) };
input -= offset;
input.y *= -1;
return input;
}

private:
double scale = 1.0;
JC_Point2d Camera_Pos = { 0.0,0.0 };
CoordinateTrasformer& ct;

};
67 changes: 67 additions & 0 deletions Engine/ChiliRectangle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#pragma once

#include "JC_Vector2.h"

template<typename T>
class CRectangle
{
public:
CRectangle(T left_in, T right_in, T top_in, T bottom_in)
:
left(left_in),
right(right_in),
top(top_in),
bottom(bottom_in)
{}
CRectangle(const JC_Vector2<T>& topLeft, const JC_Vector2<T>& bottomRight)
:
CRectangle(topLeft.x, bottomRight.x, topLeft.y, bottomRight.y)
{}
CRectangle(const JC_Vector2<T>& topLeft, T width, T height)
:
CRectangle(topLeft, topLeft + JC_Vector2<T>(width, height))
{}
bool IsOverlappingWith(const CRectangle& other) const
{
return right > other.left && left < other.right
&& bottom > other.top && top < other.bottom;
}
bool IsContainedBy(const CRectangle& other) const
{
return left >= other.left && right <= other.right &&
top >= other.top && bottom <= other.bottom;
}
bool Contains(const JC_Vector2<T>& point) const
{
return point.x >= left && point.x < right && point.y >= top && point.y < bottom;
}
CRectangle FromCenter(const JC_Vector2<T>& center, T halfWidth, T halfHeight)
{
const JC_Vector2<T> half(halfWidth, halfHeight);
return CRectangle(center - half, center + half);
}
CRectangle GetExpanded(T offset) const
{
return CRectangle(left - offset, right + offset, top - offset, bottom + offset);
}
JC_Vector2<T> GetCenter() const
{
return JC_Vector2<T>((left + right) / (T)2, (top + bottom) / (T)2);
}
T GetWidth() const
{
return right - left;
}
T GetHeight() const
{
return bottom - top;
}
public:
T left;
T right;
T top;
T bottom;
};

typedef CRectangle<int> RectI;
typedef CRectangle<double> RectD;
56 changes: 56 additions & 0 deletions Engine/ChiliUtil.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#pragma once

#include <vector>

// remove an element from a vector
// messes up the order of elements
// (faster than erase and doesn't need iter)
template<typename T>
inline void remove_element(std::vector<T>& vec, size_t index)
{
// swap element to be removed with element at back
std::swap(vec[index], vec.back());
// back is now what we want dead, so pop back!
vec.pop_back();
}

// binary search finds matching element
// otherwise returns end
// Acc is a functor used to access the search keys in the elements
template<class Iter, typename T, typename Acc>
auto binary_find(Iter begin, Iter end, const T& val,
Acc acc = [](const Iter::value_type& obj)
->const Iter::value_type& { return obj; })
{
// Finds the lower bound in at most log(last - first) + 1 comparisons
const auto i = std::lower_bound(begin, end, val,
[acc](const Iter::value_type& lhs, const T& rhs)
{
return acc(lhs) < rhs;
}
);

// if i is end, not found and do not dereference
// else i is either greater than or equal to value
// if not greater than, must be equal, so return it
if (i != end && !(val < acc(*i)))
{
return i; // found
}
else
{
return end; // not found
}
}

// uses remove_if to remove elements matching predicate over entire container
// and then calls erase to remove the 'empty' husks at the end
template<class Container, class Pred>
void remove_erase_if(Container& container, Pred pred)
{
// this destroys all elements matching the predicate
// and fills the spaces with elements from the end
const auto new_end = std::remove_if(container.begin(), container.end(), pred);
// erase garbage husk element at end
container.erase(new_end, container.end());
}
75 changes: 41 additions & 34 deletions Engine/ChiliWin.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,44 +23,51 @@
// target Windows 7 or later
#define _WIN32_WINNT 0x0601
#include <sdkddkver.h>

// The following #defines disable a bunch of unused windows stuff. If you
// get weird errors when trying to do some windows stuff, try removing some
// (or all) of these defines (it will increase build time though).
#define WIN32_LEAN_AND_MEAN
#define NOGDICAPMASKS
#define NOSYSMETRICS
#define NOMENUS
#define NOICONS
#define NOSYSCOMMANDS
#define NORASTEROPS
#define OEMRESOURCE
#define NOATOM
#define NOCLIPBOARD
#define NOCOLOR
#define NOCTLMGR
#define NODRAWTEXT
#define NOKERNEL
#define NONLS
#define NOMEMMGR
#define NOMETAFILE
#define NOMINMAX
#define NOOPENFILE
#define NOSCROLL
#define NOSERVICE
#define NOSOUND
#define NOTEXTMETRIC
#define NOWH
#define NOCOMM
#define NOKANJI
#define NOHELP
#define NOPROFILER
#define NODEFERWINDOWPOS
#define NOMCX
#define NORPC
#define NOPROXYSTUB
#define NOIMAGE
#define NOTAPE
#ifndef FULL_WINTARD

#define WIN32_LEAN_AND_MEAN //to exclude APIs such as Cryptography, DDE, RPC, Shell, and Windows Sockets.
#define NOGDICAPMASKS
#define NOSYSMETRICS
#define NOICONS
#define NOSYSCOMMANDS
#define NORASTEROPS
#define OEMRESOURCE
#define NOATOM
#define NOCLIPBOARD
#define NOCOLOR
#define NOCTLMGR
#define NOKERNEL
#define NONLS
#define NOMEMMGR
#define NOMETAFILE
#define NOOPENFILE
#define NOSCROLL
#define NOSERVICE
#define NOSOUND
#define NOTEXTMETRIC
#define NOWH
#define NOCOMM
#define NOKANJI
#define NOHELP
#define NOPROFILER
#define NODEFERWINDOWPOS
#define NOMCX
#define NORPC
#define NOPROXYSTUB
#define NOIMAGE
#define NOTAPE

#endif // FULL_WINTARD

//#define NODRAWTEXT
#define NOMINMAX
//#define NOMENUS
#ifndef STRICT
#define STRICT
#endif

#include <Windows.h>
Loading