• What Do You Need Help With? V6
    7,544 replies, posted
[QUOTE=elevate;46815203][code] bool collisionPlayerMonster (NPC* player, NPC* monster) { ... } collisionPlayerMonster (entity[i].get (), entity[o].get ()); [/code][/QUOTE] I tried that too, got this IntelliSense error I couldn't make sense of: [code]std::unique_ptr<_Ty, _Dx>::unique_ptr(const std::unique_ptr<_Ty, _Dx>::_Myt &) [with _Ty=Entity, _Dx=std::default_delete<Entity>][/code] Specifically it says [code] 2 IntelliSense: "std::unique_ptr<_Ty, _Dx>::unique_ptr(const std::unique_ptr<_Ty, _Dx>::_Myt &) [with _Ty=Entity, _Dx=std::default_delete<Entity>]" (declared at line 1447 of "E:\Programs\Visual Studio\VC\include\memory") is inaccessible e:\Documents\TutorialSFML\TutorialSFML\EventHandler.cpp 29[/code] On compile: [code]Error 5 error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_Ty>' e:\documents\tutorialsfml\tutorialsfml\eventhandler.cpp 29[/code] It looks like it thinks I'm passing a copy of the Entity, but I'm trying to pass a unique_ptr. What's going on? :(
Maybe try changing unique_ptr to a shared_ptr? Maybe Entity's destructor is private? I'm stumped myself.
Adding a public destructor to Entity didn't do anything. Still getting the same intellisense-error and compile-error.
[QUOTE=war_man333;46815238]Adding a public destructor to Entity didn't do anything. Still getting the same intellisense-error and compile-error.[/QUOTE] Changing unique_ptr to a shared_ptr seemed to do the trick for me. Either that or use the raw pointer from the smart pointer. Using a unique_ptr gives me the default_delete error as well. Apparently unique_ptr's destructor is private, probably due to its unique ownership semantics. [code] #include <iostream> #include <memory> #include <vector> struct Entity { virtual void func () { std::cout << "Entity" << std::endl; } }; struct Wall : public Entity { virtual void func () { std::cout << "Wall" << std::endl; } }; // Passing in a shared pointer. void func (std::shared_ptr<Entity> entity) { entity->func (); } // Passing in a raw pointer. void func (Entity* entity) { entity->func (); } int main () { std::vector<std::shared_ptr<Entity>> entities; entities.emplace_back (new Entity); entities.emplace_back (new Wall); // Passing in a shared pointer. func (entities[0]); // Passing in a raw pointer. func (entities[0].get ()); } [/code]
It works!! Thank you so much :) ... and now I need to find out how to handle collision properly, the lag is immense :v:
Hello, does anyone know any good movie for recording the game on windows? I tried Camtasia and it lags/stutters.., also I won't touch FRAPS because I know it sucks (it generates gigabytes of data).. any good idea?
[QUOTE=Fourier;46815738]Hello, does anyone know any good movie for recording the game on windows? I tried Camtasia and it lags/stutters.., also I won't touch FRAPS because I know it sucks (it generates gigabytes of data).. any good idea?[/QUOTE] The reason FRAPs generates gigabytes of data is because it does no compression for you. You are expected to encode and compress it yourself in post, which gives you a lot of control over how your final video is put together. However, if you really don't want to do that for whatever reason then give OBS a try. It's streaming software, but it allows recording to files as well.
[QUOTE=Fourier;46815738]Hello, does anyone know any good movie for recording the game on windows? I tried Camtasia and it lags/stutters.., also I won't touch FRAPS because I know it sucks (it generates gigabytes of data).. any good idea?[/QUOTE] press print screen really fast
[QUOTE=proboardslol;46815879]press print screen really fast[/QUOTE] thanks smartass you have solved all my life problems [editline]29th December 2014[/editline] [QUOTE=BackwardSpy;46815797]The reason FRAPs generates gigabytes of data is because it does no compression for you. You are expected to encode and compress it yourself in post, which gives you a lot of control over how your final video is put together. However, if you really don't want to do that for whatever reason then give OBS a try. It's streaming software, but it allows recording to files as well.[/QUOTE] ok, will try OBS!
[QUOTE=war_man333;46815228]I tried that too, got this IntelliSense error I couldn't make sense of: [code]std::unique_ptr<_Ty, _Dx>::unique_ptr(const std::unique_ptr<_Ty, _Dx>::_Myt &) [with _Ty=Entity, _Dx=std::default_delete<Entity>][/code] Specifically it says ... It looks like it thinks I'm passing a copy of the Entity, but I'm trying to pass a unique_ptr. What's going on? :([/QUOTE] You're trying to copy a unique pointer, it's move only.
Hey guys, I'm working on a small program in C# that needs to scan all pixels in an image and store all colors in an array but only once. [code] Color[] imgColors; imgColors = new Color[254]; Color pixel; [/code] [code] for (int i = 0; i < inBitmap.Width; i++) { for(int j = 0; j < inBitmap.Height; j++) { pixel = inBitmap.GetPixel(i, j); for(int o = 0; o < 254; o++) { if(imgColors[o] != pixel) { imgColors[o] = pixel; break; } } } } [/code] This code just ends up filling all the array with the same color, which is black. I'm relatively new an I have no idea what causing this but it's probably really simple and make me feel stupid. I need the array to have 255 colors max.
[QUOTE=errur;46816694]Hey guys, I'm working on a small program in C# that needs to scan all pixels in an image and store all colors in an array but only once. [code] Color[] imgColors; imgColors = new Color[254]; Color pixel; [/code] [code] for (int i = 0; i < inBitmap.Width; i++) { for(int j = 0; j < inBitmap.Height; j++) { pixel = inBitmap.GetPixel(i, j); for(int o = 0; o < 254; o++) { if(imgColors[o] != pixel) { imgColors[o] = pixel; break; } } } } [/code] This code just ends up filling all the array with the same color, which is black. I'm relatively new an I have no idea what causing this but it's probably really simple and make me feel stupid. I need the array to have 255 colors max.[/QUOTE] What I would do in your case is have a variable that keeps track of how many colors you have already stored. [code] Color[] imgColors; imgColors = new Color[254]; Color pixel; int stored = 0; [/code] And in your main loop check if the color you grabbed was already stored in the array. If it wasn't in the array, you put it in. [code] for (int i = 0; i < inBitmap.Width; i++) { for(int j = 0; j < inBitmap.Height; j++) { pixel = inBitmap.GetPixel(i, j); bool isStored = false; for(int o = 0; o < stored; o++) { if(imgColors[o] == pixel) { isStored = true; break; } } if(!isStored) { imgColors[stored] = pixel; stored++; } } } [/code] I haven't tested this, but it should be about the right mindset. EDIT: You should make sure that it doesn't go out of the range of your array.
[del]Is there any way to make writing a bunch of small files faster than a for loop with fstream? I wonder if there's a way to have memory masquerade as a file? The files do HAVE to be separate, as they'll be fed to another program later on.[/del] Just found a solution thanks to a friend. CreateFile with FILE_ATTRIBUTE_TEMPORARY for Windows and /dev/shm on Linux.
[QUOTE=Fourier;46815738]Hello, does anyone know any good movie for recording the game on windows? I tried Camtasia and it lags/stutters.., also I won't touch FRAPS because I know it sucks (it generates gigabytes of data).. any good idea?[/QUOTE] If you have a newer NVIDIA card you could try Shadowplay. The settings are in the Geforce Experience application. There's probably something similar for AMD cards.
You have to use AMD Gaming Evolved, on AMD, pretty much a 1on1 copy of w/e the application shadowplay is build into. Other then that you can try OBS, but instead of streaming to a website, just set it to save to a file, it has less FPS impact then anything else I've ever used (with the exception of Shadowplay and AMD Gaming Evolved)
Getting "undefined external symbol" despite functions being defined. Language C++, only SFML as external dependency the h file [code]#ifndef ENT_SHOOTINGENEMY_H #define ENT_SHOOTINGENEMY_H #include "SFML\System\Vector2.hpp" #include "ENT_Entity.h" class ENT_ShootingEnemy : ENT_Entity { public: ENT_ShootingEnemy(sf::Vector2f pos); void Update(float DT) override; private: float shotTimer; }; #endif[/code] .cpp file [code]#include "ENT_ShootingEnemy.h" #include "SFML\System\Vector2.hpp" #include "PHYS_Box.h" #include "STATIC_CONTENTMANAGER.h" #include "STATIC_GLOBALGAMEFUNCTIONS.h" #include "ENT_Bullet.h" using namespace sf; ENT_ShootingEnemy::ENT_ShootingEnemy(Vector2f pos) { //... } void ENT_ShootingEnemy::Update(float DT) { //... }[/code] My function call for the constructor appears as this: [b]new ENT_ShootingEnemy(sf::Vector2f(0,0));[/b] This gives me unresolved external symbols and i am stuck
-snip misread post- Post the full link error if you want more help.
yeah, figured i should have posted it, i am stupid. sorry [quote]Error 2 error LNK2019: unresolved external symbol "public: __thiscall ENT_ShootingEnemy::ENT_ShootingEnemy(class sf::Vector2<float>)" (??0ENT_ShootingEnemy@@QAE@V?$Vector2@M@sf@@@Z) referenced in function "private: void __thiscall GameController::spawnEnemy(int,int)" (?spawnEnemy@GameController@@AAEXHH@Z) C:\Users\*******\Dropbox\GameProject\GameProject\GameController.obj [/quote]
[QUOTE=Fatfatfatty;46818393]yeah, figured i should have posted it, i am stupid. sorry[/QUOTE] are you using visual studio?
It would appear that your source file isnt being linked.
Try doing a clean and then build, its possible that the incremental compiler fucked up, and you're linking against an outdated object.
The key question here would be "Did it work in the first place?".
It didn't work before, i tried cleaning and rebuilding the solution but yet i get this strange error message.
So this is more like a design question. I'm currently developing an Android Wear app (Related to spotify) and I need help with two things. 1. The desing pattern suggests goin first vertical, then horizontal. But in my opinion a vertical main menu is totaly stupid, the horizontal just makes more sense. But I'm not sure... 2. So the main-menu looks pretty dull, a black screen with green icons. Any suggestions here? (Ignore the top right, screen function kinda sucks on wear) [IMG]http://i.imgur.com/vHn92Bz.png[/IMG]
snip, im dumb sorry
[QUOTE=Fatfatfatty;46821223]It didn't work before, i tried cleaning and rebuilding the solution but yet i get this strange error message.[/QUOTE] If it didnt work before, maybe you should start again but make sure you link your files properly. If you are using Visual Studio, only source files that are in the project are linked. I'm not sure how Code::Blocks does it but I'm assuming its the same thing. If you are compiling from the command line, make sure you are compiling all the files. Other than that I cant really help much without more information (Or doing it for you).
[code]hg clone -r 994f9a94e406 https://bitbucket.org/Tamschi/tq-tools C:\projects\tq-tools cd tq-tools nuget restore[/code] Doesn't build. I have no clue why, but during build (not editing!) it says it can't find [I]Ablicht[/I] from where it's used in [I]TextureItem.cs[/I] in [I]Meshview[/I]. I think it's a problem with [I]Ablicht[/I], but I have no idea what the reason is :( [editline]31st December 2014[/editline] Nevermind, apparently there's some duplicate import weirdness that's invisible in VS. [editline]31st December 2014[/editline] No, still broken :(
Hey guys has anyone ever used OpenGL or DirectX for 2D graphics? I'm using OpenGL ES for 2D, and I have to create my own matrices and pass them to the shader. I want to use only 3x3 matrices(so not the usual everything is the same with Z = 1) and 2 component vectors. I've got translation rotation and scaling all done, those were easy, I have: [code] 1 0 tx 0 1 ty 0 0 1 [/code] for translation [code] sx 0 0 0 sy 0 0 0 1 [/code] for scaling, and [code] cos a -sin a 0 sin a cos a 0 0 0 1 [/code] for rotation. My problem is I need a matrix that does the mapping so I don't have to specify coordinates in NDC space(-1 to 1) and ratio fix for me (because my phone's aspect ration isn't 1). For the ratio fix I tried: [code] ar = width/height; 1f/ar 0 0 0 1 0 0 0 1 [/code] And it works but it will mess up my rotation. So I need a 3x3 matrix that does the coordinate space mapping and fixes the aspect ratio, I've searched a lot but everyone that does 2D seems to just use an orthographic projection and set Z to 1.
[QUOTE=acarvromvroom;46827824]Hey guys has anyone ever used OpenGL or DirectX for 2D graphics? I'm using OpenGL ES for 2D, and I have to create my own matrices and pass them to the shader. I want to use only 3x3 matrices(so not the usual everything is the same with Z = 1) and 2 component vectors. I've got translation rotation and scaling all done, those were easy, I have: [code] 1 0 tx 0 1 ty 0 0 1 [/code] for translation [code] sx 0 0 0 sy 0 0 0 1 [/code] for scaling, and [code] cos a -sin a 0 sin a cos a 0 0 0 1 [/code] for rotation. My problem is I need a matrix that does the mapping so I don't have to specify coordinates in NDC space(-1 to 1) and ratio fix for me (because my phone's aspect ration isn't 1). For the ratio fix I tried: [code] ar = width/height; 1f/ar 0 0 0 1 0 0 0 1 [/code] And it works but it will mess up my rotation. So I need a 3x3 matrix that does the coordinate space mapping and fixes the aspect ratio, I've searched a lot but everyone that does 2D seems to just use an orthographic projection and set Z to 1.[/QUOTE] The matrix isn't the problem. You're multiplying them in the wrong order. The aspect ratio correction should be the last matrix you multiply the point with.
[QUOTE=Darwin226;46828013]The matrix isn't the problem. You're multiplying them in the wrong order. The aspect ratio correction should be the last matrix you multiply the point with.[/QUOTE] You're right, I was multiplying them in the wrong order rotation is fine now, thanks. I still have no clue how to move to screen space coordinates though. I could interpolate the positions when setting the translation and scale vectors, but that'd be quite hacky, I know that projection matrices do this but they are all 4x4.
Sorry, you need to Log In to post a reply to this thread.