Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

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.


Messages - wasabi

Pages: [1] 2
1
General / Qt / SFML interface
« on: December 22, 2010, 05:11:28 pm »
Aaaaaand I'm back with the same problem.

I haven't had to deal with this potential issue for a long time because I realized I didn't need to display the information I wanted on the Canvas itself. However, now I do.

And so I simply added a sf::String to the class
Code: [Select]
struct Fault
{
float maxPPI;
FProperty prop;
std::vector<Segment> segments;
sf::String name;
Fault();
void DefaultColor();
void ViewRatio(float min,float mid,float max);
};


However, if I try to compile the files now, it gives the same error as before:
Code: [Select]
Fault.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Unicode::Text::Text(char const *)" (??0Text@Unicode@sf@@QAE@PBD@Z) referenced in function "public: __thiscall Fault::Fault(void)" (??0Fault@@QAE@XZ)

Thinking that perhaps I've been using the wrong .conf file all along, I checked, but nope, that QMAKE_CFLAGS line is correct:
Code: [Select]
QMAKE_CFLAGS            = -nologo -Zm200

Any other possible reason for this?

EDIT: Well, actually, it's not the same error, but...

2
General / sf::Unicode::Text::Text problem with Qt?
« on: September 10, 2010, 07:14:51 pm »
After a good time away from it, I'm back on my Qt / SFML program and have progressed far faster than I'd imagined, but now I have a problem with sf::String::SetText().

Code: [Select]
class MyCanvas : public QSFMLCanvas
{
Q_OBJECT
public :
MyCanvas(QWidget* Parent, const QPoint& Position, const QSize& Size);
MyCanvas();
public slots:
void OpenFile(QString str);
private :
        QFile pl;
        QTextStream _pl;
sf::View CurrentView;
sf::View GlobalView;
Point MouseCoords;
std::vector<Line> faults;  
std::vector<Line> horizons;
std::vector<Point> points;  
void ChangeView_Key();
void ChangeView_Pan(QMouseEvent* e);
void DesignFault();
void DesignLine(Point pt1, Point pt2);
    Line* NewLine();
void OnInit();
    void OnUpdate();
void SaveFaultPoints(int elevation,int n);
void SaveFaultSegments();
protected:
void keyPressEvent(QKeyEvent* e);
void mouseMoveEvent(QMouseEvent* e);
void mousePressEvent(QMouseEvent* e);
void wheelEvent(QWheelEvent* e);
};

void MyCanvas::OnUpdate()
{
    std::string coords("(");
    sf::String Coords;
    char coord[16];
    //Clear();
    sprintf_s(coord,16,"%.0f",MouseCoords.coord.x);
    coords+= coord;
    coords+= ",";
    sprintf_s(coord,16,"%.0f",MouseCoords.coord.y);
    coords+= coord;
    coords+= ")";
    Coords.SetFont(sf::Font::GetDefaultFont());
    Coords.SetSize(30.f);
    Coords.SetText(coords);
    Clear();
    for(std::vector<Line>::iterator it=faults.begin();it<faults.end();it++)
        Draw(it->shape);
    for(std::vector<Point>::iterator it=points.begin();it<points.end();it++)
        Draw(it->shape);
    for(std::vector<Line>::iterator it=horizons.begin();it<horizons.end();it++)
        Draw(it->shape);
    SetView(GetDefaultView());
    SetView(CurrentView);
    Display();
}


Should I try to compile it, however, I get the following error:
Code: [Select]
1>MyCanvas.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Unicode::Text::Text(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Text@Unicode@sf@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "private: virtual void __thiscall MyCanvas::OnUpdate(void)" (?OnUpdate@MyCanvas@@EAEXXZ)
1>debug\QT.exe : fatal error LNK1120: 1 unresolved externals


However, if I comment out the .SetText() command, it compiles correctly.

3
General / Qt / SFML interface
« on: August 10, 2010, 05:09:27 pm »
Okay, I was going to change the .conf file, but for me, it's
Code: [Select]
QMAKE_CFLAGS            = -nologo -Zm200 -Zc:wchar_t-

Should I make that Zc:wchar_t- or Zc:whar_t ?

As well, should I alter the .conf file manually (notepad, basically) or is there an advantage to using
Code: [Select]
qmake -set
Because I used
Code: [Select]
qmake -query -Zc:wchar_t and it went sorta-kinda crazy.

Code: [Select]
C:\Qt\4.6.3\qmake>qmake -query Zc:wchar_t
**Unknown**

C:\Qt\4.6.3\qmake>qmake -query -Zc:wchar_t
QT_INSTALL_PREFIX:C:\iwmake\build_vs2008_opensource_________________PADDING_____
____________
QT_INSTALL_DATA:C:\iwmake\build_vs2008_opensource_________________PADDING_______
__________
QT_INSTALL_DOCS:C:\iwmake\build_vs2008_opensource_________________PADDING_______
__________\doc
QT_INSTALL_HEADERS:C:\iwmake\build_vs2008_opensource_________________PADDING____
_____________\include
QT_INSTALL_LIBS:C:\iwmake\build_vs2008_opensource_________________PADDING_______
__________\lib
QT_INSTALL_BINS:C:\iwmake\build_vs2008_opensource_________________PADDING_______
__________\bin
QT_INSTALL_PLUGINS:C:\iwmake\build_vs2008_opensource_________________PADDING____
_____________\plugins
QT_INSTALL_TRANSLATIONS:C:\iwmake\build_vs2008_opensource_________________PADDIN
G_________________\translations
QT_INSTALL_CONFIGURATION:C:/iwmake/build_vs2008_opensource_________________PADDI
NG_________________
QT_INSTALL_EXAMPLES:C:\iwmake\build_vs2008_opensource_________________PADDING___
______________\examples
QT_INSTALL_DEMOS:C:\iwmake\build_vs2008_opensource_________________PADDING______
___________\demos
QMAKE_MKSPECS:C:\iwmake\build_vs2008_opensource_________________PADDING_________
________\mkspecs
QMAKE_VERSION:2.01a
QT_VERSION:4.6.3


It goes without saying that I'm not very good at command prompts. They scare me.

4
General / Qt / SFML interface
« on: August 10, 2010, 01:23:36 am »
The integration (add-in) isn't Express-compatible, unfortunately.

And I've had a whole bunch of problems with re-compiling Qt... though I just realized I might have solved those problems when I solved another problem I had with Qt a few days ago, since the error given was the same...

I'll try the recompile, then, and give my feedback here.

5
General / Qt / SFML interface
« on: August 09, 2010, 04:20:23 pm »
......................................

What's the intended means of integrating SFML and Qt, then? Because I'm quite clearly doing something wrong here.

6
General / Qt / SFML interface
« on: August 09, 2010, 04:09:03 pm »
Thanks, that works. Now it accepts SFML. I had "qmake -project" for both Build and Rebuild routines.

Twice, it would seem. :p

Code: [Select]
1>c:\Documents and Settings\pnacht\My Documents\My Dropbox\Libraries\SFML-1.6\include\SFML/System/Unicode.hpp(82) : error C2535: 'sf::Unicode::Text::Text(const wchar_t *)' : member function already defined or declared
1>        c:\Documents and Settings\pnacht\My Documents\My Dropbox\Libraries\SFML-1.6\include\SFML/System/Unicode.hpp(80) : see declaration of 'sf::Unicode::Text::Text'


I get that for ::Text(const wchar_t), ::Text(const std::wstring &) and ::Text::operator std::wstring

and the only SFML #include I have is SFML/Graphics.hpp

7
General / Qt / SFML interface
« on: August 09, 2010, 03:51:40 pm »
Thanks, but... VC doesn't let me. Or, well, it does, but then it just erases my work.

If I open and edit the .pro to
Code: [Select]
######################################################################
# Automatically generated by qmake (2.01a) seg 9. ago 10:49:04 2010
######################################################################

TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += "C:\Documents and Settings\pnacht\My Documents\My Dropbox\Libraries\SFML-1.6\include".

# Input
HEADERS += QT.h
SOURCES += QT.cpp


and try to build (be it by Build or Rebuild), it edits the .pro and changes it to
Code: [Select]
INCLUDEPATH += .

EDIT: Indeed, VC actually rebuilds the .pro every time I rebuild the project, as indicated by changes on the time stamp.

8
General / Qt / SFML interface
« on: August 09, 2010, 03:29:26 pm »
I have... both, actually. Which makes the question of which one am I using a tricky one.

I compile through the IDE, but using qmake and nmake.

In the properties window, I've set it up so that the build protocol calls the following code
Code: [Select]
qmake -project && qmake && nmake debug-all

But that's not the problem, I don't think. Qt is working just fine. The problem is only that SFML isn't being included.

9
General / Qt / SFML interface
« on: August 09, 2010, 03:08:34 pm »
This sounds like a really, really stupid issue (probably because it is), but I for some reason can't include SFML files into my Qt program (I'm having to bind the SFML program I've built with Qt for its added modular windows [open file, etc] functionality).

For instance, if I write
Code: [Select]
#include <SFML/Graphics.hpp>
I get the build error "Cannot open include file: 'SFML/Graphics.hpp': No such file or directory"

I'm using VC++ 2008 Express and making everything as a makefile, since Qt misbehaves if you do it any other way. However, in the solution properties window, I have "Include search path: [my SFML file path]", just as I have my Qt file path. As well, I find this particularly annoying since it clearly can open the .hpp since VC's Intellisense is working just fine. I type sf:: and it shows me all the possible choices I have. But then I try to build and it goes "wait, what? what file is that?!"

I feel like a shmuck, but why doesn't this work?

10
Graphics / shape.GetPointPosition error
« on: July 30, 2010, 10:14:27 pm »
Ah, that explains it, then.

11
Graphics / shape.GetPointPosition error
« on: July 30, 2010, 08:28:57 pm »
I just tried .Scale() and it seems to work quite well, but there's a curious error. The scale-factor clearly isn't based in the center of the object, since one side is clearly growing much more than the other.

Do you need to .SetCenter() first? Because I tried that and it came out a bit crazy.

Code: [Select]
shape.SetCenter(shape.TransformToLocal(sf::Vector2f(CurrentView.GetCenter().x,950))); shape.Scale(CurrentView.GetHalfSize().x/oldview.GetHalfSize().x,1);

That gets the center of the screen at 950 in depth (the depth of the line), transforms that coordinate into local shape coordinates and sets that as its center, right? And then I get the ratio between the oldview and the newview and scale accordingly, right?

That seems to work reasonably, except for the fact that TransformToLocal doesn't do that. I check the step-by-step and the Local and Global coordinates are exactly the same. That makes sense in regards to the x-value, since I always want the line to start at the window's edge, but the y-value should be 0 (or close, since there's thickness).

Due to this error, zooming out causes the line to move vertically as well as scale horizontally (which I just noticed makes no sense). As well, the line moves up, not down. Does this mean the local coordinate system is y-positive (while the global is clearly y-negative, i.e. y-values increase the lower you go)?

Without .SetCenter(), the scaling works almost fine. The line is extended, it remains at its position, but the scaling is uneven. One side is extended beyond the screen while the other end can be seen. If you pan to the side, the new length fits perfectly, but... well, you shouldn't have to pan.  :?

EDIT: Just saw your reply and simply replaced the old line with a new version of it and that works fine. Not to mention it's way simpler. Thanks for staying with me all day today. :p

EDIT2: And a Line most certainly has 5 points.

This code:
Code: [Select]
shape = sf::Shape::Line(CurrentView.GetCenter().x-CurrentView.GetHalfSize().x,950,CurrentView.GetCenter().x+CurrentView.GetHalfSize().x,950,0.003f,sf::Color(0,128,128),t,sf::Color(0,128,128));
If done with the step-by-step, gives the following points:
  • position (378... , 950.0)
  • [1] position (-848... , 949...)
    [2] position (1606... , 949...)
    [3] position (1606... , 950...)
    [4] position (-848... , 950...)

    Obviously, the values themselves are irrelevant other than to show that they're not even repeated.

12
Window / HUD interface
« on: July 30, 2010, 07:50:03 pm »
I knew I'd seen that in a tutorial somewhere! I'd looked for it for ages!

And I just understood, this very moment, how .SetView works. I thought that, by using .SetView, you were automatically modifying the display of all shapes, when really, you're only altering the shapes you alter in a given .SetView.

I can see clearly now, the rain is gone.

Well, not really, because it was never raining and I haven't implemented it yet, but I think I got it now.

EDIT: I absolutely hate how easy that was to implement...

13
Graphics / shape.GetPointPosition error
« on: July 30, 2010, 07:42:25 pm »
I've also noticed that sf::Shape::Line is actually composed of 5 points (at least for lines of length ~2000), not only 2 as one'd expect. However, these other points are all in the middle of the line, so I don't know how I should deal with them.

In fact, I just checked and noticed that the extremities of the line are actually on vertices 1 and 3 (not 0 and 1 as I'd expected). However, this seems to create an issue in regards to reliability. Is this always the case, given the ::Line generation algorithm? Or might the extreme vertices be in any location in the array?

EDIT: You beat me to it. Though it's actually five points, for whichever reason.

And I tried messing with Scale, but it made the other shapes go crazy, for whichever reason. Actually, quick question, what's the difference between Scale and SetScale? I can't seem to figure it out.

EDIT2: And I forgot to ask about recreation. Can you simply do that?

shape = sf::Shape::Line(...1);
shape = sf::Shape::Line(...2);

Some libraries don't much like that. And I don't know if there are any hidden dynamic allocations I should worry about.

14
Window / HUD interface
« on: July 30, 2010, 07:05:25 pm »
I don't think I get your meaning.

Another window?

Or, how can I have two views appearing in one window?

15
Graphics / shape.GetPointPosition error
« on: July 30, 2010, 07:03:16 pm »
Lo and behold, another zoom issue coming from me.

I'm trying to create an "infinite line," one that stretches out no matter how far you zoom. I thought the easy way of doing that would be:

Code: [Select]

CurrentView.Zoom(0.9f);
shape.SetPointPosition(1,sf::Vector2f(CurrentView.GetCenter().x-CurrentView.GetHalfSize().x,950);
shape.SetPointPosition(2,sf::Vector2f(CurrentView.GetCenter().x+CurrentView.GetHalfSize().x,950);


This way, the horizontal line, which was created originally with CurrentView.GetRect().Left and CurrentView.GetRect().Right for it's coordinates' x-values, would be resized at every zoom. I didn't use .Left and .Right this time because myRect is only updated with an App.Draw(), not with .Clear(), .Display() or .SetView(), and I have nothing to draw before these corrections. Plus, I checked the math and .GetCenter() - .GetHalfSize() is equivalent to .GetRect() after the update.

However, while the line works fine when originally generated using .Left and .Right, the resize doesn't. The line is drastically reduced in length if zooming out and vanishes if zooming in. It still appears just fine if I pan without zooming, though, so it's not a problem involving my use of App.Draw().

Pages: [1] 2
anything