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

Author Topic: Font resources are not accessible?  (Read 9607 times)

0 Members and 1 Guest are viewing this topic.

lancel00t

  • Newbie
  • *
  • Posts: 18
    • ICQ Messenger - 449212638
    • AOL Instant Messenger - dripdropliner@ao
    • View Profile
    • http://www.watsontechgroup.com
Font resources are not accessible?
« on: September 03, 2007, 11:15:13 pm »
I am writing a small game application and I have programmed a second window to open as a thread. On the first run of this second window, user input from the keyboard will be processed and displayed on screen using the correct font. On the second run only small squares and rectangles appear when input is entered.

If you need more info let me know.

Edit: 9/4. Did I do something to displease the forum that I am not getting any help? or Have I discovered a bug and people are keeping mum? I would really appreciate any help.

lancel00t

  • Newbie
  • *
  • Posts: 18
    • ICQ Messenger - 449212638
    • AOL Instant Messenger - dripdropliner@ao
    • View Profile
    • http://www.watsontechgroup.com
pastebin
« Reply #1 on: September 05, 2007, 12:06:51 am »
Here are links to the souce of the program:
main.cc
http://pastebin.com/m53a6f09d
purchase.cc (thread)
http://pastebin.com/m6a4f8a20
purchase.h
http://pastebin.com/m133fdb46

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
Font resources are not accessible?
« Reply #2 on: September 05, 2007, 06:51:54 am »
Hi lancel00t,

It's not you are displeasing, but without your source, we are not really able to help you...

So, I see strange things in your source. First of all, you are not telling which font you are using in purchase.c :
Code: [Select]
sfString oneStr;
sfString twoStr;
sfString threeStr;
sfString fourStr;
...
oneStr.SetText("1");
oneStr.SetTop(10.f);
oneStr.SetLeft(50.f);
oneStr.SetColor(sfColor(0,0,0));


This seems to be an error I think.

The rest is just algorithming questions, so not very important... :)
Mindiell
----

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Font resources are not accessible?
« Reply #3 on: September 05, 2007, 09:06:36 am »
Hi

Quote
Did I do something to displease the forum that I am not getting any help?

Sorry I wasn't there during the last two days ;)

I think you won't be able to run a SFML window in another thread, because OpenGL doesn't allow this (all SFML OpenGL contexts are shared).

Quote
First of all, you are not telling which font you are using in purchase.c

This is not a problem, as SFML has a default built-in font.
Laurent Gomila - SFML developer

lancel00t

  • Newbie
  • *
  • Posts: 18
    • ICQ Messenger - 449212638
    • AOL Instant Messenger - dripdropliner@ao
    • View Profile
    • http://www.watsontechgroup.com
Back to the drawing board...
« Reply #4 on: September 05, 2007, 05:54:43 pm »
Thanks for your help everyone. As I was trying to debug the application I had a feeling that I was either encountering a bug or violating some basic principle of the API. You clarified it best Laurent; I did not know that all OpenGL contexts are shared. It's absolutely great that it wasnt a bug -- Makes me love SFML even more. I mean, with the release being just last month you would think the forum would be crawling with bug reports but that is not the case which is pretty excellent.

Anyways, is there an alternate way that anyone knows of that I could display a secondary window not using threads? I will work on this as well and let you know my results.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Font resources are not accessible?
« Reply #5 on: September 05, 2007, 06:08:34 pm »
Why would you need another thread to run another SFML window ? I mean, what problems are you facing ?
Laurent Gomila - SFML developer

lancel00t

  • Newbie
  • *
  • Posts: 18
    • ICQ Messenger - 449212638
    • AOL Instant Messenger - dripdropliner@ao
    • View Profile
    • http://www.watsontechgroup.com
Threads
« Reply #6 on: September 05, 2007, 08:53:30 pm »
In the beggining, I had a preconception that it would be neccessary to use threads in order to synchronize the opening and closing of my windows. However, in light of the new information you provided I found that my preconception was not feasible. Presently I am using the sfMutex and standard classes and functions to organize and call my windows. I am not really facing any problems at the current time mostly thanks to the information you provided regarding OpenGL and threads. I really appreciate that bit of info.

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
Font resources are not accessible?
« Reply #7 on: September 05, 2007, 10:45:32 pm »
Why don't you just open a virtual window into the main window ?
Mindiell
----