31
DotNet / Drawing polygon
« on: January 03, 2011, 08:46:50 pm »
Fuck just read the other topic, I'll see if it auto updated or something. I'll probably downgrade it otherwise ...
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SFML;
using SFML.Window;
using SFML.Graphics;
namespace MusicSFML
{
class World
{
Shape polygon = new Shape();
public RenderWindow renderWindow = new RenderWindow(new VideoMode(1280, 720, 32), "Look at this it may even work");
public World()
{
renderWindow.Closed += new EventHandler(OnClosed);
renderWindow.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
polygon.AddPoint(new Vector2(10, 10), Color.Black);
polygon.AddPoint(new Vector2(50, 10), Color.Black);
polygon.AddPoint(new Vector2(50, 30), Color.Black);
polygon.AddPoint(new Vector2(10, 30), Color.Black);
polygon.Color = Color.Black;
polygon.EnableFill(true);
polygon.EnableOutline(true);
}
public void Think()
{
// Proccess events
renderWindow.DispatchEvents();
float frameTime = renderWindow.GetFrameTime();
}
public void Draw()
{
renderWindow.Clear(Color.White);
renderWindow.Draw(polygon);
}
void OnClosed(object sender, EventArgs e)
{
RenderWindow window = (RenderWindow)sender;
window.Close();
}
void OnKeyPressed(object sender, KeyEventArgs e)
{
RenderWindow window = (RenderWindow)sender;
if (e.Code == KeyCode.Escape)
window.Close();
}
}
}
'sfml.exe': Loaded 'C:\Users\Quincy\Documents\Visual Studio 2010\Projects\sfml\Debug\sfml.exe', Symbols loaded.
'sfml.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Users\Quincy\Documents\Visual Studio 2010\Projects\sfml\Debug\sfml-window-d-2.dll', Symbols loaded.
'sfml.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Users\Quincy\Documents\Visual Studio 2010\Projects\sfml\Debug\sfml-system-d-2.dll', Symbols loaded.
'sfml.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'sfml.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'sfml.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Users\Quincy\Documents\Visual Studio 2010\Projects\sfml\Debug\sfml-graphics-d-2.dll', Symbols loaded.
'sfml.exe': Loaded 'C:\Windows\SysWOW64\apphelp.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\userenv.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\profapi.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\winspool.drv', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\mpr.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Program Files (x86)\Common Files\microsoft shared\ink\tiptsf.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\atiglpxx.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\atioglxx.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\atigktxx.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\aticfx32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\atiadlxy.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'sfml.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
The program '[6764] sfml.exe: Native' has exited with code 0 (0x0).
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
// Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
// Start game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
// Clear the screen (fill it with black color)
App.Clear();
// Display window contents on screen
App.Display();
}
return EXIT_SUCCESS;
}
#include <SFML/Graphics.hpp>
int main()
{
// Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
// Start game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
// Clear the screen (fill it with black color)
App.Clear();
// Display window contents on screen
App.Display();
}
return EXIT_SUCCESS;
}
Can you give the complete list of libraries for your debug configuration?
Are you sure that you're not mixing debug mode and release libraries?
You can just press the green arrow (that starts the application with the debugger), it will recompile what's not up-to-date.
Regarding your linker errors, I think that you just forgot to link sfml-window.lib.
What error do you get?
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Close(void)" (?Close@Window@sf@@QAEXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::GetEvent(class sf::Event &)" (?GetEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::IsOpened(void)const " (?IsOpened@Window@sf@@QBE_NXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (??0VideoMode@sf@@QAE@III@Z) referenced in function _main
1>C:\Users\Quincy\documents\visual studio 2010\Projects\Neural\Debug\Neural.exe : fatal error LNK1120: 5 unresolved externals
I guess you've already compiled your own source code? Well, compiling SFML is not more complicated: just open the solution file and press "rebuild all"
It is even explained in the "getting started" tutorial, if you need more details.
You can recompile SFML, it should work.