C :: Pointing To A Vectors X Coordinate Located Within A Structure

Feb 8, 2015

Cam is a pointer to a structure and viewpoint is a vector located within the struct. I am trying to read in from a file the coordinates for the vector. I have also tried &cam->view_point->x as well as &cam.view_point.x and it tells me that I am requesting something not in a struct

Code: count= fscanf(in,"%d %d %d", &cam->view_point.x, &cam->view_point.y,&cam->view_point.z);

View 14 Replies


ADVERTISEMENT

C :: How To Create A Structure That Pointing To Another Different Structure

Mar 17, 2013

how I can create a structure that pointing to another different structure. And also passing structure to function.

View 3 Replies View Related

C++ :: Linear Buffer Coordinate - Printing Onto Screen Coordinate

Mar 24, 2013

I have a linear buffer coordinate, i am to print onto a screen coordinate.

Say maxy = 20, maxx = 10, bufferx = 20, y, x,
Buffer coordinates to screen coordinates:
Algorithm: So for each maxx'th of bufferx, y will +1 and x will reset.
Mathematical: y = int bufferx / maxx,
const double averageIncr = int (maxx+1/maxx) - double (maxx+1/maxx);
So the amount of averageIncr in (int bufferx / maxx - float bufferx / maxx)
is the screen x coordinate. Then
(int bufferx / maxx - float bufferx / maxx) / averageIncr = x

Screen coordinates to buffer coordinates:
bufferx, y = 21, x = 10, maxy = 20, maxx = 10,

y * x would be the case if bufferx <= max screen coordinate.
There is no max bufferx.

How to find the transition from screen coordinates to buffer coordinates? Also, if the algorithm within a for loop, or that the mathematical way would be slower or not? I rarely touch floating point stuff.

View 3 Replies View Related

C++ :: Vectors With Structure - How To Add Data

Nov 26, 2014

I have two structs like below,

struct SP {
string sp1;
string sp2;
};
struct SL {

[Code] ....

How to add data to slVect ?

View 6 Replies View Related

C++ :: List Of Vectors (vector Of N Vectors Of M Elements)

Mar 19, 2014

I create a list of vectors (a vector of n vectors of m elements).

std::vector <std::vector <int> > vsFA (n, std::vector<int>(n));

How I assign values? I try below, but not worked

void armazenaFA( std::vector <int> &vFA) // this function only knows about vFA
{ vsFA[n] [m]= simTime().dbl();
OR
vsFA[n].push_back(simTime().dbl());
}

View 1 Replies View Related

C :: DLL Error - Procedure Entry Point Could Not Be Located

Oct 22, 2013

I hope that this isn't an elementary question to you more experienced people, but I am having some trouble with my .DLL file. I haven't ever had a problem with compiling and linking it with my main project before, but it appears now some sort of problem has started. The message that appears is :

I have no qualms with posting my .DLL source, as it is not particularly long or complex. It seems the problem functions are the last two I've added ( load_sound( ) and play_sound( ) ).

Here is what I'm linking it with :

Code:

-------------- Build: Debug in game (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -shared -Wl,--output-def=binDebuglibgame.def -Wl,--out-implib=binDebuglibgame.a -Wl,--dll -L"F:FBLARandom gamegame.dll.sourcegame" objDebugconversion.o objDebugprojectile.o objDebugSDL_utility_functions.o objDebug ime.o -o binDebuglibgame.dll -lSDL -lSDL_mixer
Creating library file: binDebuglibgame.a

Output size is 49.10 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds) projectile.c :

Code:
#include "game.h"
#include <stdio.h>
#include <stdlib.h>

/* ******************************************************** */
/* ********* create( ) ********* */
/* ******************************************************** */
/* - Allocates one node of type projectile on the heap, */
/* and returns its' address */
/* ******************************************************** */

[Code] ....

View 6 Replies View Related

C++ :: Including Header Files Located In Two Different Directories

Oct 23, 2013

I have these two files:

/project/protocol/guarddog/report.h

/project/protocol/sky/report.h

I have two report.h files located in two different directories. However the contents of them are different. How can I include the report.h file located in guarddog into the report.h file located in sky?

I assume just doing this would be ambiguous:

#include "report.h"

View 1 Replies View Related

C/C++ :: Assigning Pointer (int) Located In Main With Another Function

Aug 2, 2014

I have the following:

int Allocate(int, int *);
main() {
int *Pointer;
int Elements = 25;
// this works just fine - as expected.
Pointer = (int *) malloc(Elements, sizeof(int));
// This DOES NOT - The value of Pointer never changes.....

[code]....

View 2 Replies View Related

C :: Pointing To Define To Get Value

Jul 24, 2013

I am trying to understand how to get the following value from a define. The code i am trying to understand is as follows:

Code:
#define RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET {0xF000}

Code:
#define RADIO_CONFIGURATION_DATA {
Radio_Configuration_Data_Array,
RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER,
RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH,
RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP,
RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET,
RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD
}

and also have this

Code:
typedef struct {
U8 *Radio_ConfigurationArray;
U8 Radio_ChannelNumber;
U8 Radio_PacketLength;
U8 Radio_State_After_Power_Up;
U16 Radio_Delay_Cnt_After_Reset;
U8 Radio_CustomPayload[RADIO_MAX_PACKET_LENGTH];
}

tRadioConfiguration;

so then in the api i have the following

Code:
for (; wDelay < pRadioConfiguration->Radio_Delay_Cnt_After_Reset; wDelay++); .

so my question is how do i declare my variables, correct terminology ?, to achieve this.

View 7 Replies View Related

C :: Dynamic Load 3D Model From A File Located In Web Server

Feb 2, 2013

I have done a test, I have edited with the WordPad in Windows on my Local Webserver a file banana.h which contains a list of float arrays in order to extract one array and create a text file named ObjVerts.txt I have done a lot of search in the Web in order to find a small piece of code that can read the text file and convert it to a float array GLfloat, but I did not find any. I have found a lot of piece of code that read the file and make a NSData but many of the code seem to not work. It seem that the last statement return nothing!

NSURL *myurl = [NSURL URLWithString:@"http://localhost/ObjVerts.txt"];
//NSString *mystring = [NSString stringWithContentsOfURL:myurl];
NSData *mydata = [NSData dataWithContentsOfURL:myurl];

View 1 Replies View Related

C++ :: Using A Member Within Pointer Function (that Is Located In Same Class) - Segfault

Jan 6, 2013

I'm currently programming a server which uses multiple threads- I have a class for one map in the game. Each map has a thread for timed events(tile regeneration, NPC regeneration, etc.), and a thread for handling NPCs(movement, combat, etc.). A basic structure of the class looks like this:

class Region {
public:
/* game values are here, they are public so
they can be accessed from outside of the class
inside of packet-handling functions and such */
int value;
void *Function();

[Code] ....

The program crashes when I use a member of the same class the function is located in- in the context I have shown about it would crash on "value++".

View 11 Replies View Related

C++ :: Read / Write From A File Located Only In Virtual Store

Oct 16, 2013

Trying to read/write from a file located only in the virtual store. Having trouble loading the file in using

outputFile.open("%localappdata%virtualstoreProgram Files (x86)AGC est.txt");
and
outputFile.open("%localappdata%virtualstoreProgram Files (x86)AGC est.txt");

Although I can get it to work using:

inputFile.open("C:UsersNewlanceAppDataLocalVirtualStoreProgram Files (x86)AGCsettingsV5.cfg");

But I need it to work on other machines IE: Not Newlance.

View 2 Replies View Related

C++ :: Pointing To NULL And 0 The Same Thing?

Apr 13, 2014

Is:

char *endp = NULL;

the same thing as:

char *endp = 0;

?

View 1 Replies View Related

C++ :: Moving From One Coordinate To Another

Feb 18, 2015

I have a character at a co-ordinate, say (3,4) for example, and I need to get him to (10,15). I would like him to move one block every tick or half a second, so that you can see him moving towards his destination. How to achieve this?

View 3 Replies View Related

C++ :: Pointer Pointing To Null Still Executing

Dec 9, 2013

in the below program for both class pointers pointing to null. Class contains normal function executing but class contains virtual function getting segmentation fault.

#include <cstdio>
using namespace std;
class A
{

[Code].....

View 1 Replies View Related

Visual C++ :: Pointing To CButtons In The Constructor?

Feb 4, 2014

I have 22 CButtons and I'm trying to set each one to the corresponding position in a CButton array of size 22 in the constructor.

Code:
*buttons[0] = m_button1;

This code gives me an error in the compiler.

error C2248: 'CObject:perator =' : cannot access private member declared in class 'CObject'

View 2 Replies View Related

C++ :: Create Two Vectors And Then Loop Through The Vectors

Sep 19, 2014

This is probably a very basic question, but I need to create two vectors and then loop through the vectors and output each pair that is found.

The user will input min1 and max1 with step1 for the first vector and min2 and max2 and step2 for the second vector. Then the loops will go through and return the combinations will return each pair of the two vectors.

So if I input min1=1 and max1=10 and step1=1 and same for vector two the return would be:

[1,1]
[1,2]
.
.
.
[10,10]

This is for part of a homework assignment, but I can't continue on the assignment without first getting this simple part to work.

View 1 Replies View Related

C++ :: Printing Character At Certain Coordinate?

Jun 23, 2014

So, in a program I'm making, I have an idea, that I can print the character background first, then print another layer on top of the background. Can I do that? But I need to be able to place a single character at a certain position, what function does that?

View 5 Replies View Related

C/C++ :: Pointing Variable To A Member Function Outside A Class

Apr 13, 2012

In C++, how do i call a method member of class A from a class B, using a pointer. By the way Class A and B are of different types.

I read that when a pointer is pointing to member function it can only point member functions within the class. But how can i point to a member function outside the class.?????

for example

class A {
public:
int add(int x) {
return x+x;

[Code] .....

View 1 Replies View Related

C++ :: How To Convert Pixel To Coordinate In OpenGL

May 23, 2013

How can i convert pixel to [-1..1]coordinate in opengl? Which function? I want to write a program that is work with

glutmousefunc(),

When I click on the screen a ball is appear on it where clicked. but mouse work with pixel and circle work with coordinate between -1 and 1 ....

View 4 Replies View Related

C++ :: Mouse Coordinate Position In Window

May 3, 2014

After searching on stackoverflow I got this

POINT p;
for (int i = 0;; ++i) {
HWND hwnd = GetConsoleWindow();
system("cls");
if (ScreenToClient(hwnd, &p)) {
//p.x and p.y are now relative to hwnd's client area
} cout << p.x << " " << p.y;
Sleep(200);
}

I'm looking for a function that gives current mouse position(x and y) in that particular console window. I've tried above code but it is not working.

View 5 Replies View Related

C++ :: Heading In Cartesian Coordinate System

Apr 15, 2012

I have 2 points in a cartesian coordinate system, where the first point is always (0,0). Given the second point and a heading in degrees, how would I write an algorithm to determine if the 2nd point is traveling in the general direction of (0,0) ?

For example:

Point a (0,0)
Point b (10,0)
Point b heading = 270 degrees

This would be true this 270 degrees points right and point b is 10 units right of point a. I would probably also want this is be fuzzy somewhat, in that anything from say + or - 30 degrees would also be true, or something like this.

View 6 Replies View Related

C++ :: How To Read Pixels From X / Y Coordinate Using VGA Register Values

Aug 4, 2013

How to read pixels from an x,y coordinate using the VGA register values?

byte readVRAMdirect(VGA_Type *VGA, uint_32 start, uint_32 offset) //Used in 256 color mode!
{
if (!VGA->VRAM_size) return 0; //No size!
return VGA->VRAM[SAFEMOD((start*4)+offset,VGA->VRAM_size)]; //The full protected offset!

[code]....

getVRAMScanlineStart(VGA,y) gives the offset register multiplied by 2 (shl 1), multiplied with the current memory address size (byte, word or dword) multiplied by the scanline. 256-color mode is already working. GETBIT gives a bit #(0-7) of a specified byte.

writeVRAMplane & readVRAMplane are used by the CPU to write data to VRAM (address 0xA000:xxxx-0xBFFF:xxxx), determined by the memory read and write modes(working) and the odd/even, planar or chain4 enable mode (working).how to get the 16 color and interleaved shift mode working?

ZIP with screen captures: URL....

View 2 Replies View Related

Visual C++ :: MFC Coordinate System - Drawing Of Angles?

Oct 11, 2013

I am drawing in a simple (square) MFC window. I realize that (0,0) starts in the upper left hand corner. I wanted to see how MFC handled drawing of angles, so I use this code:

Code:
double CompassDegreesToRadians(double compassDegrees) {
return((PI / 2.0f) - (compassDegrees * PI / 180.0f));
}
// Make pen
CPen penRed;
penRed.CreatePen(PS_SOLID | PS_COSMETIC, 1, RGB(255, 0, 0));
// Test Angles

[Code] .....

Using this code, and changing the value of angle1 to these values (0, 90, 180, 270) I think MFC uses the coordinate system:

Code:
180 -y
|
|
-x 270---------------- 90 +x
|
|
0 +y

This seems like a strange coordinate system to use. Am I doing something wrong? If this is correct, how can I convert my calculations to this coordinate system? (compass degrees):

Code:
0 +y
|
|
-x 270---------------- 90 +x
|
|
180 -y

View 4 Replies View Related

C++ :: Which Object Draw Is Being Called In Case Of Pointer Pointing To NULL

Apr 12, 2013

[URL] ....

Which object's draw is being called?

View 6 Replies View Related

C :: Linked List Programming To Find Cartesian Coordinate

Jan 7, 2014

I am very much new to C programming. However, I have an assignment regarding linked list.

Problem Statement is: Using linked list store the coordinates of four cartesian points and then find the coordinates having longest distance from its origin.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved