Visual C++ :: Ceil Function Name Collision
Sep 29, 2014
Code:
cv::Size output_size
(gallerycols * 2 * its[0].cols(), ceil(4 / gallerycols) * 2 * its[0].rows());
Error18error C2668: 'ceil' : ambiguous call to overloaded functionE:JackyDownloadsvoronoivoronoi est_voronoi.cpp2071voronoi
I try to #include <cmath>
and use std::ceil to no avail
There are still function names clashing.
View 2 Replies
ADVERTISEMENT
May 1, 2013
i have an assignment which i have done everything i need for except that i need to make sure that any number entered which isnt an interger is rounded up to the nearest whole interger. I know that i need to use the ceil function. how to use this at all. Here is the part of my program that needs to be rounded up.
Code:
scanf("%d", &time);
if( (time > MINTIME) && (time <= MAXTIME) )
else
}
[code]....
how to input the ceil function in so that it rounds up the time?
View 2 Replies
View Related
Jan 20, 2015
Still working with SDL2 and c++ my map collision is messed up since I implemented my Camera.
I do understand that everything has a relative Position on the Screen, depending on the camera.
Problem No. 1: The camera is not moving as fast as the Player, despite having the absolutly same velocity (4/-4)??? How can this be O_o
Problem No. 2: My tile collision is totally messed now. Probably its because of the difference between the Player Position and the camera :/ So if you can solve Problem no. 1, Problem number 2 might work out on its own :)
I will upload the code to github [URL] .....
View 11 Replies
View Related
Oct 19, 2013
How can I determine whether there is a collision between 2 meshes? I'd just like to see if one mesh is inside another.
View 10 Replies
View Related
May 4, 2013
I've been working on my 2D platformer for a while, and I'm running into a couple of problems. It seems to become laggy even when only about 25 entities need to do collision detection with the 8 walls in the area.
Only one thing to note: the BOOST_FOREACH(const Edge& edge, this->GetCollisonBoxEdges()) { sections actually aren't a loop, all players and enemies are basically a vertical line for purposes of hitting walls, so that's why there is some weird stuff in there (like assuming the edge is oriented a certain way, etc).
Asset::WallCollision Asset::GetClosestWallCollision(const std::vector<const Room::Wall*>& walls) const {
typedef std::pair< sf::Vector2<CoordT>, sf::Vector2<CoordT> > Edge;
const Room::Wall* wall_hit = NULL, * landing_wall = NULL;
util::intersect_ret temp, closest;
VelocityT para_vel;
if(this->m_StandingOn) para_vel = this->m_StandingOn->get_unit_parallel_vector() * this->mVelocity.x;
else para_vel = this->mVelocity;
[code].....
View 3 Replies
View Related
Oct 15, 2013
I have the code and it compiles fine but it doesn't work. (i am using the coding made easy sfml 2.0 tutorials)
Code:
#include <SFML/Graphics.hpp>
#include <iostream>
#include <algorithm>
#include <vector>
class Player {
public:
sf::Sprite player;
[Code] ....
View 18 Replies
View Related
Oct 14, 2014
I'm still working on my Project and the next Problem has occured: How do I detect collisions on a tilebased map? My tiles are 16x16 and the map is based on the tutorial of [URL] ..... I really like this Approach because I can define for each tile of what type it should be (so a earth tile can be walkable and lead to a secret passage).
The first Number stands for what Kind of tile it should be (e.g. Grass, Earth, Water, Blank,...) and the number after ":" stands for the type of the tile (e.g. solid, walkable, do dmg to the Player,...).
e.g.
0:0 0:0 0:0 0:0 0:0 //No tile and walkable
0:0 0:0 0:0 0:0 0:0
0:0 0:0 0:0 0:0 0:0
1:1 1:1 1:1 1:1 1:1 //Grass tile and solid
2:1 2:1 2:1 2:1 2:1 //Earth tile and solid
It's working just fine with loading the Images, but i've got no clue about the collision. I've already read a lot of stuff on the Internet but I don't get how to Combine it the structure from above. For example lazyfoo describes the collision with one object like one wall. So how can I check the Player Position with each tile?
For now there's no camera, but I plan to implement one later...
I'm trying to make a 2D platformer
View 5 Replies
View Related
Sep 10, 2014
I'm making a 2D Terraria-like (side-scrolling RPG with destroyable blocks) game with SFML 2.1, and I have no clue how to correctly implement collision detection. Meaning that I have been successful at making it work, but it's not clean and definitely not dynamic.
By example, I mean design wise. What parameters should collision functions take? Where should these functions be located? The same 2 questions for collision reaction. Since I have multiple things that need to collide with each other (player with enemy, player with items, enemy with items, enemy with enemy, player with player, etc...), and the world has to be treated differently, things get complicated. There is no block class, just a vertex array, so collision with the world is based purely on coordinates taken from that array in the world class, which, considering it's the world and not something like a player or an enemy, doesn't inherit from the same base class that they do.
View 7 Replies
View Related
Feb 28, 2013
I have following method to calculate a 16bit hash on a per definition unique string:
uint16_t IReferenceHolder::getHash(const std::string &ref) {
return std::inner_product(ref.begin(), ref.end(), ref.begin(), (uint16_t)0) % 65437;
}
Actually it calculates an inner product on each character adding it to the last result (see [URL] .....).
65437 is the nearest prime to 2^16. In fact I never need the full range of 16 bit, therefore 65437 different hashes are enough.
Empirically it seems - on unique strings - to be collision free. The strings have an maximum size of 255.
View 3 Replies
View Related
Jul 28, 2013
I have made a simple 2d shooter (bird eye view) and want implementing the collision detection between the monsters and bullets. The problem is as follows
Each monster has locationX, locationY as coordinates.
Each monster has a Rectangle representing its collision box, (if bullet inside rectangle then its a collision).
Each bullet has locationX, locationY as coordinates as well.
pretty standard up till now.
each frame I need to check if some bullet collided with some monster.
the brutal force is to keep a list of all the bullets and monsters and to check the possibility of collision between all of them which takes O(#bullets * #monsters).
View 2 Replies
View Related
Mar 19, 2013
I searched the web for error: C3867... and the discussions where murky or obscure.
My code excerpt is:
#pragma once
#include <windows.h>
#include <stdlib.h>
#include <process.h>
void PutUpfrmIO(void *);
namespace WordParsor {
[Code] .....
I get the generic message:
error C3867: 'WordParsor::Form1::PutUpfrmIO': function call missing argument list; use '&WordParsor::Form1::PutUpfrmIO' to create a pointer to memberc:userskingc++wordparsorwordparsorForm1.h... and the suggestion fix generate another error.
One person suggested the gcroot<> object wrapper... but I do not know how to modify/declair the function or its argument type.
View 2 Replies
View Related
Dec 16, 2012
In my MFC, CMyPorpertyPageDlg is derived from CPropertyPage. How to access its member function from a nonmember function in the same CPP file?.
void Non_Member_Get_PorpertyPage()
{
CMyPorpertyPageDlg* pPageDlg = ....
}
View 4 Replies
View Related
Oct 1, 2014
I have the code:
void go(CMFCApplication1Dlg * pdlg)
{
pdlg->listcontrol1.InsertItem(0, "Row1");
}
then i call it in thread
Code:
void CMFCApplication1Dlg::OnBnClickedButton3()
{
AfxBeginThread(go(this), NULL, THREAD_PRIORITY_NORMAL, 0, 0, NULL);
}
It doesn't work.
View 13 Replies
View Related
Jul 10, 2013
Is there a function that can take out part of the string such as,
C:/Users
I want to take out Users.
I need the function to search for the first "/" and take out the last dir name
C:/windows would be c:
C:/users/bla would be c/users
Im programming in visual studio 6.0 MFC
View 4 Replies
View Related
Oct 24, 2013
In my Header file:
class MyData {
struct Fparams {
int i;
bool flag;
};
}
Now in CPP file:
void MyData::GetData() {
Fparams fParam;
fparam = AllData();
[Code] ....
Now i get an error saying - error: no match for 'operator=' in fparam = AllData(); ........
View 10 Replies
View Related
Apr 9, 2014
The code is bulit for the x64 platform with unicode enabled.
Code:
class CameraExporter : public UtilityObj {
static INT_PTR CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
};
void CameraExporter::BeginEditParams(Interface* ip,IUtil* iu) {
[Code] .....
Error2error LNK2019: unresolved external symbol "public: static __int64 __cdecl CameraExporter::DlgProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?DlgProc@CameraExporter@@SA_JPEAUHWND__@@I_K_J@Z) referenced in function "public: virtual void __cdecl CameraExporter::BeginEditParams(class Interface *,class IUtil *)" (?BeginEditParams@CameraExporter@@UEAAXPEAVInterface@@PEAVIUtil@@@Z)e:Jackydocumentsvisual studio 2010ProjectsCameraExporterCameraExporterCameraExporter.objCameraExporter
View 2 Replies
View Related
Feb 7, 2013
I want to run Unhidden.exe in drive N: and send char to that program. I use function like this
Code:
system("N:/Unhidden.exe");
It can open Unhidden.exe but it run in visual studio 2010Projects . I try to use command N: and Unhidden.exe in cmd it can run in drive N: . So I try to use function like this
system("N:");
system("Unhidden.exe");
but it not found Unhidden.exe . How to use 2 command in sytem() function ?
View 4 Replies
View Related
May 5, 2013
Visual C++ 2010
I'm using SFML with Visual C++ and need to pass a handle to a function. I've tried to find this on the web with no luck.
The handle happens to be a sprite defined as: sf::Sprite Numbers(MyNumbers);
Now I want to pass "Numbers" to a function.
-
-
getFrame(Numbers);
-
-
???? getFrame(??????) {
Numbers.SetSubRect(sf::IntRect(0,0,63,63));
return ????
}
How do I do this?
View 1 Replies
View Related
Nov 27, 2013
If there are two projects A and B. A is created as .dll, while B is created as static library.
project A has a class "classA"
classA: public classB {
public:
testA();
};
project B has a class "classB"
classB {
public:
testB();
} ;
I want to make a symbol of classB::testB() in A.exp (like ?testB@classB@@QAEXXZ), can I do it by using __declspec(dllexport)?
Also if I make classB as a template class, can the symbol of classB::testB() be generated automatically in A.exp when building project A?
View 2 Replies
View Related
Oct 18, 2013
Consider the following code:
Code:
template<class TYPE>
void MultiplyByTwo(TYPE data) {
cout <<"Double = " << data * 2 << endl;
}
If I declared that code in a header file I'd be able to call it with an int, float, double or whatever. But where does the actual code get instantiated? Is it effectively inlined?
What I'm wondering is if there'd ever be any scenario for putting such code in a DLL - e.g.
Code:
#ifdef BUILDING_MY_DLL
#define MY_DLL_API __declspec(dllexport)
#else
#define MY_DLL_API __declspec(dllimport)
#endif
template<class TYPE>
MY_DLL_API void MultiplyByTwo(TYPE data) {
cout <<"Double = " << data * 2 << endl;
}
I just tried it and was slightly surprised to find it wouldn't compile. It compiles fine when actually building the DLL but when I try to build something else which uses that DLL I get compiler error C2491 (definition of dllimport function not allowed).
I guess that kinda makes sense if template functions are effectively inlined... or is there some other explanation....
View 14 Replies
View Related
Jan 30, 2013
The compiler "forces" me to use the std::max method, I cannot override it even when writing ::max in my code.
View 4 Replies
View Related
Dec 31, 2014
I am experimenting with the c++11 regex and came across an item missing from my limited c++ knowledge.
From this article: [URL] ....
I am unfamiliar with this function with the -> operator?
Code:
auto begin(strip const & s) -> char const *
{
return s.first;
}
Is this code the same?
Code:
char const* begin (strip const& s) {
return s.first;
}
View 3 Replies
View Related
Dec 26, 2014
I am really unsure how to keep within the boundries and still perform the function I need. My code functions normal when I have both categories 'buy' and 'sell' in the queue which is my main goal and I should be clocked out on this function BUT, If the queue is missing all 'sell' data, it segment faults.
I don't want to change any of the functionality, just get rid of the segment fault error. It appears b < buydat.size() and buydat[b+1] are in conflict. The purpose of the algorithm is capture the record sets in groups of 7 from data coming in from the www as strings. In that group/set, I pattern match for the string 'Buy' and if true, insert record into vector for processing. I also need the price (y = 3)
How do I capture buydat[2] and buydat[3] in groups of 7 without a segment fault?
Code:
void buymngr(){
//vector defs
vector<std::string> buydat;
vector<std::string> markdat;
vector<std::string> pricedat;
vector<std::string> qworkcoin;
buydat = getmyData();
[Code] ....
When one buy and one sell are sitting in the queue. Code functions as expected:
gentoo-mini # ./masterMain
Code:
I got my own data
I just got market buy data
Bork!
Bork2!
You 'do' have buy string match data!
my max price is 0.00492975 at position 0
[Code] ....
View 7 Replies
View Related
Sep 20, 2012
I have a window I am opening from the parent Dialog by using DoModal:
CMyDlg dml;
dml.DoModal;
When the window opens I want it to run a function on open. Lets just for example say copy files and show a progress bar. Where can I put the function call so that when DoModal is called that function will execute?
View 13 Replies
View Related
Jan 26, 2014
I have been googling for a long time to find the header used with sleep().
View 5 Replies
View Related
Jul 19, 2013
having problem passing arguments between main and a function.
I would like to pass three values to a function, have it calculate a 2D matrix and return it back to main. I would like it to accept variable matrix size. Here is my code:
#include "stdafx.h"
#include <cstdlib>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <fstream>
[code]....
View 6 Replies
View Related