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

Pages: 1 ... 8 9 [10]
136
Graphics / How do I undraw text
« on: September 13, 2008, 01:39:55 pm »
i have game loop and after that i draw my objects
Code: [Select]

loop
{
...
}
App.Draw(any object);



now it can be that some object does not exist anymore, or i just want it not to be shown

how can i realize that?

137
Graphics / Problem with drawing text
« on: September 13, 2008, 12:19:20 am »
Hi i draw a text on screen just like explained in tutorial, everthing works fine, but after quitting Windows vista says:

Problemsignatur:
  Problemereignisname:   APPCRASH
  Anwendungsname:   Pong_1.exe
  Anwendungsversion:   0.0.0.0
  Anwendungszeitstempel:   48caea16
  Fehlermodulname:   atioglxx.dll
  Fehlermodulversion:   6.14.10.6570
  Fehlermodulzeitstempel:   463be2e0
  Ausnahmecode:   c0000005
  Ausnahmeoffset:   0036898a
  Betriebsystemversion:   6.0.6000.2.0.0.768.3
  Gebietsschema-ID:   1031
  Zusatzinformation 1:   8d13
  Zusatzinformation 2:   cdca9b1d21d12b77d84f02df48e34311
  Zusatzinformation 3:   8d13
  Zusatzinformation 4:   cdca9b1d21d12b77d84f02df48e34311

an error occurs, why?

138
General / Another annoying beginner´s question
« on: September 12, 2008, 10:43:47 pm »
im a total beginner to make it easier for you, here my code:

Code: [Select]

#include <SFML/Graphics.hpp>
#include <iostream>

using namespace sf;

////////////////////////////////////////////////////////////
/// Entry point of application
////////////////////////////////////////////////////////////

int main()
{

// Create main window
    RenderWindow App;
    App.Create(sf::VideoMode(800, 600, 32), "SFML Window", sf::Style::Fullscreen);
// Cursor is not being shown
    ShowCursor(0);
// Build a custom convex shape
    Shape Polygon;
    {
     Polygon.AddPoint(0, 0,  sf::Color(255, 0, 0),     sf::Color(0, 128, 128));
     Polygon.AddPoint(50, 0,   sf::Color(255, 85, 85),   sf::Color(0, 128, 128));
     Polygon.AddPoint(50, 50,  sf::Color(255, 170, 170), sf::Color(0, 128, 128));
     Polygon.AddPoint(0, 50,  sf::Color(255, 170, 170), sf::Color(0, 128, 128));

     Polygon.SetOutlineWidth(0);

     Polygon.EnableFill(true);
     Polygon.EnableOutline(true);

     Polygon.SetColor(Color(255, 255, 255, 255));
     Polygon.Scale(3, 1);
     Polygon.SetPosition(400,550);
    }

    Shape Ball;
    {
     Ball.AddPoint(0,0, sf::Color(255,255,255),sf::Color(255,255,255));
     Ball.AddPoint(10,0,  sf::Color(255,255,255),sf::Color(255,255,255));
     Ball.AddPoint(10,10, sf::Color(255,255,255),sf::Color(255,255,255));
     Ball.AddPoint(0,10,  sf::Color(255,255,255),sf::Color(255,255,255));
    }

    int movex = 50;
    int movey = 50;
    Vector2<float> ballvec;
    Vector2<float> shapevec;
    Clock Spieluhr;
    Clock Uhr;

    String Text;
    Text.SetFont(sf::Font::GetDefaultFont());
    Text.SetSize(20);



while (App.IsOpened())
{
    // Process events
    Event Event;
    while (App.GetEvent(Event))
    {
        // Close window : exit
        if (Event.Type == Event.Closed)
            App.Close();

        // keybord-events
        if ((Event.Type == Event.KeyPressed) && (Event.Key.Code == Key::Escape))
        {
            App.Close();
        }
        if ((Event.Type == Event.KeyPressed) && (Event.Key.Code == Key::Num1))
        {
            Polygon.Rotate(15);
        }

        // mouse-events
        if (Event.Type == Event.MouseMoved)
        {
                Polygon.SetPosition(Event.MouseMove.X,550);
        }

    }

    // Manage Ball
    ballvec = Ball.GetPosition();
    shapevec = Polygon.GetPosition();
    if((ballvec.y + movey *App.GetFrameTime() >= 540) && (ballvec.x >= shapevec.x) && (ballvec.x <= shapevec.x +150) )
    {
        movey = -movey;
    }
    if(ballvec.y +movey *App.GetFrameTime() <= 0)
    {
        movey = -movey;
    }
    if(ballvec.x + movex *App.GetFrameTime() >= 790)
    {
        movex = -movex;
    }
    if(ballvec.x + movex *App.GetFrameTime() <= 0)
    {
        movex = -movex;
    }
    if(Uhr.GetElapsedTime() > 5.0)
    {
        if (movex > 0)
        {
            movex = movex + 50;
        }
        if (movex < 0)
        {
            movex = movex - 50;
        }
        if (movey > 0)
        {
            movey = movey + 50;
        }
        if (movey < 0)
        {
            movey = movey - 50;
        }
        Uhr.Reset();
    }
    Text.SetText("hallo");
    Ball.Move(movex * App.GetFrameTime(), movey * App.GetFrameTime());

    // Draw it
    App.Draw(Text);
    App.Draw(Ball);
    App.Draw(Polygon);

    // Finally, display the rendered frame on screen
    App.Display();
}

    return EXIT_SUCCESS;
}


its not perfect yet but i think its playable now;

can anyone tell me how to convert a float into String?

139
General / Another annoying beginner´s question
« on: September 12, 2008, 09:39:12 pm »
hi i decided to program a little pong clone,

now i want the ball to move, this works:

Code: [Select]
Ball.Move(50 * App.GetFrameTime(), 50 *App.GetFrameTime());

(it doesnt matter in what direction the ball moves yet , just an example)

the problem is that the ball flickers, it doesnt look good
what can i do to stop that
is doublebuffering a solution and if how does it work?

thank u guys, I LOVE SFML

140
Graphics / Beginners Quest
« on: September 09, 2008, 02:49:39 pm »
and another problem: now i want the polygon to move when the mouse is moved is , what is wrong with this:

        if (Event.Type == Event.MouseMoved)
        {
            Polygon.Move( Event.MouseMove.X,Event.MouseMove.Y);
        }

141
Graphics / Beginners Quest
« on: September 09, 2008, 02:40:03 pm »
what i dont understand yet, is why the polygon is drawn...

while (App.IsOpened())
{

    Event Event;
    while (App.GetEvent(Event))
    {

    }
    App.Draw(Polygon);
    App.Display();
}

i enter first while, thats ok as long as my program is opened - check for events .. then react on events...

is there some time when no events come in? otherwise the 2nd while loop could never be left, or is there any logical mistake in my head?

142
Graphics / Beginners Quest
« on: September 09, 2008, 01:24:33 pm »
well i want to draw a shape, and when a certain key is pressed i wanna rotate it 90°

how would this look like ?

do not laugh bout my tries ^^ :

Code: [Select]
while (App.IsOpened())
    {
        // Process events


/*
        // Draw predefined shapes
        App.Draw(Shape::Line(10, 10, 710, 100, 15, Color::Red));
        App.Draw(Shape::Circle(200, 200, 100, sf::Color::Yellow, 10, sf::Color::Blue));
        App.Draw(Shape::Rectangle(350, 200, 600, 350, sf::Color::Green));
*/
        // Build a custom convex shape
        Shape Polygon;
        Polygon.AddPoint(0, -50,  sf::Color(255, 0, 0),     sf::Color(0, 128, 128));
        Polygon.AddPoint(50, 0,   sf::Color(255, 85, 85),   sf::Color(0, 128, 128));
        Polygon.AddPoint(50, 50,  sf::Color(255, 170, 170), sf::Color(0, 128, 128));
        Polygon.AddPoint(0, 100,  sf::Color(255, 255, 255), sf::Color(0, 128, 128));
        Polygon.AddPoint(-50, 50, sf::Color(255, 170, 170), sf::Color(0, 128, 128));
        Polygon.AddPoint(-50, 0,  sf::Color(255, 85, 85),   sf::Color(0, 128, 128));

        // Define an outline width
        Polygon.SetOutlineWidth(10);

        // Disable filling and enable the outline
        Polygon.EnableFill(true);
        Polygon.EnableOutline(true);

        // We can still use the functions common to all SFML drawable objects
        Polygon.SetColor(Color(255, 255, 255, 255));
        Polygon.Move(300, 300);
        Polygon.Scale(3, 2);
       // Polygon.Rotate(90);

        // Draw it
        App.Draw(Polygon);

        // Finally, display the rendered frame on screen
        App.Display();

         Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == Event.Closed)
                App.Close();
            if ((Event.Type == Event.KeyPressed) && (Event.Key.Code == Key::Escape))
            {
                App.SetActive();
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                Polygon.Rotate(90);
                App.Draw(Polygon);
                App.Display();
            }

        }
    }

143
General discussions / Where to learn 3d programming
« on: September 07, 2008, 10:33:50 pm »
Hello i am studying informatics at a german university
but i only learn how computers do work how to do assembler and how to create or value algorithmns

but we do not learn any programming language (except assembler, we can do java in an extra course but it´s not a regularly one)

so i wonder where can i learn how to0 use opengl do gamesprogreamming, etc

well at university i dont really

( i am studying bio-informatics to be exacty)

144
General / open gl
« on: September 07, 2008, 04:01:45 pm »
thanks now it works =)

145
General / open gl
« on: September 07, 2008, 03:56:42 pm »
ok the main errors seems gone when i put it in further linker option (global compiler/linker options) but now i got

C:\Programme\CodeBlocks\MEINS\SMFL TEST\main.cpp|32|undefined reference to `_gluPerspective@32'|


? im a newbie

what to do now?

something like lglu.a?

146
General / open gl
« on: September 07, 2008, 03:22:19 pm »
where can i find it?

and how do i link it with code::blocks?
(maybe i could answer this by myself but im just too lazy to think now)

147
General / open gl
« on: September 07, 2008, 12:44:39 pm »
hi i just wanna try out opengl with sfml, but what do i need to download?

the example doesnt work it says:
C:\Programme\CodeBlocks\MEINS\SMFL TEST\main.cpp|23|undefined reference to `_glClearDepth@8'|

and so on ...

do i need some opengl headers?

whatever plz tell me

148
Window / Prblem with creating a window
« on: September 07, 2008, 11:44:12 am »
i tried to create a window using an examplecode:

#include <SFML/System.hpp>

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window.hpp>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(1000, 600, 64), "SFML Events");

    // Get a reference to the input manager associated to our window, and store it for later use
    const sf::Input& Input = App.GetInput();

    // Start main loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                App.Close();
        }

        // Get some useless input states, just to illustrate the tutorial
        bool         LeftKeyDown     = Input.IsKeyDown(sf::Key::Left);
        bool         RightButtonDown = Input.IsMouseButtonDown(sf::Mouse::Right);
        bool         JoyButton1Down  = Input.IsJoystickButtonDown(0, 1);
        unsigned int MouseX          = Input.GetMouseX();
        unsigned int MouseY          = Input.GetMouseY();
        int          JoystickX       = Input.GetJoystickAxis(1, sf::Joy::AxisZ);
        int          JoystickY       = Input.GetJoystickAxis(1, sf::Joy::AxisY);
        int          JoystickPOV     = Input.GetJoystickAxis(1, sf::Joy::AxisPOV);

        // Display window on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


but the window doesnt really look good, instead of a black window i have many how should i say... many pixels   a graphic error

why is this and how can i correct it?
  i use version 1.3
  code::blocks with mingw
 i think all compiler/linker ... options are correct

Pages: 1 ... 8 9 [10]