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

Pages: [1]
1
General / Re: Game window is smaller in my laptop...
« on: August 27, 2019, 04:53:15 pm »
How do I scale the entire window from the program?

But then I have mouse events that wait for the user to click on certain sprites. If I just scale the window, the mouse event coordinates won't change right. So the program won't work as expected and even when the player clicks the sprites, the program won't register it.

I guess I just have to multiply each mouse event by how much I scale the window?

(edit: oh or I can just divide the sf::event of a mouse click by how much I scaled the window?)
After scaling the window, would the size of the window change only to the operating system but also to the program?

Thanks for replying

2
General / Game window is smaller in my laptop...
« on: August 27, 2019, 04:39:12 pm »
I wrote a game on my computer which is to be presented in my laptop.

I set the dimensions (in pixels) for the game window, on my computer to be as large as I wanted it to be on my laptop.

But when I compile the game in my laptop.. the game window is very tiny!

What do I do now? Everything in the game from mouse events to graphics correspond to coordinates of the tiny window.

Is there anything that would help scale the window up a little? What about mouse events, do I have to rewrite everything?

3
Here you go:
#include <SFML/Graphics.hpp>
int main() {

        sf::Texture texture;
        texture.loadFromFile(sprite_location);
        sf::Texture new_texture{ texture }; // <-- causes error

        system("pause");
        return 0;
}

I have no idea what TransientContextLock is supposed to be though..  :P

output on console:
An internal OpenGL call failed in Texture.cpp(98).
Expression:
   glFlush()
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

Press any key to continue . . .

4
Graphics / Can't construct a Texture object from another Texture object?
« on: August 15, 2019, 02:24:30 pm »
The documentation doesn't seem to have a mention about this so I'm wondering if this is normal.

I get the error:
An internal OpenGL call failed in Texture.cpp(98).
Expression:
   glFlush()
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.


When I try to construct a Texture object from another Texture object with loaded texture.
        sf::Texture temp1;
        temp.loadFromFile(image_location);
        sf::Texture player_texture{ temp };

No error if the texture object doesn't have a loaded texture already
        sf::Texture temp1;
        sf::Texture player_texture{ temp };
But of course this serves no purpose.


My original intent was to do this:
sf::Texture texture_initialize(std::string location) {
        sf::Texture texture;
        texture.loadFromFile(location);
        return texture;
}

--> inside a function:
        sf::Texture player_texture{ texture_initialize(image_location) };
 

5
General / How do I share a texture object amongst object instances?
« on: August 15, 2019, 07:06:22 am »
Here is an example class that I wrote:

class example {
private:
        sf::Texture player_texture;
public:
        sf::Sprite player_sprite;

        example() {
                player_texture.loadFromFile(fight_sprite_location);
                player_sprite.setTexture(player_texture);
        }
};

So the above class lets you make an object of the class and use that object's sprite instead of having to declare the texture and sprite in the main function.

Basically it's for tidying up my main function a  bit.

The problem however is that I might want to instantiate multiple instances of the class (all using the same texture itself, just their sprite attributions like position etc differ).

In that case each instance would have a separate texture object, which is a waste because really all the class instances need the same texture.


Is there a way to share a texture amongst object instances without having to allocate a new texture in each of the objects, and without having to declare a texture where the object has been created (I want as less code in main as possible, because I want my friends to be able to read the code).

Maybe something with the static keyword?

thx for reading  :)




6
General / Re: Voice to text?
« on: March 12, 2019, 06:14:04 am »
Okay. Would anybody happen to know a good place to ask this at?
thx

7
General / Voice to text?
« on: March 01, 2019, 01:09:22 pm »
I need to take voice input for my program. Any suggestions? Is there anything simple?

Btw I'm using Windows 10, Visual Studio 2017, I'm okay with platform specific.

8
General / Re: Can I pull events without having a window?
« on: February 20, 2019, 05:08:25 pm »
Hmmm, okay thanks.
How would I make a window hidden if I were to?

9
General / Can I pull events without having a window?
« on: February 20, 2019, 11:16:07 am »
I need to pull events without having a visible window. Can this be done without a window class? If I need to have a window class can I have it be hidden and always taking events even when it's not active?

I want this because: standard library of C++ doesn't allow taking of input without 'enter' following the input. So I was hoping SFML could help me with it.

Of course I could probably use SFML for the entire project but I'm only doing simple stuff.

Can I pull events from regular console that pops up when you run a C++ program (I use windows, so presumably we're talking about the windows console).
(While using SFML)

10
General discussions / Where do I put the SFML notice?
« on: February 17, 2019, 09:43:35 am »
1) When do I need to put the SFML notice
https://www.sfml-dev.org/license.php

2) If I made a project based on SFML and posted it on GitHub, do I need to mention the license, where do I mention it? As a text file at the main page? What do I name the text file?

3) Suppose I have not used the SFML DLLs but just copied part of the source code (eg. the part of the library related with clipboard manipulation) do I need to still put the SFML notice?

What happens if somebody didn't put the SFML notice?

11
Okay here's what I did (to any Googlers). I defined SFML_STATIC in pre-processor directives. Then I pasted all the dependencies from the website. I added a -d to every one of them.

Some of them didn't have a -d version so I had to painfully identify those files.
My dependencies now:
sfml-graphics-s-d.lib    
sfml-window-s-d.lib
sfml-system-s-d.lib
opengl32.lib
freetype.lib
sfml-window-s-d.lib    
winmm.lib
gdi32.lib
sfml-audio-s-d.lib    
openal32.lib
flac.lib
vorbisenc.lib
vorbisfile.lib
vorbis.lib
ogg.lib
sfml-network-s-d.lib    
ws2_32.lib
sfml-system-s-d.lib    
%(AdditionalDependencies)

It works. Thanks a lot FRex.

So I need to add bin to my library directory if I want to use openal/audio?

Lastly in your opinion, which is better dynamic or static and why?

12
Yes I hadn't put that preprocessor. Okay quite honestly I don't know the difference between static dynamic and whatever.

Let's say I want to use dynamic for now. I didn't put the preprocesor.
I'm still on debug.

I changed the libraries to:
sfml-graphics-d.lib
sfml-window-d.lib
sfml-system-d.lib

But I get this error while trying to run the program in the tutorial.

I get a series of message boxes titled 'System Error' saying following:
"The code execution cannot be processed because sfml-graphics-d-2.dill was not found. Reinstalling the program may fix this problem".

But why wasn't it found? And where is it?

Along with that sfml-system-d-2.dll, sfml-window-d-2.dl were not found either.

By the way is bin accessed by one of the library or header files? So would that mean that I should not keep the bin file in a separate file?

Also I'm building for debug Win32 and building on debug x86.


13
I don't know where I'm going wrong. I'm using Visual Studio 2017.

I did exactly as told in https://www.sfml-dev.org/tutorials/2.5/start-vc.php
I even tried watching some Youtube videos but they all instructed to do the same thing.

I ran the code from the page and got errors like so:
LNK2019   unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)"..

and many errors like that.

I want to get SFML to work on build mode.

Under additional include libraries, I put the right path, I am able to include SFML without any errors.
I'm sure I added the right path for additional library directories as well.

Under Additional Dependencies I have:
sfml-graphics-s-d.lib
sfml-window-s-d.lib
sfml-audio-s-d.lib
sfml-network-s-d.lib
sfml-system-s-d.lib
%(AdditionalDependencies)


I've been trying to do all kinds of random stuff to get SFML to work. I just don't get it.. Where have I gone wrong??

Also what is the 'bin' folder for? Are we never going to use it?


Pages: [1]
anything