Hi Guys. i got this problem with with drawing drawables from classes in main class, it does not draw anything accept the window and it's Background Color.
[ Tank.cpp ]
void Tank::Render()
{
t_window.Draw(t_tankSprite);
HandleInput();
}
[window.cpp]
void window::Create()
{
t_window.create({ t_windowSize.x, t_windowSize.y, 32 }, t_windowTitle, Style::Fullscreen);
}
void window::BeginDraw()
{
t_window.clear(Color(158, 154, 117, 255));
}
void window::EndDraw()
{
t_window.display();
}
void window::Update()
{
Event t_event;
if (t_window.pollEvent(t_event))
{
if (t_event.type == Event::Closed || (t_event.type == Event::KeyPressed && t_event.key.code == Keyboard::Escape))
t_IsDone = true;
}
}
[ Main.cpp ]
#include <Windows.h>
#include "Tank.h"
#ifndef window_h
#define window_h
#include "window.h"
#endif
using namespace sf;
int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow)
{
window win;
win.Setup("Tank Game", Vector2u(1024, 786));
win.Create();
Tank tank;
while (!win.IsDone())
{
win.BeginDraw();
win.Update();
tank.Render();
win.EndDraw();
}
return 0;
}