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.


Topics - didito

Pages: [1]
1
Window / how to check for mutated vowels?
« on: November 06, 2009, 12:50:55 pm »
hi all,

i am prototyping a very simple text input application for my project
and since we are currently expecting german speaking users i need
to check for mutated vowels like ö, ä and ü. they are very important in our language and i can't use their alternatives (oe, ae or ue).

is there a way to detect them?
as event.Key.Code i always get a zero value when i press those keys on my mac...

using current revision of SFML 1.5x on macosx 10.5.8

thanks in advance
didi

2
Graphics / sf::Strings - copy ctor, copy assignment not working
« on: October 14, 2009, 04:52:21 pm »
hello,

i was wondering why some of my instanced sf::Strings were not working,
because i ran into some unexpected behavior.

*) what i want to do:
i want to copy a sf::string


*) this is what i was doing (should work IMHO, but does NOT)
Code: [Select]

sf::Font font;
//font gets loaded ... OK

sf::String label1;
label1.SetFont(font);
//rest of setup (color, style, size) and transformation ... OK


sf::String label2 = label1;  //assuming all attributes get copied - NOT WORKING!
//just setup unique attributes of label2 ...


sf::String label3(label1);  //assuming the same - NOT WORKING!
//setup unique attributes of label3 here ...



*) this is how i should do it in order to get it working
Code: [Select]

sf::Font font;
//font gets loaded ... OK

sf::String label1;
label1.SetFont(font);
//rest of setup (color, style, size) and transformation ... OK


//A - WORKS OK
sf::String label2;
label2.SetFont(font);
label2.SetSize(size);


//B - WORKS OK
sf::String label3("", font, size);


ok, i could use A and B, but wouldn't it be more natural to just copy it?
it seems like a problem with the copy ctor or copy assignment operator.
and i don't see a problem why this should not be working.
the font reference should be a shallow copy, the content a deep copy
and all the POD-like attributes can be copied easily anyway.

btw, as a kind of little request - what about a TextFormat class?
you can assign font, style, size, etc and assign it to different sf::Strings (which only hold the string content and a reference to this format).
this would save us a lot of typing and nice OO design :)

cheers, didi

3
General / MAC - EXC_BAD_ACCESS signal in sf::RenderTarget::Clear
« on: August 14, 2009, 09:21:17 pm »
hello,

i would like to use SFML in a project on my mac, because i liked the provided functionality and the clean C++ style.
i downloaded the full SDK v.15 but i can't get my simple example working (based on the c++ tool / cmdline SFML xcode template).

my system:
mac book pro, macosx v10.5.8
architecture: intel
gfx: nvidia 8600m gt
IDE: xcode 3.0

here is the code of my simple example:
Code: [Select]

#include <cstdio>
#include <string>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics.hpp>
//#include <SFML/System.hpp>
#include "config_sensorvis.hpp"


int main()
{
    //allocate resources
    std::string fontFilename("arial.ttf");
    sf::Font font;
    if (!font.LoadFromFile(fontFilename, 50))
    {
        printf("[ERROR] could NOT load font %s\n", fontFilename.c_str());
        //return EXIT_FAILURE;
    }
    else
    {
        font = sf::Font::GetDefaultFont();
    }

   
    //setup
    sf::WindowSettings settings;
    settings.DepthBits         = 24;
    settings.StencilBits       = 8;
    settings.AntialiasingLevel = 0;

    sf::RenderWindow app(sf::VideoMode(640, 480, 32), APP_TITLE /*, sf::Style::Close, settings*/);
   
    //app.UseVerticalSync(false);
    //app.SetFramerateLimit(60); // Limit to 60 frames per second
    //app.SetFramerateLimit(0);  // No limit
   
    app.PreserveOpenGLStates(true);

    app.SetPosition(0, 0);

    /*sf::View view;
    app.SetView(view);*/
   
    //timer
    sf::Clock clock;
   
    sf::Event event;

    const sf::Input& input = app.GetInput();

    //main loop
    while (app.IsOpened())
    {
        //timing update - get elapsed time since last loop
        float dt = clock.GetElapsedTime();
        clock.Reset();
        float framerate = 1.f / clock.GetElapsedTime();

        unsigned int mouseX = input.GetMouseX();
        unsigned int mouseY = input.GetMouseY();


        while (app.GetEvent(event))
        {
            //process all events from message queue ...

            if (event.Type == sf::Event::Closed)
            {
                app.Close();
            }
            else
            if (event.Type == sf::Event::KeyPressed)
            {
                if (event.Key.Code == sf::Key::Escape)
                {
                    app.Close();
                }
                else
                if (event.Key.Code == sf::Key::F1)
                {
                    sf::Image screen = app.Capture();
                    screen.SaveToFile("screenshot.jpg");
                }
            }
            else
            if (event.Type == sf::Event::Resized)
            {
               // glViewport(0, 0, event.Size.Width, event.Size.Height);
            }
            else
            {
                printf("[WARNING] uncatched event\n");
            }
        }


        //render
        app.SetActive();
        app.Clear(sf::Color(255, 0, 0));
               
        glClearColor(0.f, 0.f, 0.f, 0.f);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();

        glTranslatef(0.f, 0.f, -200.f);
        glColor3f(255.f, 0.f, 0.f);
        glBegin(GL_QUADS);

            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f(-50.f,  50.f, -50.f);
            glVertex3f( 50.f,  50.f, -50.f);
            glVertex3f( 50.f, -50.f, -50.f);

            glVertex3f(-50.f, -50.f, 50.f);
            glVertex3f(-50.f,  50.f, 50.f);
            glVertex3f( 50.f,  50.f, 50.f);
            glVertex3f( 50.f, -50.f, 50.f);

            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f(-50.f,  50.f, -50.f);
            glVertex3f(-50.f,  50.f,  50.f);
            glVertex3f(-50.f, -50.f,  50.f);

            glVertex3f(50.f, -50.f, -50.f);
            glVertex3f(50.f,  50.f, -50.f);
            glVertex3f(50.f,  50.f,  50.f);
            glVertex3f(50.f, -50.f,  50.f);

            glVertex3f(-50.f, -50.f,  50.f);
            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f( 50.f, -50.f, -50.f);
            glVertex3f( 50.f, -50.f,  50.f);

            glVertex3f(-50.f, 50.f,  50.f);
            glVertex3f(-50.f, 50.f, -50.f);
            glVertex3f( 50.f, 50.f, -50.f);
            glVertex3f( 50.f, 50.f,  50.f);

        glEnd();


        //render hud
        sf::String fps;
        fps.SetText("fps: ");
        fps.SetFont(font);
        fps.SetSize(50);

        fps.SetColor(sf::Color(128, 128, 0));
        //fps.SetRotation(90.f);
        //fps.SetScale(2.f, 2.f);
        fps.Move(100.f, 200.f);

        app.Draw(fps);

        app.Display();
    }
   
    app.Close();


    return EXIT_SUCCESS;
}




i launch the example and after a short while gdb receives a EXC_BAD_ACCESS signal from "sf::RenderTarget::Clear" and then i only see assembler code (why? i don't strip the symbols as far as i can see and the source comes with the full SDK) in the debugger. so i don't know what is wrong with it. when i comment the SetActive() Clear() or Draw(text) functions of the RenderWindow object it works, but of course i don't see anything then ... maybe there is a problem with the window settings (resolution, depth, ...)? does anybody have any idea?

thanks in advance,
didi

4
General / trying to build/use SFML2 on mac osx
« on: August 14, 2009, 08:17:13 pm »
hey all,

since i have troubles with the current stable v1.5 i checked out the current working copy (rev 1202) from the subversion repository.
and now i am trying to build SFML2 on my mac (v10.5.8, intel, nvidia 8600m gt, xcode 3.0) but i can't get any further.

i guess the SFML2 branch is mainly developed with windows and linux.
so has it been built on mac before? should i use make or xcode?
which xcode project do i have to build? SFML.xcodeproj or SFML-bare.xcodeproj? what is the difference?
anyway, none of them builds on my computer ...
why does SFML.xcodeproj have also a "Development" configuration? what is it for?


* error for SFML.xcodeproj:
Invalid value '4.2' for GCC_VERSION
obvious problem since on mac we are working with "powerpc-apple-darwin9-gcc-4.0.1", but why does it necessarily need v4.2 of GCC?


* errors for SFML-bare.xcodeproj:
several missing input files for GCC for some targets ...
i am trying to correct that now but so far no progress

---

i read in the SFML news that the mac maintainer is stopping, which is a pity.
does anybody else use SFML on the mac and can help here?

ah, btw, i guess if i manage to succeed with the building process i will have build those frameworks. can i use the SFML v1.5 and my custom built frameworks side by side?

thanks in advance
didi

Pages: [1]
anything