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 - Beta_Ravener

Pages: 1 2 [3] 4
Graphics / sf::String::GetRect::GetWidth() returns wrong value?
« on: June 04, 2011, 11:17:45 pm »
I think that won't be the case because this code gives same result:
Code: [Select]
if(Event.Type == sf::Event::TextEntered){
std::string ch;
sf::String str;
if(unicodeToASCII(Event.Text.Unicode, ch[0])){
inputText += ch;
cursorScreenPos.x += str.GetRect().GetWidth();

I debuged to see cursor position and after pressing 'a', it's still 17 - value returned from single GetWidth call, and still too far from character.

Graphics / sf::String::GetRect::GetWidth() returns wrong value?
« on: June 04, 2011, 10:55:45 pm »
This is my input procedure:
Code: [Select]
if(Event.Type == sf::Event::TextEntered){
char *ch = new char[2];
sf::String s;
if(unicodeToASCII(Event.Text.Unicode, ch[0])){
                ch[1] = '\0';
inputText += ch;
cursorScreenPos.x += s.GetRect().GetWidth();

as you can see, I use width of single input character to move my cursor. Then I'm using this value while drawing cursor:

Code: [Select]
sf::Shape cursorLine;
float cursorWidth = 3.0f;
cursorLine = sf::Shape::Line(0, 0, 0, output.GetSize(), cursorWidth, textColor);
cursorLine.SetPosition( cursorScreenPos.x + cursorWidth/2 - scrollH.getCurScroll() ,cursorScreenPos.y - ScrollV.getCurScroll() );

Those scroll things aren't important, because while testing they are zero value. This is all code currently affecting cursor position.
For example 'a' returns width of 17, but when I move cursor there, it's almost double the distance it should be..

Graphics / sf::String::GetRect::GetWidth() returns wrong value?
« on: June 04, 2011, 10:09:21 pm »
As stated in function description, GetRect should return bounding box of text set to a string. When I use this value (more specificly it's width) as position to draw something immediately after text, this objects is drawn in good distance from text (almost another same text woudl fit into gap).

GetRect seems to work somewhat, because 'b' returns bigger value than 'i', but both returns something else than what I'd expect..

Maybe I'm not understanding "screen coordinates" term correctly, but those coordinates should be same as what goes into sf::Shape::SetPostition, shouldn't they?

Thanks for soon reply!

General / SFML won't run with updated ATI drivers
« on: March 15, 2011, 09:01:41 pm »
Ok thanks for info... couldn't get rid of those errors so rolling back my drivers to 10.10..

Edit: 1 more thing out of context.. could SFML collide with openGL somehow if I set preserve openGL states? I don't know implementation of it, but I got hard time with bugged samplers in shader program so I try to ask everywhere now..

General / SFML won't run with updated ATI drivers
« on: March 15, 2011, 07:30:44 pm »
Code: [Select]
1>glew32.lib(glew32.dll) : error LNK2005: _glewInit already defined in sfml-graphics-s.lib(glew.obj)
1>msvcrt.lib(MSVCR90.dll) : error LNK2005: _strtol already defined in LIBCMT.lib(strtol.obj)
1>msvcrt.lib(MSVCR90.dll) : error LNK2005: _strncmp already defined in LIBCMT.lib(strncmp.obj)
1>msvcrt.lib(MSVCR90.dll) : error LNK2005: _getenv already defined in LIBCMT.lib(getenv.obj)
1>msvcrt.lib(MSVCR90.dll) : error LNK2005: _memmove_s already defined in LIBCMT.lib(memmove_s.obj)
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "bool __cdecl std::operator==<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *)" (??$?8DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z) already defined in shader.obj
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::substr(unsigned int,unsigned int)const " (?substr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV12@II@Z) already defined in shader.obj
1>LIBCMT.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>C:\Users\Dark_Raven\Documents\Visual Studio 2008\Projects\OpenGl\gravity\Debug\gravity.exe : fatal error LNK1169: one or more multiply defined symbols found

I get more of them but it would be quite long post.. 49 to be precise and I included only glew32 and SFML...

General / SFML won't run with updated ATI drivers
« on: March 15, 2011, 07:25:06 pm »
Trying to link statically, nope static linking(I hope those are libs without -d or -s) links smooth but fails to open. Linking those -s libs gives me bunch of linker errors about things already defined..

General / SFML won't run with updated ATI drivers
« on: March 15, 2011, 06:14:27 pm »
I suppose there's no easy way of fixing, so is there at least last known version of ATI drivers working with SFML?

General / SFML won't run with updated ATI drivers
« on: March 15, 2011, 03:18:11 pm »
I've downloaded new drivers for my ATI radeon 3870 HD (11.2 version) and now I can't run any of my program wrote with SFML. It compiles and everything, but running it results just in command line, but the main window doesn't show up and everything stuck. Last loading call from debug is :
Code: [Select]
'gravity.exe': Loaded 'C:\Windows\System32\aticfx32.dll'
Debug doesn't even enter main() procedure so I think this isn't my fault.

Window / 0,0 in top left
« on: January 02, 2011, 11:01:43 pm »
Hmm after some research on net I found quite simple solution, using glScalef(1.0f, -1.0f, 1.0f); on your projection matrix in openGL... I know this forum is more SFML related, but as you are basically creating SFML on top of glew, can you tell me if there is any good reason i should get used to 0,0 in top left? or is it just convention for those window systems (I read something about direct acces to framebuffer, that's why it was quite time ago used to be that way, but if there's any good nowadays). And second I can't imagine, but you maybe came across some problems with that kind of inverting space in oGL? Thanks anyway for your time :)

Window / 0,0 in top left
« on: January 02, 2011, 05:54:19 pm »
If you meant that:


it's not working.. still openGL 0,0 being rendered up from 0,20.

I thought about it and only thing that came to my mind is to flip camera and render back of everything not front, but that's too overhelming and wouldn't ease anything I think

Window / 0,0 in top left
« on: January 02, 2011, 02:56:45 pm »
well it's strange looking write everywhere ScreenY - Y instead of Y...
aswell using function for flipping would be too much unncessary writing like flip(y).
Edit: I just realized that's not even possible I'm dealing with 3d not just 2d, and I don't know how will my coordinates map onto screen (well I know it but computing it would be just another rendering and then reading back), so I can't really flip anything in there..

and as for fliping output, I'm using App.Display() where App is sf::RenderWindow and I don't see method for fliping that, that's why I'm asking.

Window / 0,0 in top left
« on: January 02, 2011, 02:46:09 pm »
I know it was discused in feature request, but over 3 years ago... I was searching for bug in my pick ray function. It had problem with Y axis being flipped or something. Well after few hours I came down to core of my app where SFML is being used and I finnaly realized that no matter what I set in openGL I still get flipped image.

So was there impelemented some way to flip axis int openGL-like style(0,0 in bottom left and it's more like when you draw graph on paper) or is there any easy solution w/o rewriting whole code if I'm using only openGL calls to draw primitives?

Window / sf::Event problems
« on: October 23, 2010, 02:22:38 pm »
Oh I'm sorry I missed that one :/ Thanks for fast reply, but I have still question why is that space or other key even generated if nothing happens?

Window / sf::Event problems
« on: October 23, 2010, 01:45:30 pm »
I got strange problems with sf::Event. I'm creating 2 widnows, one for openGL drawings, second is some kind of settings for first one, so you can set parameters to that openGL.

I'm using this function to call updating of second window for main() function, which handles updating the primary one:

Code: [Select]
void Settings::update(){
const sf::Input& Input = Win.GetInput();
std::ostringstream oss;
// Process events
    sf::Event Event;
while (Win.GetEvent(Event)){
active = Input.GetMouseY() / cellHeight;
if ((Event.Key.Code==sf::Key::Return||Event.Key.Code==sf::Key::Right) && !input){
oss << active;
ID += oss.str();
if (Event.Key.Code==sf::Key::Space||Event.Key.Code==sf::Key::Left||
Event.MouseButton.Button == sf::Mouse::Right){
if(ID.size() > 0)
if (Event.Key.Code==sf::Key::Up){
if(active < 0)
active = cellsH-1;
if (Event.Key.Code==sf::Key::Down){
if(active >= cellsH)
active = 0;
if(Event.MouseButton.Button == sf::Mouse::Left && !input){
active = Event.MouseButton.Y / cellHeight;
oss << active;
ID += oss.str();

There's quite much of variables not defined in text because I am using class for second window, however the names should be intuitive. Cells are separated choices to choose in the menu which is specified by ID, and adding active to this ID you go into that choice or back from it.

What's wrong about that is, that when I simply move mouse over window for some time, setting just active(activated cell gets green so just some kind of indicator where are you pointing at), using Event.MouseMoved.
Pressing nothing, moving just mouse it suddenly generates Event.Key.Code=Space etc. jumping into other choices, and as you can see, invalidating my ID because I was just moving mouse, but ID down in menu.

I'll include window creation also:

Code: [Select]
void Settings::init(){

input = false;
ScreenX = 500;
ScreenY = 600;
sideMargin = 40;

Win.Create(sf::VideoMode(ScreenX, ScreenY, 32), "Settings",sf::Style::Titlebar);
Win.GetDefaultView().SetFromRect(sf::FloatRect(0, 0,(float)ScreenX, (float)ScreenY));

fontHeight = ScreenY/4;
std::string fontName = "ARIALN.TTF";
std::cout << "Couldn't load font " << fontName << std::endl;

ID += "0";
prepText = new std::wstring[10];


void Settings::resizeWindow(){
Win.GetDefaultView().SetFromRect(sf::FloatRect(0, 0,(float)ScreenX, (float)ScreenY));

glGetFloatv (GL_PROJECTION_MATRIX, proj.elements);

gluLookAt( 0, 0, 1, 0, 0, 0, 0, 1, 0);
glGetFloatv (GL_MODELVIEW_MATRIX, model.elements);

calling from main looks like this:
Code: [Select]

Settings uInf;
while (App.IsOpened())

If you need anything else like screenshot I'll add them, but I think it's just a mistake somewhere. However I searched for it for hours now and I am getting exahusted.

Window / Disabling Alt/control/shift
« on: July 26, 2010, 02:53:42 pm »
What about sf::RenderWindow.SetFocus() ? Looks like only problem is that you loose focus to that window and jumps to menu bar (which in SFML isnt but I observed drop down menu instead). This wouldn't disable system calls, and would allow user to treat alt also. If you would like to use this invisible menu, you just wouldn't call SetFocus after pressing alt right?

Edit: Can't figure how to take control from menu to screen. Other solution would be sf::RenderWindow.EnableSystemShortcuts() maybe, which would enable/disable catching of all keys. This would leave choosing whether or not use them on programmer. At this time you are forced to use them unless you modify code as above...

Pages: 1 2 [3] 4