When I run the program via my IDE, random lines show up that don't exist in my file, covering up my actual thing I want to show
I can't run the .exe, wth this error: Debug Assertion Failed!
Program: C:\WINDOWS\SYSTEM32\MSVCP120D.dll
File: d:\microsoft visual studio\vc\include\vector
Line: 159
Expression: vector iterator + offset out of range
Can anyone help? Heres my code:
Game.cpp:
Code: Select all
/******************************************************************************************
* Chili DirectX Framework Version 14.03.22 *
* Game.cpp *
* Copyright 2014 PlanetChili.net <http://www.planetchili.net> *
* *
* This file is part of The Chili DirectX Framework. *
* *
* The Chili DirectX Framework is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* The Chili DirectX Framework is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with The Chili DirectX Framework. If not, see <http://www.gnu.org/licenses/>. *
******************************************************************************************/
#include "Game.h"
Game::Game( HWND hWnd,KeyboardServer& kServer,const MouseServer& mServer )
: gfx( hWnd ),
audio( hWnd ),
kbd( kServer ),
mouse( mServer ),
model( "suprise mothafucka.dxf" )
{
}
Game::~Game()
{
}
void Game::Go()
{
UpdateModel();
gfx.BeginFrame();
ComposeFrame();
gfx.EndFrame();
}
void Game::UpdateModel( )
{
}
void Game::ComposeFrame()
{
model.Draw({ 400.0f, 300.0f }, gfx);
}
Code: Select all
#pragma once
#include "Vec2.h"
#include "Colors.h"
#include "D3DGraphics.h"
#include "dxflib/dl_creationadapter.h"
#include "dxflib/dl_dxf.h"
#include <vector>
#include <memory>
class PolyClosedLoader : public DL_CreationAdapter{
public:
PolyClosedLoader(std::string filename){
std::unique_ptr< DL_Dxf > pDxf = std::make_unique<DL_Dxf >();
pDxf->in(filename, this);
}
virtual void addVertex(const DL_VertexData& data) override{
vertices.push_back({ (float)data.x, -(float)data.y });
}
std::vector< const Vec2 >& GetVertices(){
return vertices;
}
private:
std::vector< const Vec2 > vertices;
};
class PolyClosed{
public:
PolyClosed(std::initializer_list< Vec2 > vList, D3DCOLOR color = WHITE)
:
vertices(vList),
color(color)
{}
PolyClosed(std::string filename, D3DCOLOR color = WHITE) :
vertices(std::move(PolyClosedLoader(filename).GetVertices())), color(color){}
void Draw(Vec2 pos, D3DGraphics& gfx) const{
for (auto i = vertices.begin(), end = vertices.end() - 1; i != end; i++){
gfx.DrawLine(*i + pos, *(i + 1) + pos, color);
}
gfx.DrawLine(vertices.back() + pos, vertices.front() + pos, color);
}
private:
D3DCOLOR color;
const std::vector< const Vec2 > vertices;
};