Skip to content
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
33 changes: 32 additions & 1 deletion Frontend/GFXUtilities/ActionBubble.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef _RUACTIONBUBBLE
#define _RUACTIONBUBBLE

#include "GraphablePoint.h"
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <map>
Expand All @@ -29,7 +30,7 @@
class gfxpp;
class Point2;

class ActionBubble
class ActionBubble : public GraphablePoint
{
protected:

Expand Down Expand Up @@ -62,6 +63,36 @@ class ActionBubble
float getCost() const;
int getQuantity() const;
int getActionType() const;

virtual double getX() const
{
return 0;
}

virtual double getY() const
{
return 0;
}

virtual void setX(double newX)
{
//
}

virtual void setY(double newY)
{
//
}

virtual double getMinY() const
{
return 0;
}

virtual double getMaxY() const
{
return 0;
}
};

#endif
21 changes: 21 additions & 0 deletions Frontend/GFXUtilities/Candle.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef _GCANDLE
#define _GCANDLE

#include "GraphablePoint.h"
#include <float.h>
#include <iostream>
#include <math.h>
Expand Down Expand Up @@ -120,6 +121,26 @@ class Candle
{
return (getX() > c2.getX());
}

virtual double getY() const
{
return getClose();
}

virtual void setY(double newY)
{
//
}

virtual double getMinY() const
{
return getLow();
}

virtual double getMaxY() const
{
return getHigh();
}
};

#endif
35 changes: 34 additions & 1 deletion Frontend/GFXUtilities/Circle.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#ifndef _RUCIRCLE
#define _RUCIRCLE

#include "GraphablePoint.h"
#include "point2.h"
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <map>
Expand All @@ -29,7 +31,7 @@
class gfxpp;
class Point2;

class Circle
class Circle : public GraphablePoint
{
protected:

Expand All @@ -47,6 +49,37 @@ class Circle

const Point2* getCenter() const;
double getRadius() const;

virtual double getX() const
{
return 0;
}

virtual double getY() const
{
return 0;
}

virtual void setX(double newX)
{
center->setX(newX);
}

virtual void setY(double newY)
{
center->setY(newY);
}

virtual double getMinY() const
{
return center->getY();
}

virtual double getMaxY() const
{
return center->getY();
}

};

#endif
2 changes: 1 addition & 1 deletion Frontend/GFXUtilities/DrawNeuralNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void DrawNeuralNet::setWeights(shmea::GList weights)
int neuron = 0;

std::vector<shmea::GPointer<float> > newWeights;
for(int i = 0; i < weights.size(); ++i)
for(unsigned int i = 0; i < weights.size(); ++i)
{
if(weights[i].getType() == shmea::GType::FLOAT_TYPE)
{
Expand Down
39 changes: 35 additions & 4 deletions Frontend/GFXUtilities/DrawNeuralNet.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#ifndef _DRAWNEURALNET
#define _DRAWNEURALNET

#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include "GraphablePoint.h"
#include "RULayerInfo.h"
#include <vector>
#include "Backend/Database/GPointer.h"
#include "Backend/Database/GList.h"
#include "Backend/Database/GType.h"
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <vector>

class gfxpp;

class DrawNeuralNet
class DrawNeuralNet : public GraphablePoint
{

protected:
Expand Down Expand Up @@ -41,6 +43,35 @@ class DrawNeuralNet

void displayNeuralNet();

virtual double getX() const
{
return 0;
}

virtual double getY() const
{
return 0;
}

virtual void setX(double newX)
{
//
}

virtual void setY(double newY)
{
//
}

virtual double getMinY() const
{
return 0;
}

virtual double getMaxY() const
{
return 0;
}



Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Robert Carneiro, Derek Meer, Matthew Tabak, Eric Lujan
// Copyright 2024 Robert Carneiro, Derek Meer, Matthew Tabak, Eric Lujan
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
// associated documentation files (the "Software"), to deal in the Software without restriction,
Expand All @@ -14,59 +14,26 @@
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef _GRAPHABLEATTR_H
#define _GRAPHABLEATTR_H
#ifndef _GRAPHABLEPOINT
#define _GRAPHABLEPOINT

#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <pthread.h>
#include <float.h>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include "../GFXUtilities/point2.h"
#include "../GFXUtilities/Candle.h"
#include "../Graphics/graphics.h"
#include "Backend/Database/GList.h"
#include "Backend/Database/standardizable.h"

class RUGraph;

class GraphableAttr : public shmea::GStandardizable
class GraphablePoint
{
protected:
RUGraph* parent;
bool xMode;
bool yMode;
SDL_Color lineColor;

public:
virtual double getX() const = 0;
virtual double getY() const = 0;

const static int TEXTURE_MAX_DIM = 16384;

// constructors & destructor
GraphableAttr();
GraphableAttr(RUGraph*, SDL_Color);
virtual ~GraphableAttr();

// gets
float getXMinModed() const;
float getXMaxModed() const;
float getYMinModed() const;
float getYMaxModed() const;
bool getXMode() const;
bool getYMode() const;
SDL_Color getColor() const;

// sets
void setXMode(bool);
void setYMode(bool);
void setColor(SDL_Color);
virtual void clear();
virtual void setX(double) = 0;
virtual void setY(double) = 0;

// render
virtual void draw(gfxpp*) = 0;
virtual void updateBackground(gfxpp*);
virtual double getMinY() const = 0;
virtual double getMaxY() const = 0;
};

#endif
23 changes: 22 additions & 1 deletion Frontend/GFXUtilities/Horizontal_Line.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
#ifndef _GHORIZONTALLINE
#define _GHORIZONTALLINE

#include "GraphablePoint.h"
#include <float.h>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>

class Horizontal_Line
class Horizontal_Line : public GraphablePoint
{
private:
double y;
Expand Down Expand Up @@ -93,6 +94,26 @@ class Horizontal_Line
{
return (getY() > c2.getY());
}

virtual double getX() const
{
return 0;
}

virtual void setX(double newX)
{
//
}

virtual double getMinY() const
{
return getY();
}

virtual double getMaxY() const
{
return getY();
}
};

#endif
14 changes: 0 additions & 14 deletions Frontend/GFXUtilities/point2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,3 @@ void Point2::normalize()
x /= len;
y /= len;
}

shmea::GList Point2::toXVectorData() const
{
shmea::GList xData;
xData.addFloat(getX());
return xData;
}

shmea::GList Point2::toYVectorData() const
{
shmea::GList yData;
yData.addFloat(getY());
return yData;
}
16 changes: 12 additions & 4 deletions Frontend/GFXUtilities/point2.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
#ifndef _GPOINT2
#define _GPOINT2

#include "GraphablePoint.h"
#include <float.h>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include "Backend/Database/StandItem.h"

class Point2 : public shmea::StandItem
class Point2 : public GraphablePoint
{
private:
double x, y;
Expand All @@ -46,8 +46,6 @@ class Point2 : public shmea::StandItem
void setX(double);
void setY(double);
void normalize();
virtual shmea::GList toXVectorData() const;
virtual shmea::GList toYVectorData() const;

// operators
inline Point2 operator+(Point2 v)
Expand Down Expand Up @@ -106,6 +104,16 @@ class Point2 : public shmea::StandItem
{
return (getX() > c2.getX());
}

virtual double getMinY() const
{
return getY();
}

virtual double getMaxY() const
{
return getY();
}
};

#endif
Loading