Re: linker error

2010-07-12 Thread Michael P.
j Wrote: > hi, > > can anybody tell me please why the linker keeps bringing up this error > message? i am using the latest dmd 2. > > thank you > > OPTLINK (R) for Win32 Release 8.00.2 > Copyright (C) Digital Mars 1989-2009 All rights reserved. > http://www.digitalmars.com/ctg/optlink.html >

din.readf("%s", &floattype) should work?

2010-01-29 Thread Michael P.
Is din.readf (from std.cstream in Phobos) able to read floats when using %s as the format specifier? When I used this: din.readf( "%s", &somedouble ); somedouble will still be nan after receiving input from the user. But when I use: din.readf( "%f", &somedouble ); everything goes as planned. Is th

Re: c to d: types + struct/union alignment

2009-12-30 Thread Michael P.
BCS Wrote: > Hello Michael P., > > > I'm converting some C headers into D, and had some questions. > > 1. What is the equivalent of a 'short int' in D? > > e.g: > > struct ScePspSRect { > > short int x; > > short int y; > &

c to d: types + struct/union alignment

2009-12-30 Thread Michael P.
s32; typedef int64_t s64; Would it be okay to be make/alias all of the uintxx_t to 'uint' and all of the intxx_t to 'int'? P.S. If anyone is wondering, this is taken from the homebrew PSP SDK. Thanks, Michael P.

Re: deleting items from 2d arrays

2009-08-14 Thread Michael P.
Daniel Keep Wrote: > > > Michael P. wrote: > > Okay, so I'm making a breakout type game in D. Using Derelict. > > I have a 2d array of Block type variables(not important what's in them) > > declared like this: > > Block[][] level; > > and

deleting items from 2d arrays

2009-08-13 Thread Michael P.
foreach( Block b; ba ) { if( checkCollision( ball, b.p ) ) { //remove the block?? } } } The level array has 12 lines of 'x' amount of bricks. x can be as great as 10. -Michael P.

Re: Error: conversion, reading from file

2009-07-19 Thread Michael P.
bearophile Wrote: . > > Try: > import std.string: strip; > ... > highScoreList ~= toInt(strip(file[0 .. nextScore])); > > I have never understand the rationale of not ignoring whitespace inside the > toInt, I think it's an ugly design. > > Bye, > bearophile That didn't work for me. Doing this

Error: conversion, reading from file

2009-07-19 Thread Michael P.
I've having some trouble reading from a file. I am trying to read a list of high scores, each on a separate line, like this: 440 0 0 0 0 But with my code, I get an error saying: Error: conversion. Code: //Load high scores char[] file; int[] highScoreList; int nextScore; file = cast(char[])read(

Re: dmd on ubuntu installation

2009-05-11 Thread Michael P.
Jarrett Billingsley Wrote: > On Sun, May 10, 2009 at 10:17 PM, grauzone wrote: > > > The files are probably not readable (r) or executable (x) by all other users > > (o). Try "chmod o+rx /usr/local/bin/dmd". > > Of course, prepend 'sudo' :| That worked. Thanks for everyone's help. :)

Re: dmd on ubuntu installation

2009-05-10 Thread Michael P.
Michael P. Wrote: > Mike Parker Wrote: > > > Michael P. wrote: > > > Frits van Bommel Wrote: > > > > > >> Michael P. wrote: > > >>> But when I type dmd in the terminal, I get this: > > >>> > > >>> mich...@u

Re: dmd on ubuntu installation

2009-05-10 Thread Michael P.
Mike Parker Wrote: > Michael P. wrote: > > Frits van Bommel Wrote: > > > >> Michael P. wrote: > >>> But when I type dmd in the terminal, I get this: > >>> > >>> mich...@ubuntu:~$ dmd > >>> bash: /usr/local/bin/dmd

Re: dmd on ubuntu installation

2009-05-10 Thread Michael P.
Frits van Bommel Wrote: > Michael P. wrote: > > But when I type dmd in the terminal, I get this: > > > > mich...@ubuntu:~$ dmd > > bash: /usr/local/bin/dmd: Permission denied > > mich...@ubuntu:~$ > > > > Do you know why? > > Looks like y

Re: dmd on ubuntu installation

2009-05-10 Thread Michael P.
Jesse Phillips Wrote: > > As for doing this by hand. The two directories you are interested in are > src/ and linux/ the others are just manuals and other operating systems. > > copy the files found in linux/ to /usr/local/ > > copy src/phobos to /usr/local/include/ > > With this you'd need to

dmd on ubuntu installation

2009-05-10 Thread Michael P.
Okay, I've been trying to install DMD on Ubuntu for a while, but I just can't get it. Is there an up to date guide on installing DMD on Ubuntu? I'm new to Linux too. :P I've tried quite a bit of googling, and found some stuff, but quite a bit of it won't work with the latest release, where there

Re: project euler #10: optimization with primes

2009-04-01 Thread Michael P.
Spacen Jasset Wrote: > Michael P. wrote: > > Hey, I've started to do some of the problems on Project Euler to practice > > my programming skills. I'm doing #10 right now, and I think I've got a > > working solution. It's just that it'

project euler #10: optimization with primes

2009-03-31 Thread Michael P.
Hey, I've started to do some of the problems on Project Euler to practice my programming skills. I'm doing #10 right now, and I think I've got a working solution. It's just that it's way too slow. Here's the link: http://projecteuler.net/index.php?section=problems&id=10 The code works fine with s

Re: input

2009-01-30 Thread Michael P.
naama Wrote: > How am I get a integer nimber from the user? (readln()?) > > the command line is: > ??? import std.cstream; int number; din.readf( "%d", &number );

Re: .bat file to help compile easier - dmd/build

2009-01-03 Thread Michael P.
torhu Wrote: > On 02.01.2009 22:21, Jarrett Billingsley wrote: > > On Fri, Jan 2, 2009 at 2:17 PM, Michael P. wrote: > >> Okay, so right now, I'm making a small game(Mario) using DAllegro. I use > >> build, and every time, I have to type this in to compile my

Re: .bat file to help compile easier - dmd/build

2009-01-02 Thread Michael P.
Jarrett Billingsley Wrote: > On Fri, Jan 2, 2009 at 2:17 PM, Michael P. wrote: > > Okay, so right now, I'm making a small game(Mario) using DAllegro. I use > > build, and every time, I have to type this in to compile my progress: > > > > build mario alleg.lib &g

.bat file to help compile easier - dmd/build

2009-01-02 Thread Michael P.
Okay, so right now, I'm making a small game(Mario) using DAllegro. I use build, and every time, I have to type this in to compile my progress: build mario alleg.lib Now, I know it's not a lot of typing. But considering I type mario wrong every so often, and I generally want to execute it after,

Re: dynamic array of strings

2008-12-30 Thread Michael P.
>Well, let's go through the code. > > First of all, you should undestand that an array is nothing but a pair of > pointer to first element and its length. > > Since char[] == string in D1, let's use string instead to make code slightly > more readable. > > string[] names; // array of strings t

Re: dynamic array of strings

2008-12-30 Thread Michael P.
Denis Koroskin Wrote: > On Tue, 30 Dec 2008 20:23:07 +0300, Michael P. wrote: > > > Denis Koroskin Wrote: > > > >> On Tue, 30 Dec 2008 18:56:08 +0300, Michael P. > >> wrote: > >> > >> > Jarrett Billingsley Wrote: > >> >

Re: dynamic array of strings

2008-12-30 Thread Michael P.
Denis Koroskin Wrote: > On Tue, 30 Dec 2008 18:56:08 +0300, Michael P. wrote: > > > Jarrett Billingsley Wrote: > > > >> On Mon, Dec 29, 2008 at 10:36 PM, Michael P. > >> wrote: > >> > import std.stdio; > >> > import std

Re: dynamic array of strings

2008-12-30 Thread Michael P.
Jarrett Billingsley Wrote: > On Mon, Dec 29, 2008 at 10:36 PM, Michael P. wrote: > > import std.stdio; > > import std.cstream; > > void main() > > { > > char[][] names; > > char[] currentName; > > while( true ) > > { > >d

dynamic array of strings

2008-12-29 Thread Michael P.
//names array? new statement? .length? } } foreach( name; names ) { writefln( name ); } } How would I go about dynamically allocating memory for the names array in the part that I commented? I'm not really sure about the dynamic array details in D, this is just an example to help. -Michael P.

why the array bounds array

2008-12-07 Thread Michael P.
j = 0; j < NUMBER_OF_TILES_HEIGHT; j++ ) { tiles[ i ][ j ] = cast( char )( rand() & TYPES_OF_TILES ); //occurs here } } So, I'm not really sure why it's happening Anyone mind shedding some light on why? -Michael P.

Re: why the array bounds error

2008-12-07 Thread Michael P.
Michael P. Wrote: > Okay, I'm getting an array bounds error, and I have no clue why. Here is the > code that affect it: > > //Constants > const int SCREEN_WIDTH = 640; > const int SCREEN_HEIGHT = 480; > const int TILE_WIDTH = 20; > const int TILE_HEIGHT = 20; //h

Re: linker errors with class

2008-10-26 Thread Michael P.
Mike Parker Wrote: > Michael P. wrote: > > BCS Wrote: > > > >> Reply to Michael P., > >> > >>> I'm getting an undefined reference error with Derelict and SDL. > >>> I tried to create an SDLImage class, but I got an error when the fi

Re: linker errors with class

2008-10-25 Thread Michael P.
BCS Wrote: > Reply to Michael P., > > > I'm getting an undefined reference error with Derelict and SDL. > > I tried to create an SDLImage class, but I got an error when the files > > try to link together. > > I've attached the two .d files in a rar. >

linker errors with class

2008-10-25 Thread Michael P.
have compiled other SDL programs, so everything is set up properly with Derelict. -Michael P. Error Package.rar Description: application/rar