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

Pages: [1] 2
1
General / Re: Polling network messages & VSYNC
« on: March 30, 2015, 11:29:26 pm »
Uh,

Quote
But if I turn VSync on, won't swapping buffers block by itself? Maybe I'm getting the wrong idea, but each time I turned it on, my framerate dropped to 60 FPS.

Buffer swap occurs on .display().

@EDIT
Nevermind, figured it out.

2
General / Re: Polling network messages & VSYNC
« on: March 30, 2015, 11:06:38 pm »
But if I turn VSync on, won't swapping buffers block by itself? Maybe I'm getting the wrong idea, but each time I turned it on, my framerate dropped to 60 FPS.

3
General / Re: Polling network messages & VSYNC
« on: March 30, 2015, 08:10:13 pm »
I don't quite follow. I can't do anything during the time window.display() is called - and it will block for some milliseconds, for Vsync's sake. How can I poll my stuff during that time on the same thread? (By poll I mean call an object's member function, not poll keyboard events)

Didn't find the answer in the link you've linked.

4
General / Polling network messages & VSYNC
« on: March 30, 2015, 07:47:49 pm »
Hey there.

I am using a 3rd party networking library, and I need to poll my packets as often as possible - framerate independent. But I also would like to have VSYNC enabled.

How do I go about that? When I turn VSYNC on, window.display() will block for a certain amount of time, and there's no way around it. I can't run my packet polling on a separate thread.

Should I just manually limit the framerate, and poll my packets independently? But that wouldn't be like turning VSYNC on - it'd be just limiting the framerate, right?

Cheers.

5
Graphics / Win32 LoadFromFile for Image crashes
« on: February 14, 2012, 09:34:20 pm »
Quote
There are nice high-level cross-platform APIs for GUIs


If you could give me their names out, I'd own you one  :)

6
Graphics / Win32 LoadFromFile for Image crashes
« on: February 14, 2012, 05:44:22 pm »
I am trying to run Win32 app using SFML 1.6.

Here's the whole code:



Code: [Select]
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML\Graphics.hpp>
#include <Windows.h>


////////////////////////////////////////////////////////////
/// Function called whenever one of our windows receives a message
///
////////////////////////////////////////////////////////////
LRESULT CALLBACK OnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam)
{
    switch (Message)
    {
        // Quit when we close the main window
        case WM_CLOSE :
        {
            PostQuitMessage(0);
            return 0;
        }
    }

    return DefWindowProc(Handle, Message, WParam, LParam);
}


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \param Instance : Instance of the application
///
/// \return Error code
///
////////////////////////////////////////////////////////////
INT WINAPI WinMain(HINSTANCE Instance, HINSTANCE, LPSTR, INT)
{
    // Define a class for our main window
    WNDCLASS WindowClass;
    WindowClass.style         = 0;
    WindowClass.lpfnWndProc   = &OnEvent;
    WindowClass.cbClsExtra    = 0;
    WindowClass.cbWndExtra    = 0;
    WindowClass.hInstance     = Instance;
    WindowClass.hIcon         = NULL;
    WindowClass.hCursor       = 0;
    WindowClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_BACKGROUND);
    WindowClass.lpszMenuName  = NULL;
    WindowClass.lpszClassName = TEXT("SFML App");
    RegisterClass(&WindowClass);

    // Let's create the main window
    HWND Window = CreateWindow(TEXT("SFML App"), TEXT("SFML Win32"), WS_SYSMENU | WS_VISIBLE, 0, 0, 800, 600, NULL, NULL, Instance, NULL);

    // Let's create two SFML views
    HWND View1 = CreateWindow(TEXT("STATIC"), NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 0,  0, 800, 600, Window, NULL, Instance, NULL);
    sf::RenderWindow SFMLView1(View1);

    // Load images to display
    sf::Image Image1;
    Image1.LoadFromFile("image.png");
    sf::Sprite Sprite1(Image1);
    Sprite1.SetPosition(55,105);

    // Loop until a WM_QUIT message is received
    MSG Message;
    Message.message = ~WM_QUIT;
    while (Message.message != WM_QUIT)
    {
        if (PeekMessage(&Message, NULL, 0, 0, PM_REMOVE))
        {
            // If a message was waiting in the message queue, process it
            TranslateMessage(&Message);
            DispatchMessage(&Message);
        }
        else
        {
   SFMLView1.Clear(sf::Color(0,0,0));
            // Draw sprite 1 on view 1
            SFMLView1.Draw(Sprite1);

            // Display each view on screen
            SFMLView1.Display();
        }
    }

    // Destroy the main window
    DestroyWindow(Window);

    // Don't forget to unregister the window class
    UnregisterClass(TEXT("SFML App"), Instance);

    return EXIT_SUCCESS;
}


Though, I get memory access violation on this line:
Code: [Select]
Image1.LoadFromFile("image.png");

What could possibly be wrong?

@EDIT

Nevermind me! I forgot to use Win32 Application templace instead of console.


Though, I have another question. Do you know any tutorials on how to programitically use edit boxes/combo boxes/buttons and so on?

7
General / Buffer Overrun on starting a window
« on: January 17, 2012, 02:02:38 pm »
I did build all the .dll files, but i don't know how to build all the .lib files, which wouldn't have the -s extension.

Okay, i used static libraries, and it works :)

8
General / Buffer Overrun on starting a window
« on: January 17, 2012, 01:44:36 pm »
I'm getting link errors when trying to compile sfml-graphics.

Quote
2>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
2>Font.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Unicode::Text::operator class std::basic_string<unsigned int,struct std::char_traits<unsigned int>,class std::allocator<unsigned int> > const &(void)const " (??BText@Unicode@sf@@QBEABV?$basic_string@IU?$char_traits@I@std@@V?$allocator@I@2@@std@@XZ) referenced in function "public: bool __thiscall sf::Font::LoadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,class sf::Unicode::Text const &)" (?LoadFromFile@Font@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABVText@Unicode@2@@Z)
2>String.obj : error LNK2001: unresolved external symbol "public: __thiscall sf::Unicode::Text::operator class std::basic_string<unsigned int,struct std::char_traits<unsigned int>,class std::allocator<unsigned int> > const &(void)const " (??BText@Unicode@sf@@QBEABV?$basic_string@IU?$char_traits@I@std@@V?$allocator@I@2@@std@@XZ)
2>Font.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Unicode::Text::Text(unsigned int const *)" (??0Text@Unicode@sf@@QAE@PBI@Z) referenced in function "public: static class sf::Font const & __cdecl sf::Font::GetDefaultFont(void)" (?GetDefaultFont@Font@sf@@SAABV12@XZ)
2>String.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Unicode::Text::Text(void)" (??0Text@Unicode@sf@@QAE@XZ) referenced in function "public: __thiscall sf::String::String(void)" (??0String@sf@@QAE@XZ)


I did use Release DLL.


@EDIT

Nevermind, i had to choose Build Solution. (F7)

9
General / Buffer Overrun on starting a window
« on: January 17, 2012, 01:25:42 pm »
No, i didn't.

10
General / Buffer Overrun on starting a window
« on: January 17, 2012, 12:47:03 pm »
It's Microsoft Visual C++ 2010.

Debug doesn't work. It crashes at the startup with error that it wasn't initialized correctly (The Isometric.exe). Here are the logs:

Quote
'Isometric.exe': Loaded 'C:\Documents and Settings\Ewa\Pulpit\Projekty_C++\Isometric\Debug\Isometric.exe', Symbols loaded.
'Isometric.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\Program Files\AVAST Software\Avast\snxhk.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\Documents and Settings\Ewa\Pulpit\Projekty_C++\Isometric\Isometric\sfml-graphics-d.dll', Cannot find or open the PDB file
LDR: LdrpWalkImportDescriptor() failed to probe C:\Documents and Settings\Ewa\Pulpit\Projekty_C++\Isometric\Isometric\sfml-graphics-d.dll for its manifest, ntstatus 0xc0150002
Debugger:: An unhandled non-continuable exception was thrown during process load
The program '[9760] Isometric.exe: Native' has exited with code -1072365566 (0xc0150002).


And the build logs from debug:


Quote
1>------ Build started: Project: Isometric, Configuration: Debug Win32 ------
1>  main.cpp
1>  Isometric.vcxproj -> C:\Documents and Settings\Ewa\Pulpit\Projekty_C++\Isometric\Debug\Isometric.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


And i linked these libraries to the debug:

Code: [Select]
sfml-main-d.lib
sfml-graphics-d.lib
sfml-window-d.lib
sfml-system-d.lib
sfml-network-d.lib

11
General / Buffer Overrun on starting a window
« on: January 17, 2012, 12:13:21 pm »
My application compiles properly, but when it starts and initiates the window, i get a error:

Quote
A buffer overrun has occurred in Isometric.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.

For more details please see Help topic 'How to debug Buffer Overrun Issues'.


Which points to these lines in gs_report.c:

Code: [Select]
#if defined (_CRTBLD) && !defined (_SYSCRT)
    DebuggerWasPresent = IsDebuggerPresent();
    _CRT_DEBUGGER_HOOK(_CRT_DEBUGGER_GSFAILURE); <- This
#endif  /* defined (_CRTBLD) && !defined (_SYSCRT) */


And here's my code:

Code: [Select]
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <iostream>

int main() {

sf::RenderWindow App(sf::VideoMode(800,600,32),"Test");

while(App.IsOpened())
{
sf::Event Event;
while(App.GetEvent(Event))
{
if(Event.Type == sf::Event::Closed) {
App.Close();
}
}

App.Clear();
App.Display();
}


return 0;
}


Here are my linked libraries:

Code: [Select]
sfml-main.lib
sfml-graphics.lib
sfml-window.lib
sfml-system.lib
sfml-network.lib


I have all of them (.dlls) in my release folder and so on.

Here are the logs.
Debug logs:

Quote
'Isometric.exe': Loaded 'C:\Documents and Settings\Ewa\Pulpit\Projekty_C++\Isometric\Release\Isometric.exe', Symbols loaded.
'Isometric.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\Program Files\AVAST Software\Avast\snxhk.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\Documents and Settings\Ewa\Pulpit\Projekty_C++\Isometric\Release\sfml-graphics.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\user32.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\glu32.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\Documents and Settings\Ewa\Pulpit\Projekty_C++\Isometric\Release\sfml-window.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\Documents and Settings\Ewa\Pulpit\Projekty_C++\Isometric\Release\sfml-system.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.4974_x-ww_d889290f\msvcp90.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.4974_x-ww_d889290f\msvcr90.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\msvcp100.dll', Symbols loaded.
'Isometric.exe': Loaded 'C:\WINDOWS\system32\msvcr100.dll', Symbols loaded.
'Isometric.exe': Loaded 'C:\WINDOWS\system32\msctf.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\atioglxx.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\version.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\ws2_32.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\atiadlxx.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.3053_x-ww_b80fa8ca\msvcr80.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\mcd32.dll', Cannot find or open the PDB file
'Isometric.exe': Unloaded 'C:\WINDOWS\system32\mcd32.dll'
'Isometric.exe': Loaded 'C:\WINDOWS\system32\dinput.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\hid.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\wintrust.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\crypt32.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\msasn1.dll', Cannot find or open the PDB file
'Isometric.exe': Loaded 'C:\WINDOWS\system32\imagehlp.dll', Cannot find or open the PDB file
First-chance exception at 0x6f007200 in Isometric.exe: 0xC0000005: Access violation reading location 0x6f007200.
A buffer overrun has occurred in Isometric.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.

For more details please see Help topic 'How to debug Buffer Overrun Issues'.
The program '[5720] Isometric.exe: Native' has exited with code 0 (0x0).


Build logs:

Quote
1>------ Build started: Project: Isometric, Configuration: Release Win32 ------
1>  main.cpp
1>  Generating code
1>  Finished generating code
1>  Isometric.vcxproj -> C:\Documents and Settings\Ewa\Pulpit\Projekty_C++\Isometric\Release\Isometric.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


That's it from my output. I don't think i am mixing builds... Aha, also i have SFML_DYNAMIC defined in preprocessor.

12
Window / App.GetInput with TextEntered?
« on: December 07, 2011, 08:22:02 pm »
I need to check for TextEntered & add the text in a class.

How would i do it using TextEntered? It's a edit box, so i need to use it for good input. I can't use:

Code: [Select]
while(App.GetEvent(Event))
{
      if(Event.Type == sf::Event::TextEntered)
      {
            my_string += static_cast<char>(Event.Text.Unicode);
            sfml_string.SetText(my_string);
       }
}


As it must be in a class, and when i use it in a class, it's very, very slow.

Any ideas?

13
Graphics / 3d ~ Or SFML + Irrlicht
« on: November 17, 2011, 08:36:51 pm »
That's true, but as i said, i use 2d way more than i will use 3d  :oops:

14
Graphics / 3d ~ Or SFML + Irrlicht
« on: November 17, 2011, 07:55:38 pm »
Hi.

I'd love to be able to merge SFML with Irrlicht, i have my reason for that, but....

I need to load 3d models/meshes occasionally in my 2d project. Wouldn't it be easier to use pure OpenGL with SFML for loading 3d objects? Or it's easier to merge SFML and Irrlicht?

All i need is to load some 3d model, texture it and rotate... Maybe that's much.
I'm not sure if it's OK to ask about it here, but i didn't know where else.

15
Graphics / sf::Font loading font problem [SOLVED]
« on: November 11, 2011, 10:30:12 am »
I try to load font like that...

Code: [Select]
sf::Font ButtonFont;
ButtonFont.LoadFromFile("arial.ttf");


But i get this error while compiling:

Quote
1>main.obj : error LNK2001: unresolved external symbol "private: static unsigned int * sf::Font::ourDefaultCharset" (?ourDefaultCharset@Font@sf@@0PAIA)
1>C:\Documents and Settings\MacKam\Pulpit\CPP\Crystal Editor\Release\Crystal Editor.exe : fatal error LNK1120: 1 unresolved externals


What's wrong  :( ?

@EDIT

I would like to load ASCII characters only. Without these special ones like
ąśę itp. But i have only Polish fonts on my computer.

@EDIT2

SFML_DYNAMIC...  :roll:

Solved.

Pages: [1] 2