C++ :: Saving Moving Objects?

Nov 1, 2013

I'm trying to serialize and deserialize objects, some static (that works) one moving (doesn't work). In the code you can see that the following int-variables discribe the moving circle:

object->phaseFarbe=phase1;
object->phaseKoord=phase;
object->rot=a;

[Code].....

View 1 Replies


ADVERTISEMENT

C++ :: Moving Objects To Shared Memory

Feb 9, 2013

I am not so experianced with c++ myself, but I need to evaluate if a certain idea might work.

I am working with a system for automation purposes that is running on a realtime OS in parallel to windows. Windows and the RTOS exchange data via shared memory. The application in the RTOS is compiled in C++. Now I would like to be able to influence the some data manipulation tasks in the RTOS application without changing the code of the RTOS application. So a concept like calling a dll.

My idea was to create a class with virtual methods in the RTOS application. The objects that are used should then be created on the Windows side with the same class prototype, but specific implementation of the virtual methods. The objects should then be moved to the shared memory, where they are used by the RTOS application.

Is something like this possible or am I completly on the wrong path?

View 4 Replies View Related

C/C++ :: Creating Moving Objects For 2D Game

Oct 21, 2014

I'm working on designing a game in C++ that is similar to the "find the ball under the cup" game. I have a Sonic the Hedgehog icon (weird I know, but it was the first thing that came to mind) that will be hidden underneath one of three rectangular blocks.

Here is how I envision this working:

On the main menu I have 3 buttons which represent 3 different difficulty levels
Easy- blocks move 3 times at a slow speed
Medium- blocks move 5 times at a slightly faster speed
Hard- blocks move 10 times at a fast speed

When the user clicks one of these buttons they will be taken to the game screen.

Sonic will be displayed for 3 seconds and the user will then see him be covered with one of the three blocks.

The three blocks will then move in a random pattern along the middle of the screen at the speed and number of times associated with the button that was pressed.

Once the blocks stop moving, the user is to click on the one they think Sonic is underneath.

If they choose correctly, they'll be taken to a "Winning Screen" that displays a congratulatory message and 2 buttons. Play Again- returns the user to the main menu and the game starts over with a new random pattern. Quit- the window closes.

If they choose incorrectly, they'll be taken to a "Losing Screen" that displays a "Try Again" message and 2 buttons that have the same function as the buttons on the winning screen.

I have never worked with any kind of graphics before other than in HTML and Javascript. I have managed to create the main menu, but how to do the actual game portion of the project. I've been trying to take it a step at a time, (for example, I first figured out how to set the background color for the console window, after I got that right I figured out how to add buttons) but the rest of this seems to depend on each other.

Here is what I have so far:

Main menu:

#include "stdafx.h"
#include <iostream>
#include <Windows.h>
using namespace std;
class MainMenu

[Code]....

So I've got the screens pretty much designed now (with the exception of the game screen itself) but how to tie everything together.

In case my description wasn't too clear, here is a game that I found on Google that is pretty much exactly what I'm looking for. [URL]

View 2 Replies View Related

C/C++ :: Saving Objects On Binary File

Feb 11, 2013

Fix this code? the result is Garpish>>

<iostream>
#include<fstream>
using namespace std;
class Student {
public:
    char name[10];
    char address[10];

[Code] ....

View 6 Replies View Related

C# :: Making Moving Button Or Moving Picture Box Clickable?

Jun 13, 2014

i want to make moving button or moving box clickable as i am making a game in which i move picture boxes and user clicks on it and his scores increases. but i was unable to do so , so i tried the same concept with buttons but no results.

View 7 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++ :: Moving In A Circle

Apr 15, 2014

I'm making this program to mess with people and make them think its a virus.

#define _WIN32_WINNT 0x0500 //For hiding your console
#include <cstdlib>
#include <iostream>
#include <Windows.h>
#include <WinBase.h>

[Code]....

At line 42 and 43 I want to make the cursor move around in a circle over and over again but I'm not sure how.

View 4 Replies View Related

C++ :: Moving Object In Array

Nov 30, 2014

I want to make an object in array[][] move

Ex:
array[2][5]
array[0][0] = 'O'

O| | | | |
| | | | |
| | | | |

then
|O| | | |
| | | | |
| | | | |

then
| |O| | |
| | | | |
| | | | |

......

how can i print my array in console then change&print it again, then change&print it again,... So it look like O is moving
???

View 1 Replies View Related

C++ :: Moving Character Up / Down And Left / Right

Apr 28, 2013

I have a board where a character is. I need to ask the user whether they want to move it up, down, left right. They are allowed to enter 3 move per turn. like up, up, left. How do I do this?

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

const int COL = 17;
const int ROW = 17;

[Code] .....

View 3 Replies View Related

C++ :: Moving The Head Of Array

Mar 19, 2014

Basically, my function receives an array. For example:

u8 array = {1, 2, 3, 4, 5}

I don't need the first 2 elements, how can I access the array's 3rd element as head? I plan to throw the received array to another function.

array = array[2];
somefunc(array);

Will somefunc get index 2 as start of the array?

View 1 Replies View Related

C++ :: Moving Elements In An Array?

Dec 20, 2013

im trying to get my array to display 5,1,2,3,4 from the original 1,2,3,4,5.

void values::movevalues()
{
cout << "postcondition
";

[Code]....

something in this part is making it go wrong, it displayes the original array fine but when it tries to shift it it goes haywire. EDIT: also how would i add elements onto the array?

View 10 Replies View Related

C/C++ :: Randomly Moving Characters

Jan 6, 2015

I am making a game and I am attempting to get the zombies to move randomly but for the life of me, I simply don't have the knowledge with srand to do it

#include <iostream>
#include <windows.h>
#include <time.h>

[Code].....

View 13 Replies View Related

C++ :: Moving A Button And Image With Each Other?

Jan 12, 2015

The question says:

Place an Image on top of a Button. Move both when the Button is pushed.

It's here [URL] exercise no.3

look at this code:

#include <GUI.h>
using namespace Graph_lib;
//------------------------------------------------
class rotation : public Window {
public:
rotation(Point xy, int w, int h, const string& title):

[code]....

The problem is that, it is not possible to define an Image in public/private part of the class rotation. Image needs all arguments to be supplied even when declaring one. (Image is here [URL] And if I define that Image in the body of main() function, so how to provide access for void rotate() to change its position with the position of button simultaneously.

View 8 Replies View Related

C++ ::  SDL2 / Player Not Moving Constantly

Feb 16, 2015

Im using SDL2 but I'm encountering an unexpected error. I have implemented the same method to move as in my old Projects, but the Player appears to be stuck...

The Player is stuck for maybe half a second, and then everything works as it should, but every time I Change direction or i start moving the Player is stuck for a short Moment.

#ifndef _PLAYER_HPP_
#define _PLAYER_HPP_
#include <iostream>
#include <string>
#include "SDLGameObject.hpp"
class CPlayer : public CSDLGameObject

[code]....

View 9 Replies View Related

C++ :: Moving Elements In Array And Displaying

May 21, 2013

This is for a class project. I am having trouble "pulling out" the last element in my array, shifting all the elements back then inserting that last value in the front. Then also displaying the array after the shift. here's my code.

#include "stdafx.h"
#include<iostream>
using namespace std;

[Code].....

View 3 Replies View Related

C/C++ :: Moving N Disks - How To Get Number To Reset To Zero

Apr 6, 2014

I need the number of moves to reset to zero every time because right now when when i enter the next number of disks the moves from before are added to the new set of moves. Here is my output

how many disk are you going to start with? 2

It will take 3 moves
how many disk are you going to start with? 2

It will take 6 moves
how many disk are you going to start with? 2

It will take 9 moves
how many disk are you going to start with? 2

It will take 12 moves
how many disk are you going to start with?

the number of moves for 2 disks should be 3 but as u can see every time i enter 2 disks it just adds to the last number of moves how can i fix this ?

//Purpose: Recursively solve the tower of hanoi problem, moving n disks from A to C.

#include<iostream>
#include<conio.h>
using namespace std;
double number;
void move(int,char,char,char);
//function prototype

[Code] ....

View 2 Replies View Related

C/C++ :: Objects Hold References To Other Objects?

Nov 12, 2014

This has been bothering me for a while now, and I finally put together an example:

#include <iostream>
#include <string>
using namespace::std;

[Code]....

In the code above, the two classes hold pointers to each other, and that's fine but it doesn't seem right since C++ prefers to pass by reference. Yes, it can still do that (see testbox and testball) but even that seems odd to me because still you need to use pointer notation for the enclosed object. Am I the only one who feels this way, and should I just get over it? Or am I missing something that would allow an object to hold a reference?

View 4 Replies View Related

C++ ::  Making A Moving Item Controlled By Using WASD

Mar 21, 2013

I'm working on a personal project with a screen that looks like this:

+++++
+++++
++O++
+++++
+++++

And below that it asks where you want to move. I've done the majority of the work, I just have to figure out how to actually move the O. Here's my source code:

#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;

[Code]....

View 2 Replies View Related

C++ :: String Tokenization - Moving Pointer Ahead

Jul 5, 2014

I know there is strtok() to do the tokenization;but all strtok() examples I have seen only output one token at a time, moving the pointer ahead. Can't the tokens be saved somewhere?

View 6 Replies View Related

Visual C++ :: Moving Cursor With Arrows In Console?

Nov 22, 2012

I have to write tic-tac-toe game in Visual 2010. My only problem is that I don't know how I can move the cursor with arrows in the console in order to fill in chosen positions in 3x3 table:

Code:
_ _ _
_ _ _
_ _ _

I guess that the needed functions are in here: [URL] ....

but I don't know from what to start with...

View 1 Replies View Related

C++ :: Dispatch Message Taking Frames Away While Moving Window

Oct 29, 2014

lets start with the code:

while(run)
{
if (PeekMessage(&msg, win->win_handle,0,0,PM_REMOVE))
{

[Code]......

I have created a basic window and i discovered that while resizing or moving my windows, the myframe() don't get any calls at all.

Is there anyway possible that myframe gets at least someof the calls while those things are happening

View 1 Replies View Related

C# :: Mapped Network Drive - Deleting Or Moving A File

Sep 16, 2014

Currently I'm trying to do something extremely basic: delete or move a file

I have a mapped network drive (Y) where I have a file I need to move from one folder to another

First was doing the obvious:

System.IO.File.Move("Y:TempFile.txt", "Y:Temp2File.txt");

Not much to go wrong here, right? As long as I have the correct permission to write in the folders and the folders exists, this would normally go smooth. But for some reason it only copies the file. The source file still exists, but it has successfully copied the file to the destination folder. No exceptions has been thrown or anything... but the file still exists in the source directory

I then changed the code to the following:

System.IO.File.Copy("Y:TempFile.txt", "Y:Temp2File.txt");
System.IO.File.Delete("Y:TempFile.txt");
Console.WriteLine("See mommy, no Exceptions");

As expected the file copies correctly, but the delete command is completely ignored. The file is not deleted, but the Console.WriteLine command is called

I'm running the application as the logged in user. The user has permission to delete the file. If I try from Windows Explorer, the file is correctly deleted. Unfortunately my application refuses to delete the file and even worse, it will not even throw an Exception.

View 10 Replies View Related

Visual C++ :: Moving Mouse Cursor To Certain Colors On Monitor

Apr 22, 2013

I am currently starting to attempt to make a program that can move my cursor to certain colors on my monitor. The problem is this seems like it will be 10x harder than I first thought.

View 4 Replies View Related

C++ :: Moving Focus In Each Loop Iteration - Directly Come Last Item After Completion

May 17, 2012

I have a strange problem in using C code. I want to move focus from one item to another in a keypress event (like keydown)in loop. But it move directly to the last item

Details: In the code segment, I am generating keypress event explicitly from code and want to move focus for number of items inside loop. Loop is working properly, but output is also generated after completion of loop and focus is directly coming on last item in list not showing intermediate movements. Voice output using espeak is generated correctly in each iteration.

Tryouts: I have tried to call a dilog box which take yes/no event by Btn press,that works fine. That means event generation in code is giving problem, it needs h/w intervention for keypress (As I understood)..

View 10 Replies View Related

C++ :: Make Object Coordinates Moving In Straight Line With Angle Have A Sinus?

Sep 22, 2013

I want to make an object, which moves from x1,y1 to x2,y2 in a straight line, also make a sinus over the line (so the x,0 is the line itself, and cux,cury is the object. So the object will move as a sinus over the line. How do I do this in c++?

View 3 Replies View Related

C :: Saving Into A Txt File

Feb 12, 2014

Code:
#include<stdlib.h>
FILE *Ptr_file;
Ptr_file =fopen("output.txt", "w");
struct person {
char arcFName[50],arcMName[50],arcLName[50],cGender[2];
int nDay[2],nMnth[2],nYear[4];

[Code] .....

Alright I wrote this code, i know there's some mistakes but how do you go about saving its output into a txt file?

View 4 Replies View Related







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