[QUOTE=Confuzzed Otto;37032827]I know, I just forgot to put the script after java. What's the difference though?
I'm trying to learn to make small and simple 2d games as a start but first I need to learn a language (I think). Someone said javascript and I tried it, but are there any better ones to use?[/QUOTE]
To put it simply, Java is a programming language that is compiled to byte code and run on a virtual machine and Javascript is an embeddable scripting language commonly used in web browsers.
I'm a bit confused about this, and I couldn't find anything on this when I searched for it, so I'm going to ask here (I hope it's not the wrong section)
For BareMetal OS .app programming, how do I copy the app files to the BareMetal node?
[QUOTE=Chris220;37032858]The difference is that Java and Javascript are two entirely different languages, just like how C++ and Java are two entirely different languages. And no, I don't really know why they have such similar names.[/QUOTE]
When javascript was being created, java was the big thing and thus they called the new languagee javascript to take advantage of javas popularity
So wich one should I learn and how do I use to the best way/learn it in order to make an app-like game but on the computer?
I'm programming a notepad but the redo function doesn't work at all.
[code]private void redoAction()
{
// Determines if a Redo operation can be performed.
if (richTextBox1.CanRedo == true)
{
// Determines if the redo operation deletes text.
if (richTextBox1.RedoActionName != "Delete")
{
// Performs the redo operation.
richTextBox1.Redo();
// Updates status strip on bottom of screen
statusStripState.Text = "Action Redone";
}
}
}[/code]
I'm still new with programming so I copied from the msdn page [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.redo.aspx"]here[/URL] (except the part about updating the status strip). Each undo button calls this method when clicked to avoid having this same piece of code copied over 3 times. When I press the redo button after pressing the undo button, it does nothing, not even update the status strip state label. I tried pulling just that part (the redo and status update parts) first out of the inner if-statement and it still didn't work. Then I pulled it out of both of the if-statements and the status update will then work but it still won't redo. If it's of any importance, I copied my undo method from [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.undo.aspx"]an msdn page[/URL] aswell and that works just fine. Ctrl+z and ctrl+y work just fine too. Why won't this work?
[QUOTE=Chris220;37032858]And no, I don't really know why they have such similar names.[/QUOTE]
Because Brendan Eich wanted them to.
[QUOTE]JS had to 'look like Java' only less so, be Java’s dumb kid brother or boy-hostage sidekick.[/QUOTE]
He even made a big stink about the name "ECMAScript" that came later; I love that name because it removes all ambiguity (except that JavaScript is technically a specific dialect of ECMAScript.)
[editline]1st August 2012[/editline]
[QUOTE=Pelf;37034827]I'm programming a notepad but the redo function doesn't work at all.
[code]private void redoAction()
{
// Determines if a Redo operation can be performed.
if (richTextBox1.CanRedo == true)
{
// Determines if the redo operation deletes text.
if (richTextBox1.RedoActionName != "Delete")
{
// Performs the redo operation.
richTextBox1.Redo();
// Updates status strip on bottom of screen
statusStripState.Text = "Action Redone";
}
}
}[/code]
I'm still new with programming so I copied from the msdn page [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.redo.aspx"]here[/URL] (except the part about updating the status strip). Each undo button calls this method when clicked to avoid having this same piece of code copied over 3 times. When I press the redo button after pressing the undo button, it does nothing, not even update the status strip state label. I tried pulling just that part (the redo and status update parts) first out of the inner if-statement and it still didn't work. Then I pulled it out of both of the if-statements and the status update will then work but it still won't redo. If it's of any importance, I copied my undo method from [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.undo.aspx"]an msdn page[/URL] aswell and that works just fine. Ctrl+z and ctrl+y work just fine too. Why won't this work?[/QUOTE]
This is a stupid question, but is your text box named richTextBox1 or something else?
[QUOTE=ShaunOfTheLive;37037333]He even made a big stink about the name "ECMAScript" that came later; I love that name because it removes all ambiguity (except that JavaScript is technically a specific dialect of ECMAScript.)[/QUOTE]
Is it a superset or a subset, though?
Hey guys. I wanted to make a function that inserts stuff into an empty space in a map and then returns the position.
[cpp]typedef map<int, physBody*> bodymap;
int bodymap::put(physBody *val)
{
int key = 1;
while((*this)[key]!=NULL){key++;}
(*this)[key]=val;
return key;
}[/cpp]
GCC gives me an error:
[code]specializing member 'std::map<int, physBody*>::put' requires 'template<>' syntax[/code]
I don't know anything about templates. Help?
Because this is kind of weird to explain, let's show you what I mean. This is in my game. When I import this base ship model, it should be at (1000,1000,1000), but the model acts like it's at (1000,1000, 0). Note it is positioned correctly when I use a .x model. So it has to be the model. I need to know what's wrong with it.
Here is the model file, tell me if anything is wrong with it: [url]https://dl.dropbox.com/u/92848165/station2.FBX[/url]
[url]http://i.imgur.com/VsjH8.jpg[/url]
EDIT: The model works if you import it into Google Sketchup...but you lose the textures, not very nice.
[QUOTE=Nikita;37040082]Hey guys. I wanted to make a function that inserts stuff into an empty space in a map and then returns the position.
[cpp]typedef map<int, physBody*> bodymap;
int bodymap::put(physBody *val)
{
int key = 1;
while((*this)[key]!=NULL){key++;}
(*this)[key]=val;
return key;
}[/cpp]
GCC gives me an error:
[code]specializing member 'std::map<int, physBody*>::put' requires 'template<>' syntax[/code]
I don't know anything about templates. Help?[/QUOTE]
You can't add members to inbuilt classes like that.
[QUOTE=Jookia;37040347]You can't add members to inbuilt classes like that.[/QUOTE]
I can't? :(
What kind of storage should I use instead? What I need is:
- dynamically expand for more elements
- random access and if I get a pointer to an element, that pointer stays valid forever.
- some way to do "for each", or at least for(int i = 0; i<size;i++)
- a way to insert an element and get a pointer to it inside the storage.
Maybe I should abandon dynamic expansion and just use ordinary arrays. Like ' PhysBody *AllPhysBodies[2000] ', and then write an "insert" function myself.
[QUOTE=Nikita;37040430]I can't? :([/QUOTE]
No.
[QUOTE=Nikita;37040430]What kind of storage should I use instead? What I need is:
- dynamically expand for more elements
- random access and if I get a pointer to an element, that pointer stays valid forever.
- some way to do "for each", or at least for(int i = 0; i<size;i++)
- a way to insert an element and get a pointer to it inside the storage.
Maybe I should abandon dynamic expansion and just use ordinary arrays. Like *physBody[2000], and then write an "insert" function myself.[/QUOTE]
std::vector.
When I erase an element from a vector, the pointers to any element inside the vector break, and the indices are no longer valid.
[QUOTE=Nikita;37040604]When I erase an element from a vector, the pointers to any element inside the vector break, and the indices are no longer valid.[/QUOTE]
You store pointers to your objects as the vector's members. These will never 'break'. You don't want anything to reference the memory location of the vector's member (which is a pointer to a pointer), instead you want to use the actual memory location of the member.
eg; physBoxy *pMember = myVector[i]; //pMember will be valid assuming you haven't deleted it previously.
Oh. Right. I'm making it way more complex than it needs to be. I'll use a vector then.
Does anybody happen to know how to add a program to the windows installed software list? I wan't to be able to delete/uninstall my program through that list.
[QUOTE=0lenny0;37041008]Does anybody happen to know how to add a program to the windows installed software list? I wan't to be able to delete/uninstall my program through that list.[/QUOTE]
Well, it's stored in the registry at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall". I guess you could look at how other programs are stored there and do the same for yours.
But if you're making an installer, don't edit the registry directly. I'm pretty the Windows Installer framework supports creating those entries automatically based on declarations in your .msi file.
Another question: If I have multiple pointers to some object, and I delete the object, there will be lots of dangling pointers.
Is there a way to set all those pointers to 0 when that happens?
[QUOTE=Nikita;37044074]Another question: If I have multiple pointers to some object, and I delete the object, there will be lots of dangling pointers.
Is there a way to set all those pointers to 0 when that happens?[/QUOTE]
Have the object itself book-keep all pointers to it, and then set those pointers to 0 in its destructor? ( There are probably much better/orthodox/obvious ways to do this, I'm still pretty new here )
Not with plain pointers, but [url=http://en.cppreference.com/w/cpp/memory/weak_ptr]std::weak_ptr[/url] does basically what you want. You make some shared_ptrs and some weak_ptrs that all point to an object, and the object will continue to exist as long as there are any shared_ptrs to it. When all the shared_ptrs are gone, the object is destroyed and the weak_ptrs are marked as expired so your code can see that they're no longer valid.
[editline]1st August 2012[/editline]
Of course, you could write your own smart-pointer class, but it's easier and safer to use the standard one.
Don't forget faster. Those compiler writers are pretty clever.
[QUOTE=esalaka;37038423]Is it a superset or a subset, though?[/QUOTE]
It's a superset. JavaScript (which is officially only implemented by Mozilla, being owned by Brendan Eich) supports a few extra things over ECMAScript, like [URL="https://developer.mozilla.org/en/JavaScript/Reference/Statements/let"]let[/URL].
(Interestingly, Google calls V8 a "JavaScript" engine on their main V8 page, probably for convenience, but then [URL="http://code.google.com/p/v8/issues/detail?id=890&can=1&q=Javascript%201.8&colspec=ID%20Type%20Status%20Priority%20Owner%20Summary%20HW%20OS%20Area%20Stars"]a bug comment[/URL] confirms that V8 is actually not an implementation of JavaScript, but ECMAScript.)
Forgive me, C++ gods, for I have sinned.
I made my own version of smart pointers: a class that keeps track of all ordinary pointers that point to <instance of any class> and automatically sets them all to zero if they still point to it when the instance gets deleted.
I only did it because I was too lazy to switch between weak and shared pointers...
My notepad program has a settings screen. On the bottom of the main screen there is a status bar which says things like "File Opened" when you open a file and similar things for other actions. I want to make it say "Settings Saved" when the user presses the save button on the settings form but I can't figure out how to do it.
[t]https://dl.dropbox.com/u/13781308/NotepadError.png[/t]
Code for the settings window:
[CODE]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NotepadSharp.Properties;
namespace NotepadSharp
{
public partial class SettingsForm : Form
{
public SettingsForm()
{
InitializeComponent();
}
private void buttonSave_Click(object sender, EventArgs e)
{
Settings.Default.Save();
NotepadForm.statusStripState.Text = "Settings Saved";
this.Close();
}
}
}
[/CODE]
This is probably a stupid question but I have no idea what to do.
[QUOTE=Nikita;37045871]Forgive me, C++ gods, for I have sinned.
I made my own version of smart pointers: a class that keeps track of all ordinary pointers that point to <instance of any class> and automatically sets them all to zero if they still point to it when the instance gets deleted.
I only did it because I was too lazy to switch between weak and shared pointers...[/QUOTE]
Yeah, stop.
[QUOTE=Nikita;37045871]Forgive me, C++ gods, for I have sinned.
I made my own version of smart pointers: a class that keeps track of all ordinary pointers that point to <instance of any class> and automatically sets them all to zero if they still point to it when the instance gets deleted.
I only did it because I was too lazy to switch between weak and shared pointers...[/QUOTE]
To zero, you say? Tsk, tsk, tsk.
Pretty easy question here:
What compilers/interpreters do you guys recommend for beginners to C++? I'm trying to start with the basic "Hello World!" stuff and I have no console to look at that's being written to.
[QUOTE=Corey_Faure;37052268]Pretty easy question here:
What compilers/interpreters do you guys recommend for beginners to C++? I'm trying to start with the basic "Hello World!" stuff and I have no console to look at that's being written to.[/QUOTE]
Microsoft Visual C++ Express for Windows, GCC for everything else.
[QUOTE=ArgvCompany;37052297]Microsoft Visual C++ Express for Windows, GCC for everything else.[/QUOTE]
This pretty much. Alternatively, clang on other systems, it has more understandable error messages, I believe, at least.
Sorry, you need to Log In to post a reply to this thread.