Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: 1 ... 5 6 [7] 8 9 ... 11   Go Down

Author Topic: Programming Q&A  (Read 31393 times)

0 Members and 1 Guest are viewing this topic.
Re: Programming Q&A
« Reply #120 on: September 06, 2008, 02:21:39 pm »
  • If not now, when?
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 520
Darklight: My personal preference for C# is .NET 2.0. It contains all the nice and well-needed updates (generic classes, etc...) and is the last version to be supported on the old Windows operating systems (Windows 2000/ME/98).

The newer versions appear to be mainly targeted at Vista (with most of the additional features being for Vista compatibility). There doesn't appear to be any major functionality that you would lose by using .NET 2.0, and you can potentially support the older versions of Windows if you have to.

It all depends on what you need.
Logged
Re: Programming Q&A
« Reply #121 on: September 07, 2008, 01:54:51 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3374
Darklight: My personal preference for C# is .NET 2.0. It contains all the nice and well-needed updates (generic classes, etc...) and is the last version to be supported on the old Windows operating systems (Windows 2000/ME/98).

The newer versions appear to be mainly targeted at Vista (with most of the additional features being for Vista compatibility). There doesn't appear to be any major functionality that you would lose by using .NET 2.0, and you can potentially support the older versions of Windows if you have to.

It all depends on what you need.
yeah, I should have really said I wanted to support at least XP/vista.
Thanks, I just wasn't sure how much functionality I'd loose by using an older version of .NET.
Logged
Quote from: Jason
Your community is a bunch of stuck up turds.

Xiphirx

wat
Re: Programming Q&A
« Reply #122 on: September 08, 2008, 01:08:57 am »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
Code: [Select]
SuperStrict
'//Set Up ----------------------------------------------------//
'--------//Create a list of all active objects
Global ObjList:TList=CreateList()
'--------//Set the Graphical window up
Global ScreenWidth:Int = 420
Global ScreenHeight:Int = 272
Graphics ScreenWidth, ScreenHeight, 0
SetGraphicsDriver GLMax2DDriver()

'//Intro Credit screen ---------------------------------------//
Local i:Float = 0
Local titleimage:TImage = LoadImage("GFX\startup.png", FILTEREDIMAGE)
SetBlend ALPHABLEND
For i = 0 To 1 Step .1
SetAlpha i
If KeyDown(KEY_ESCAPE) Or AppTerminate() End
DrawImage(titleimage, 0, 0)
Next

SetAlpha 1
Cls
SetBlend SOLIDBLEND

"Unhandeled Exception: Attempt to access field or method of null object"

???
Logged
  • For The Swarm
Re: Programming Q&A
« Reply #123 on: September 08, 2008, 01:16:27 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
Wow, that has so many errors in it I don't know where to start. The thing probably causing your error though is that it can't find GFX\startup.png
Logged

Xiphirx

wat
Re: Programming Q&A
« Reply #124 on: September 08, 2008, 01:22:02 am »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
Wow, that has so many errors in it I don't know where to start. The thing probably causing your error though is that it can't find GFX\startup.png

No the LoadImage is correct, startup.png is located in GFX.

BTW, Infini, this is my 2nd time using it, not as my second time attempting, this is actually my second time opening MaxIDE.

It has a bunch of errors, probably all of those useless global declarations, but I will fix that later.
Logged
  • For The Swarm
Re: Programming Q&A
« Reply #125 on: September 08, 2008, 01:23:17 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
It may be there but is it being loaded. Stick a debugstop directly after the loadimage call and check that titleImage is actually valid.
Logged

Xiphirx

wat
Re: Programming Q&A
« Reply #126 on: September 08, 2008, 01:35:49 am »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
Fixed, it was that driver declaration -_-.
« Last Edit: September 08, 2008, 01:56:09 am by Xiphirx »
Logged
  • For The Swarm

Xiphirx

wat
Re: Programming Q&A
« Reply #127 on: September 22, 2008, 08:47:49 pm »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
Is there any way to stretch an image to a certain width in BlitzMax? the forums and Google don't seem to know.
Logged
  • For The Swarm
Re: Programming Q&A
« Reply #128 on: September 22, 2008, 08:50:03 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
SetScale?
Logged

Xiphirx

wat
Re: Programming Q&A
« Reply #129 on: September 22, 2008, 08:52:29 pm »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
SetScale?

That didn't work. Probably should have said that I tried SetScale. SetScale uses a percentage and I want pixel width not percentage width.

EDIT: I fixed it by making a formula to convert the percentages to pixels >__>
« Last Edit: September 22, 2008, 08:57:33 pm by Xiphirx »
Logged
  • For The Swarm
Re: Programming Q&A
« Reply #130 on: September 22, 2008, 09:14:24 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
u_u. I think thats obvious. You just use something like this;

setscale(float(new_width) / float(image_width), float(new_height) / float(image_height))
Logged
Re: Programming Q&A
« Reply #131 on: September 29, 2008, 04:07:45 pm »
  • Doesn't afraid of anything
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 7002
Got some array and pointer dickery going on here..

Code: [Select]
template <typename T> void HVSTDAT<T>::addData(T data)
{
tempData = new T[dataCount]; //set up the temp holder

for (int i = 0; i < dataCount; i++)
{
tempData[i] = mainData[i];
}

dataCount++;

delete mainData; //clear out the main data
mainData = new T[dataCount]; //recreate it with an extra space

for (int i = 0; i < dataCount - 1; i++)
{
mainData[i] = tempData[i];
}

mainData[dataCount] = data; //put in the new data
delete tempData; //get rid of the temp data
}



template <typename T> void HVSTDAT<T>::listData()
{
for (int i = 0; i < dataCount; i++)
{
std::cout << i + 1 << ": " << mainData[i] <<"\n";
}
}


int main()
{

int x = 4;
int p = 2;
HVSTDAT<int> test(x);
test.addData(p);
test.listData();
system("pause");
return 0;
}

2 functions there using a pointer and an array to hold some data and output it.  Going by the main function, the output should be:

Quote
1: 4
2: 6

well, here's the output...

Quote
1: 4
2: -842150451

umm... -842150451 != 6   I've gone through the functions too many times, I can't figure out what's wrong.

wat.

EDIT: Had a variable error, fixed.
« Last Edit: September 29, 2008, 05:29:25 pm by MG-Zero »
Logged



i love big weenies and i cannot lie

Xiphirx

wat
Re: Programming Q&A
« Reply #132 on: October 12, 2008, 12:05:24 am »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
Code: [Select]
function GetContent(url, method, place, params)
{
switch (method){
case "GET":
var kl = window.location.href.indexOf("?",0);
lastpage = window.location.href.substr(kl);
document.getElementById(place).innerHTML = "<center>Loading, please wait...<br /><img src='load.gif' /></center>";
thing = new DICKBUTT();
thing.open("GET", url, true);
glb_location = place;
thing.onreadystatechange = updatePage;
thing.send(null);
lastpage = GetDo();
break;
case "POST":
document.getElementById(place).innerHTML = "<center>Your request is being processed, please wait...<br /><img src='load.gif' /></center>";
thing = new DICKBUTT();
thing.onreadystatechange = updatePage;
thing.open("POST", url, true);
thing.setRequestHeader("Content-type", "applicationx-www-form-urlencoded");
thing.setRequestHeader("Content-length", params.length);
thing.setRequestHeader("Connection", "close");
glb_location = place;
thing.send(params);
break;
}
}

function SubmitShout(form)
{
alert("1");
var message = form.message.value;
var name = form.name.value;
var check = 0;
alert("2");
if (name.length < 3)
{
form.name.className = 'error';
check = 1;
return false;
}
alert("3");
if (message.length < 3)
{
form.message.className = 'error';
check = 1;
return false;
}
alert("4");
alert("5");
if (check === 0) {
var zeparams = "message="+message+"&name="+name;
GetContent("shoutbox.php", "POST", "shoutform", zeparams);
return false;
}
return false;
}

The POST request does not work... Anything look wrong? I have gone through it many times :S

Also, you may see a ton of alerts, well that is for debugging, and it goes to 5
Logged
  • For The Swarm
Re: Programming Q&A
« Reply #133 on: October 19, 2008, 06:21:12 pm »
  • Doesn't afraid of anything
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 7002
Is there a way to convert a char value into into an int, double, or float in C++?  I don't mean grabbing it's ascii value, I mean turning it into an actual number.  I.E. if the char value was "1.5", is there a way to put that value into a double?  I basically need a cdbl() function like in Basic..
Logged



i love big weenies and i cannot lie
Re: Programming Q&A
« Reply #134 on: October 19, 2008, 06:25:24 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
Is there a way to convert a char value into into an int, double, or float in C++?  I don't mean grabbing it's ascii value, I mean turning it into an actual number.  I.E. if the char value was "1.5", is there a way to put that value into a double?  I basically need a cdbl() function like in Basic..
Come again? Do you mean converting a character string into a value? If so, read up on atoi, atof and atol.
« Last Edit: October 19, 2008, 06:59:23 pm by Infini »
Logged
Re: Programming Q&A
« Reply #135 on: October 19, 2008, 06:57:27 pm »
  • Doesn't afraid of anything
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 7002
yes, exactly.  I'll look into those, thanks.

But now I've got another problem.  I'm working with some streams, but the damn files keep truncating when I open them.

Code: [Select]
IOData.inFile.open(fileName);
inFile is an ifstream instance.  How do I stop them from truncating?
Logged



i love big weenies and i cannot lie
Re: Programming Q&A
« Reply #136 on: October 19, 2008, 07:02:23 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
If reading;
Code: [Select]
IOData.inFile.open(fileName, ios_base::openmode::in);

If appending;
Code: [Select]
IOData.inFile.open(fileName, ios_base::openmode::out | ios_base::openmode::app);

Not checked mind you. Should work though.
Logged
Re: Programming Q&A
« Reply #137 on: October 19, 2008, 07:08:45 pm »
  • Doesn't afraid of anything
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 7002
Nope, didn't work  :(
Logged



i love big weenies and i cannot lie
Re: Programming Q&A
« Reply #138 on: October 19, 2008, 07:42:22 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
Nope, didn't work  :(
Looks like your doing something wrong then. Post full code please.
Logged
Re: Programming Q&A
« Reply #139 on: October 20, 2008, 01:06:47 am »
  • Doesn't afraid of anything
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 7002
It's fixed.  Someone over at gamedev pointed out my error...I used = in an if statement instead of == -.-  Well, don't I feel dumb now.
Logged



i love big weenies and i cannot lie
Pages: 1 ... 5 6 [7] 8 9 ... 11   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.22 seconds with 75 queries.

anything