Skip to content

Commit

Permalink
3D: Code reformats
Browse files Browse the repository at this point in the history
  • Loading branch information
kenorb committed Oct 29, 2021
1 parent d9a0b3a commit 71c58c0
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 36 deletions.
5 changes: 3 additions & 2 deletions 3D/Chart3DCandles.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Chart3DCandles : public Chart3DType {
cube1.Ptr().GetTSR().translation.y = chart3d.GetPriceScale(_ohlc.GetMinOC()) + _height / 2;
cube1.Ptr().GetTSR().scale.y = _height;

//Print(cube1.Ptr().GetTSR().translation.y);
// Print(cube1.Ptr().GetTSR().translation.y);

cube1.Ptr().GetMaterial().SetColor(higher ? 0x22FF11 : 0xFF1122);
_device.Render(cube1.Ptr());
Expand All @@ -93,7 +93,8 @@ class Chart3DCandles : public Chart3DType {
cube3.Ptr().GetTSR().translation.y = _y;
cube3.Ptr().GetTSR().scale.x = 200.0f;

_device.DrawText(5, _y, StringFormat("%." + IntegerToString(_digits) + "f", _s), 0x90FFFFFF, TA_LEFT | TA_VCENTER, GFX_DRAW_TEXT_FLAG_2D_COORD_X);
_device.DrawText(5, _y, StringFormat("%." + IntegerToString(_digits) + "f", _s), 0x90FFFFFF, TA_LEFT | TA_VCENTER,
GFX_DRAW_TEXT_FLAG_2D_COORD_X);

cube3.Ptr().GetMaterial().SetColor(0x333333);
_device.Render(cube3.Ptr());
Expand Down
4 changes: 1 addition & 3 deletions 3D/Chart3DType.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ class Chart3DType : public Dynamic {
*/
Chart3DType(Chart3D* _chart3d, Device* _device) : chart3d(_chart3d), device(_device) {}

Device* GetDevice() {
return device;
}
Device* GetDevice() { return device; }

/**
* Renders chart.
Expand Down
10 changes: 3 additions & 7 deletions 3D/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@
#include "Shader.h"
#include "VertexBuffer.h"

enum GFX_DRAW_TEXT_FLAGS {
GFX_DRAW_TEXT_FLAG_NONE,
GFX_DRAW_TEXT_FLAG_2D_COORD_X,
GFX_DRAW_TEXT_FLAG_2D_COORD_Y
};
enum GFX_DRAW_TEXT_FLAGS { GFX_DRAW_TEXT_FLAG_NONE, GFX_DRAW_TEXT_FLAG_2D_COORD_X, GFX_DRAW_TEXT_FLAG_2D_COORD_Y };

enum ENUM_CLEAR_BUFFER_TYPE { CLEAR_BUFFER_TYPE_COLOR, CLEAR_BUFFER_TYPE_DEPTH };

Expand Down Expand Up @@ -201,7 +197,6 @@ class Device : public Dynamic {
IndexBuffer* _indices;
_mesh.GetBuffers(&this, _vertices, _indices);


SetMaterial(_mesh.GetMaterial());

PushTransform(_mesh.GetTSR());
Expand Down Expand Up @@ -264,7 +259,8 @@ class Device : public Dynamic {
/**
* Enqueues text to be drawn directly into the pixel buffer. Queue will be processed in the Device::End() method.
*/
void DrawText(float _x, float _y, string _text, unsigned int _color = 0xFFFFFFFF, unsigned int _align = 0, unsigned int _flags = 0) {
void DrawText(float _x, float _y, string _text, unsigned int _color = 0xFFFFFFFF, unsigned int _align = 0,
unsigned int _flags = 0) {
DViewport _viewport;
_viewport.x = 0;
_viewport.y = 0;
Expand Down
6 changes: 2 additions & 4 deletions 3D/Frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ struct DrawTextQueueItem {
*/
class Frontend : public Dynamic {
protected:

DrawTextQueueItem draw_text_queue[];
DrawTextQueueItem draw_text_queue[];

public:
/**
Expand Down Expand Up @@ -105,8 +104,7 @@ class Frontend : public Dynamic {
ArrayResize(draw_text_queue, 0);
}

protected:

protected:
/**
* Draws text directly into the pixel buffer. Should be executed after all 3d drawing.
*/
Expand Down
8 changes: 4 additions & 4 deletions 3D/Frontends/MT5Frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ class MT5Frontend : public Frontend {
*/
virtual void DrawTextNow(int _x, int _y, string _text, unsigned int _color = 0xFFFFFFFF, unsigned int _align = 0) {
TextSetFont("Arial", -80, FW_EXTRABOLD, 0);
#ifdef __debug__
#ifdef __debug__
Print("TextSetFont: LastError = ", GetLastError());
#endif
#endif

TextOut(_text, _x, _y, _align, image, Width(), Height(), _color, COLOR_FORMAT_ARGB_NORMALIZE);
#ifdef __debug__
#ifdef __debug__
Print("TextOut: LastError = ", GetLastError());
#endif
#endif
}
};
16 changes: 4 additions & 12 deletions 3D/Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ void OnChartEvent(const int id, const long& lparam, const double& dparam, const
int _window = 0;
InterfaceEvent _event;


if (id == CHART_EVENT_MOUSE_MOVE) {
Interface::mouse_pos_x = (int)lparam;
Interface::mouse_pos_y = (int)dparam;
Expand All @@ -74,12 +73,9 @@ void OnChartEvent(const int id, const long& lparam, const double& dparam, const

typedef void (*InterfaceListener)(InterfaceEvent&, void*);

class Interface
{
class Interface {
public:

struct Installation
{
struct Installation {
InterfaceListener listener;
void* target;
};
Expand Down Expand Up @@ -120,13 +116,9 @@ class Interface
}
}

static int GetMouseX() {
return mouse_pos_x;
}
static int GetMouseX() { return mouse_pos_x; }

static int GetMouseY() {
return mouse_pos_y;
}
static int GetMouseY() { return mouse_pos_y; }
#endif
};

Expand Down
8 changes: 4 additions & 4 deletions 3D/Math.h
Original file line number Diff line number Diff line change
Expand Up @@ -3155,10 +3155,10 @@ void DXSHRotate(float &out[], int order, const DXMatrix &_matrix, const float &i
gamma = 0.0f;
}
#else
alpha = 0.0f;
beta = 0.0f;
gamma = 0.0f;
sinb = 0.0f;
alpha = 0.0f;
beta = 0.0f;
gamma = 0.0f;
sinb = 0.0f;
#endif

//---
Expand Down

0 comments on commit 71c58c0

Please sign in to comment.