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
16
General / Re: Closing window causes access violation
« on: October 21, 2011, 02:02:32 pm »
Quote from: "sbroadfoot90"
care to show your code?


Sure.. in fact while trying to get together some code to post here, I've found exact place where this happens. It happens when I call single function in my first program with 2 windows (the second one is out because it had the very same error but it was because of one vector).

This is the code for rendering second window, which is something like child to first, because it closes when the first one closes.
Code: [Select]
void SettingsUI::Render(){
window.SetActive();
window.Clear(sf::Color(0,0,0));
sf::Text text;
text.SetCharacterSize(20);
text.SetColor(sf::Color(30, 255, 30));
unsigned int i;
for(i = 0; i < menuSize; i++){
text.SetString(menuText[i]);
text.SetPosition(10.f, i*25.f+10.f);
window.Draw(text);
}
text.SetString("Input: " + input);
text.SetPosition(10.f, i*25.f+30.f);
window.Draw(text);

window.Display();
window.SetActive(false);
}


If I won't call this from my main function, the program ends without error. Playing with those commands I found that the only line causing trouble is:
Code: [Select]
window.Draw(text); If you comment both of them away, text is not displayed but no error occurs on closing.

It may help to say that I initialize window this way:
Code: [Select]
window.Create(sf::VideoMode(500, 300, 32), "Settings", sf::Style::Titlebar);
and close like this:
Code: [Select]
void SettingsUI::Close(){
window.Close();
menuText.clear();
waveEngine = 0;
}


Also note that
Code: [Select]
std::vector<sf::String> menuText;
sf::String input;

17
General / Closing window causes access violation
« on: October 20, 2011, 11:25:24 pm »
Ok I got something.. though I still can't jump to sfml source to track it down, I just noticed that upon exit in debug mode I got this line in console: "An internal OpenGL call failed in Image.cpp (90) : GL_INVALID_OPERATION, the specified operation is not allowed in the current state".

Also in debug mode, visual studio can look into disassmbly and tell me some info. Well when my main function returns, it's Main thread[5092] and stack frame is Waves.exe!_tmainCRTStartup(and some more info), but it stays here for about 6 steps. Then it executes: "0141A10F  call        dword ptr [__imp__exit (1430B04h)] ". It gets through msvcr90d.dll, kernel32.dll, ntdll.dll, and maybe others.. it's probably cleaning this debug info. But what's interesting, it finally gets to that line causing troubles: "69092994  mov         edi,dword ptr [eax+8] " in Main Thread[5092] and stack frame is "atioglxx.dll!69092994()" .

Hope this helps somehow

18
General / Closing window causes access violation
« on: October 20, 2011, 07:58:35 pm »
My 2 programs using SFML 2.0 have both some strange glitch, that doesn't affect them but it's annoying. I'm creating sf::Window and sf::Render window in first and sf::Window in second and both programs are using also console window from sfml-main. When those windows appers on screen they behave correct and everything, but closing them through X in right up corner cause the created windows disappear (I think they close correctly), but that console window stays stuck for 3-4 seconds and then it crash. Note that when I close window my programs end(because of loop that uses sf::Window::IsOpened()). I get access violation, but it's not in my code and gets thrown after my main() function returns and formally ends program. The strange thing is, that when program is closed by clicking X in corner of console window everything closes correctly and no error appears.

I'm still not sure if it's bug in my code or SFML, because I was unable to jump from my code to SFML files. It can be still that I forgot to do something with resource inside my code, but I checked it few times and made destructors for almost every class cleaning those resources before program ends. Didn't help though, so I deleted those destructors for not to make more mess than there already is.

And sorry if there's topic like this, I couldn't find anything helpful (other than some topic about SFML using globals bacause of some ATI driver bug.. so maybe it'd help to say that I'm using ATI).

19
Graphics / Getting height of space under base in font
« on: September 19, 2011, 04:18:50 pm »
Well man you're magician. Works like charm even with those strange handwritten fonts :D Things and people like this makes the life so easy  :wink:

20
Graphics / Getting height of space under base in font
« on: September 19, 2011, 03:59:18 pm »
I was searching in source for sfml and I tracked using character size to point where it is passed for requesting font page. Well I don't know much about fonts and size pages, but will your solution work for different fonts also? for example if the last "a" would be Verdana(and not the Arial), would I get it aligned or not? I find it little strange that aligning would depend solely on character size because then all the fonts would be guaranteed to have bottom of for example "a" at the very same pixel. If I'm wrong please correct me.

21
Graphics / Getting height of space under base in font
« on: September 19, 2011, 03:18:38 pm »
Haikarainen got it right. In fact I'm building UI specialy for SFML where no conversions are needed, it works with native SFML classes and is also class oriented. This post is related to my rich edit, and I was already thinking about rebuilding whole rendering procedure but first I'd like to ask here so I don't have to rebuild quite a lot of code. For Laurent I'm including image of what happens when I introduce character size tag to my string.



That cursor there just didn't get updated that's why it's so small, but you can see there what I mean by word "step". The character size of 70 have that under base height almost as big as is the character size of 20 full height. I'd like the bottoms of those "aaaaaa" on the one same line, but I fail to find that information about under base (base is that line on which "a" sits) height anywhere. It can be possible that sfml don't even track that info because it's quite useless other than my case, but there must be way to retrieve it from font.

22
Graphics / Getting height of space under base in font
« on: September 19, 2011, 12:17:21 am »
I'm building my own render procedure for text rendering. I'm still using sf::Text, sf::Font etc., what I do is creating tags on various position that specify for example color, font or character size. While rendering I cut the string on rows and rows on uniform blocks - characters that have position inside uniform block share the same set of tags so I can set those to sf::Text and render them easily, then move my render position and repeat. However I encountered a little problem. I work with sf::Font::GetLineSpacing for determining row height and as there can be various sizes inside one row, I get maximum height and set that as main one and when rendering smaller than this one, I decrement the value so it sits on the same line. However this isn't really true because when I enlarge character size I get height steps. This is because I don't really set characters like "aAbB" on same line but those like ",,||". It can be understood after realizing what sf::Font::GetLineSpacing returns. My problem is now determining that piece of space is under the "alphabetical row" - the line on which characters lie. I tried this by retrieving Glyph and working whit Bound, but those value seems to be different from what i expected, because they don't grow with character size as fast as I'd expect and those steps can be still seen. Thanks for help

23
Graphics / Text::SetString() raises exception
« on: August 07, 2011, 12:47:06 am »
Yes you're right, the classes doesn't really matter..
I started a new project and there SetString worked correctly so it's not SFML problem directly, but as I said everything works until I use that function in old project. I think it must be some weird mix of project settings that causes it. I'll try to play whit it for a while and post if find what causing it, but most probably I'll move files into new project.
Anyway, thanks for your time and help.

Edit: I compared both new and old project settings and setting this fixed it:

Configuration Properties -> C/C++ -> General -> Debug information format - set to: program database for Edit and Continue

Configuration Properties -> C/C++ -> Code Generation -> Runtime Library - set to: Multi-threaded debug DLL (/MDd) [previously was /MTd]

24
Graphics / Text::SetString() raises exception
« on: August 06, 2011, 03:00:36 pm »
This is something similar to what I do in my code:

Code: [Select]
class T{
public:
void SetString(const sf::String &string) {myText.SetString(string);}
private:
sf::Text myText;
};

class A : public T{
public:
void SetValue(const int &value) {myValue = value;}
private:
int myValue;
};

int main(){
A object;
//object.SetString("hello"); uncomment to get error
return 0;
}


This matches my code structure and reproduces the problem.

25
Graphics / Text::SetString() raises exception
« on: August 06, 2011, 01:11:59 pm »
Hello there. I recently ran into problem I can't solve. Anywhere I call Text::SetString() my program raises an exception. MSVC points me to strlen.asm file at line with arrow
Code: [Select]
  str_misaligned:
   ; simple byte loop until string is aligned
-> mov     al,byte ptr [ecx]


and give me "0xC0000005: Access violation reading location". That error should be pointer related, but I don't work with pointers anywhere arround where this error appears. It's quite strange because MSVC doesn't even enter debug mode(checkpoint at first line of main), it's enough to see that I call SetString somewhere.. I haven't met with such thing before so I'd be glad for some help. I'm using recent SFML 2.0 build.

26
General / Compiling SFML 2.0 error
« on: July 25, 2011, 01:53:16 pm »
First I've run vcvars32.bat from windows explorer and started cmake through shortcut. It gave me these errors. Then I've tried eveything through VC2008 command prompt, first ran vcvars32.bat and then navigated to cmake folder and run it with cmake-gui. Same errors so lastly after your reply I've added VS2008 to PATH variable (on Win7 it can be found as described here: http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx. I just added semicolon and full path to my VC directory. Ran everything again but the error persists.

Edit: Strange, but I've tried setting cmake to work with VC2005, then with VC10 (both errors ofcourse because of version mismatch), and then again with setting VC2008 and it was configured properly. Maybe a bug that shown just on my PC :?:

27
General / Compiling SFML 2.0 error
« on: July 25, 2011, 12:51:55 pm »
I've run "your_visual_studio_folder\VC\bin\vcvars32.bat", however it seems it didn't added VS to the PATH, so I updated it with this line "C:\Program Files\Microsoft Visual Studio 9.0". However that doesn't get me rid of warning, but I think cmake would anyway ignore this, the real problem is with freetype. I had other errors also before but I've noticed that while running Comodo (security program), cmake fails to compile simple code, but after disabling it, I have just this freetype error.

And for those textures, I'd be glad if you could tell me if those are going to be added to Shape class so when time comes I can just specify a texture and other things, or is it planned other way?

28
General / Compiling SFML 2.0 error
« on: July 25, 2011, 12:31:58 pm »
I was trying to get SFML 2.0, read in this forum it should allow textures for shapes (is that so?).

Anyway I downloaded cmake to get VS project from that bunch of files, but I get "CMake Warning at cmake/Config.cmake:45 (message): Unsupported compiler" - strange because I have my VS2008 working, but what's worse I get:
Code: [Select]
CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
  Could NOT find Freetype (missing: FREETYPE_LIBRARY)
Call Stack (most recent call first):
  C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindFreetype.cmake:92 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  src/SFML/Graphics/CMakeLists.txt:62 (find_package)


Yes I've read the tutorial on how to build with cmake and there was told that windows shouldn't need anything installed before running cmake, and yes even though I've tried to install freetype 2.3.5 (through binary setup) and it didn't resolved problem. Running on Win7 just in case it matters. Thanks in advance.

29
Graphics / sf::String::GetRect::GetWidth() returns wrong value?
« on: June 05, 2011, 11:06:57 am »
sorry for false alarm, I hope you didn't lost time looking for bug.

I, of course, couldn't reproduce this behavior. The code I created to test was workign alright so I searched in my full code and found out that I haven't set anywhere size of string I used to measure. Thus I had to multiply value given by this measure string whit a factor mentioned above to get right results, but copying output string into measure string like : ms = os; and then setting the text yields right values.

Sorry once more for bothering you.

30
Graphics / sf::String::GetRect::GetWidth() returns wrong value?
« on: June 05, 2011, 12:42:00 am »
I tried setting text to "aa" and using GetCharacterPos(1) meausre 'a' size, but it also returns 17. But I've searched a bit in tutorials and found out that: "In case you need to deal with a string's characters individually, like for displaying a cursor after the n-th character of whatever, sf::String provides a utility function to get the position of any character in the string.

sf::Vector2f Position = Text.GetCharacterPos(4);

The returned position is defined in local coordinates, so you'll need to call TransformToGlobal to get the actual global position. "

So I tried to add:
cursorScreenPos = str.TransformToGlobal(cursorScreenPos);

but nothing happend to coordinates.

Then I tried to divide width by 2 (because as I said, the gap was wide like the string) and what I get is cursor right after last letter! But than I tried to make larger letters with sf::String::SetSize and it doesn't fit anymore again. It looks like this change in size isn't calculated in nor while requesting size of bounding box nor while TransformToGlobal!

After some testing I came to conclusion that one have to calculate factor after changing size like: f = newSize/30.0f; (where 30.0f is deafualt font size) and then multiply bounding box by this factor. As I had my font set to size 15.0f, dividing by 2 resulted in right values. I couldn't find any function to apply this scale or something into font, so I think it's a small bug or needed feature.

Pages: 1 [2] 3 4