Seite 323 von 340 ErsteErste ... 223 273 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 ... LetzteLetzte
Zeige Ergebnis 9.661 bis 9.690 von 10174

C/C++ Programming Help Thread

This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I don't use IDE's... can't get to grips with them I prefer to dive into a makefile instead. I'm reading ...

  
  1. #9661
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I don't use IDE's... can't get to grips with them I prefer to dive into a makefile instead.

    I'm reading in binary mode, and theres no line breaks, just a continuous line of "stuff". Check the files to see what I mean.

    I've also noticed another problem, when I hard coded the map files, it loaded the first map file, the second one wouldn't load though it just closed after the first, again this isn't something that happens on Vista. I thought there wasn't supposed to be any differences between C++ on Windows and Linux's standard libraries

    -Aura

    Blah I haven't got a clue what I'm doing, is there any documentation on the website on what to do or something?


    Geändert von Auraomega (02-05-2009 um 04:55 PM Uhr)
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  2. #9662
    QJ Gamer Bronze
    Points: 5.583, Level: 48
    Level completed: 17%, Points required for next Level: 167
    Overall activity: 0%

    Registriert seit
    May 2007
    Beiträge
    127
    Points
    5.583
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    I don't use IDE's... can't get to grips with them I prefer to dive into a makefile instead.
    whats a makefile got to do with using an ide? use both.

    I've also noticed another problem, when I hard coded the map files, it loaded the first map file, the second one wouldn't load though it just closed after the first, again this isn't something that happens on Vista. I thought there wasn't supposed to be any differences between C++ on Windows and Linux's standard libraries
    well I'd wager its more a problem with your code than the standard library.
    but since you are not showing us the code its hard to say. I'd suggest not using any of the *scanf* functions.
    -- Code Monkey : Sarien, Fishguts, Cracks and Crevices --

    "Did IQ's just drop sharply while I was away?" (Ripley)

  3. #9663
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von _df_ Beitrag anzeigen
    whats a makefile got to do with using an ide? use both.



    well I'd wager its more a problem with your code than the standard library.
    but since you are not showing us the code its hard to say. I'd suggest not using any of the *scanf* functions.
    I did show the code, check the spoiler on the first post on this problem, theres also the dump and map files.

    Theres also no problem with my code per se, because it runs fine on Vista, surely cross platform code that runs on Vista would also run on Linux?

    After more work, and with the aid of kuroneko, we've worked out that the y dimension is the one with the problems, the x dimension is read correctly at 48, yet the y always fails to read on my other maps.

    And using fscanf is the easiest and most logical way for me, I'm reading an integer with either 1 or 2 digits, with an x inbetween, so fscanf(FILE, "%ix%i", *xDim, *yDim); seems the best way forward.

    -Aura

    EDIT:
    Slightly modified my code to give a nicer layout in the dump, the new dump is in the spoiler below:
    Spoiler for Dump:

    1.map
    48x0
    1111111111111111111111111 1211111111221111111111111 1111111111111111111111112 2211122112411111111111111 1121111111111111111111111 1111111121114111111111111 1111111111111311211111111 1111111111111111111111111 1111111111111111111111211 1111111114111111111111111 1412111111111111111121111 1112411111111111111111111 1111111111111111112111111 1122111111111111111111111 1111111111111111111111111 2111111111111112211111111 1111111111111111111111241 1111111111111111111111111 1111121221111111111111111 1111111111111111411111111 1111411111111111111111111 1111111111111112111111111 1111111111111111111111111 1111111111111111111111111 1111111111212211111111111 1111111111111111111421111 1111111112411111111111111 1411111111111111111111111 1114111111111111111111111 2111111111111111111111111 1111111111111111111111111 1111111111122111111411111 1211111111111111111111111 1111111111111111124111141 1112221111111111111111111 1111114111121111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 111111111111111111111100

    The first bit is the file name, the second is the x and y dimensions, as you can see x is read correctly but y fails.

    Now the same dump on Vista:

    Spoiler for Dump(Vista):

    1.map
    48x27
    1111111111111111111111111 1211111111221111111111111 1111111111111111111111112 2211122112411111111111111 1121111111111111111111111 1111111121114111111111111 1111111111111311211111111 1111111111111111111111111 1111111111111111111111211 1111111114111111111111111 1412111111111111111121111 1112411111111111111111111 1111111111111111112111111 1122111111111111111111111 1111111111111111111111111 2111111111111112211111111 1111111111111111111111241 1111111111111111111111111 1111121221111111111111111 1111111111111111411111111 1111411111111111111111111 1111111111111112111111111 1111111111111111111111111 1111111111111111111111111 1111111111212211111111111 1111111111111111111421111 1111111112411111111111111 1411111111111111111111111 1114111111111111111111111 2111111111111111111111111 1111111111111111111111111 1111111111122111111411111 1211111111111111111111111 1111111111111111124111141 1112221111111111111111111 1111114111121111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 1111111111111111111111111 111111111111111111111100


    Theres obviously a difference between Windoze and Linux's standard libraries otherwise this would not happen.
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  4. #9664
    QJ Gamer Bronze
    Points: 5.583, Level: 48
    Level completed: 17%, Points required for next Level: 167
    Overall activity: 0%

    Registriert seit
    May 2007
    Beiträge
    127
    Points
    5.583
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    aah I see the code. Ill check it out.

    if your reading bytes with fgetc why not just have

    x = fgetc(mapFile);
    y = fgetc(mapfile);

    and avoid the craptasticness that is scanf set of functions?

    again I'd still vote the problem is not with the linux std libs, if there were it would have been found out by now, but since nobody else is having the same problem with standard fopen/fread/fgetc functions as you are...

    fwiw Im building on linux and windows for psp/gpx/pc on several projects and different machines/versions of windows (2k/xp, mingw,openwatcom,vc) and several flavours of linux without any problems with basic posix functions.
    -- Code Monkey : Sarien, Fishguts, Cracks and Crevices --

    "Did IQ's just drop sharply while I was away?" (Ripley)

  5. #9665
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I agree, but it simply doesn't make sense as to why it works on one system and not another. What I'm saying is I think theres a subtle difference between the two and I'm tripping up this difference.

    As for fgetc, I'm reading either a single or two digit number, which means one or two bytes, fgetc just isn't going to cut it (yes I know I could read it into a string and atoi it). The simple case is, if I'm having this problem then I'd like to know WHAT the problem is so I can avoid it in the future.

    Also, dunno if this is assosiated, but I wanted to compile someone in OGL but couldn't find the libraries and stuff, so I downloaded a NeHe tut and compiled that, except that doesn't seem to run as expected either. It was NeHe lesson 10 with SDL, I've tried compiling on my PC to see if its a code error but it can't find the links to GL_BGR or GL_BGR_EXT so I can't tell whats going on.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  6. #9666
    QJ Gamer Bronze
    Points: 5.583, Level: 48
    Level completed: 17%, Points required for next Level: 167
    Overall activity: 0%

    Registriert seit
    May 2007
    Beiträge
    127
    Points
    5.583
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    As for fgetc, I'm reading either a single or two digit number, which means one or two bytes, fgetc just isn't going to cut it (yes I know I could read it into a string and atoi it). The simple case is, if I'm having this problem then I'd like to know WHAT the problem is so I can avoid it in the future.
    so your using 1 or 2 bytes.. as in 1..99... say 99x99 = 5 bytes..
    you could just use fgetc/fputc and have 255x255 in 2 bytes. fgetc will more than 'cut' it, I just dont think you understand what we are talking about.
    -- Code Monkey : Sarien, Fishguts, Cracks and Crevices --

    "Did IQ's just drop sharply while I was away?" (Ripley)

  7. #9667
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    You're right, I don't have a clue. fgetc returns 1 byte of data, 99x99 is 5 bytes, each dimension would therefore be 2 bytes. Personally I can't see how fgetc is useful here. Maybe you'd like to give me a working example of how to use fgetc to read 2 bytes per dimension?

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  8. #9668
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    The .map files you provided are text files, not binary.

  9. #9669
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Huh, maybe my understanding of text and binary files are wrong but, if its not standard ascii characters and not readable by a text editor, its a binary file right? I mean I'm using 0x01, 0x02 and 0x03 a lot, from what I can see the only text is the first bit with the dimensions.

    And now another problem has cropped up... I hard coded the dimensions, so the map loaded, but the second map fails to load at all. Running the string through a for loop and using sprintf it gives 1.map on the first go, 2.map on the second on Vista, but 11.map on Linux :Argh:

    And now... to make issues even worse, Vista cannot see the folders on the memory card only Ubuntu can... great I can't even show you the code for the for loop -.-

    -Aura

    EDIT:
    Backed up the files and formatted the SD, anyway the code for that loop is below:

    Spoiler for Loop:
    Code:
    for(int stage = 1; !quit; stage++)
    	{
    		finish = 0;
    		char stageName[256];
    		sprintf(stageName, "%i.map", stage);
    		bool level = mapRead(stageName, &xDim, &yDim, map);
    		if(!level)
    		{
    			quit = 1;
    			finish = 1;
    		}
    ...
    Geändert von Auraomega (02-06-2009 um 01:55 PM Uhr)
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  10. #9670
    xMod.
    Points: 4.576, Level: 43
    Level completed: 13%, Points required for next Level: 174
    Overall activity: 0%

    Registriert seit
    Oct 2008
    Ort
    Melbourne, Australia
    Beiträge
    675
    Points
    4.576
    Level
    43
    My Mood
    Daring
    Downloads
    0
    Uploads
    0

    Standard

    any1 got any libCurl examples?

    ~!SlasheR!~

  11. #9671
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    A couple of questions, the bool type, is that only 1 bit, or is it actually a byte (seems most likely) acting as a bit that can only have 2 states (true and false)?

    ASM being hardware specific, does that mean that PC games are not coded in ASM as it would be different for each setup? To inline ASM into a C++ project I should use __asm{ } right?

    Are there any good compression guides out there? I'm looking to add compression to my encryption and a quick Google search didn't return much useful.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  12. #9672
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    Huh, maybe my understanding of text and binary files are wrong but, if its not standard ascii characters and not readable by a text editor, its a binary file right?
    The files that you provided were readable by a text editor. If it wasn't a standard text file, then you wouldn't have been able to use fscanf formatting in the first place.

    Binary files are generally illegible when opened in notepad. A .doc file is binary file. A .txt file is also a binary file. They are just both 'readable' when opened by the right program.

  13. #9673
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    When I open my map files in notepad they won't work, you sure you didn't check my dump? I did dump that in readable format. Well it opens in a text editor, but its just a bunch of white spaces and ¬ at 90 degrees. I thought binary files were anything that didn't contain the standard ASCII letters, or does it cover the full range of ASCII (0-255) even though some don't actually appear on screen?

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  14. #9674
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    I opened 2.map and got
    Code:
    48x27
    Ah, you have data pass the 48x27 which my text editor doesn't show but the copy and paste does. Joy. In which case, it is game on, now I can try it for myself.

    My preliminary guess is that it is reading the bytes after '7' as part of the number until it hits a delimiter (eg a 0 byte). Don't forget the ASCII table values are between 0-255 so technically, every byte in a file can be represented by an ASCII character. As far as fscanf is concerned, it probably sees everything pass the 'x' as one really long string and attempts to convert it to an integer which it can't hence 0?

    Stick a zero byte after the '7' and see what happens.

    If you map sizes are not going to be bigger then 255x255, then you can store the dimensions in the first 2 bytes of the file rather then having it in plain text.
    -=Double Post Merge =-
    Plain text = human readable
    Binary = Not human readable

    Not all of the ASCII table is human readable.
    Geändert von yaustar (02-08-2009 um 02:35 PM Uhr) Grund: Automerged Doublepost

  15. #9675
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I see, sorry its been a while since I saw an ASCII table, after looking at one the last readable value is 127, I had it in my head that it spanned all 256.

    As for the problem, we've discovered the problem, apparently the first map had a corrupted byte at the end, 0x0A, which is unaccounted for, this somehow caused yDim to become 0 on Ubuntu but not on Windows, and I have a feeling its because of a buffer overflow in the read function, after reviewing the code (something I should have done after digging up this half finished project) I noticed that the buffer was also getting the EOF on the end, the buffer was 48*27 - the biggest map size - so when it read 48*27 plus the EOF, it knocked the yDim (I assume) to 0, and also the stage to 0 when the last bit wasn't corrupted, which would also explain why the map continously reset itself to 1.map on Ubuntu but not Windows.

    The subtle difference between to two? I'm assuming its only on memory.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  16. #9676
    QJ Gamer Green
    Points: 4.092, Level: 40
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Beiträge
    508
    Points
    4.092
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Does anybody know a method of using a malloc-type action in kernel mode? It's been driving me insane looking for how malloc in itself would be able to derive from heap functions.
    I gone and made that one power spoofer and that gay cheat device.

  17. #9677
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    In pspsysmem_kernel.h the function void *sceKernelAllocHeapMemory (SceUID heapid, SceSize size); should do what you require.

    You'll have to allocate a heap yourself though, unless anyone here knows how to access already created heaps? You know, like the on you define at the start of your code for KB, can't think of the precompiler for it, or for calling on ones in other modules that you haven't got the address for?

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  18. #9678
    QJ Gamer Green
    Points: 4.092, Level: 40
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Beiträge
    508
    Points
    4.092
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    In pspsysmem_kernel.h the function void *sceKernelAllocHeapMemory (SceUID heapid, SceSize size); should do what you require.

    You'll have to allocate a heap yourself though, unless anyone here knows how to access already created heaps? You know, like the on you define at the start of your code for KB, can't think of the precompiler for it, or for calling on ones in other modules that you haven't got the address for?

    -Aura
    Fair enough, a macro for that wouldn't be hard.

    HEAP_SIZE_KB I believe is the word you're looking for.
    I gone and made that one power spoofer and that gay cheat device.

  19. #9679
    Points: 2.512, Level: 30
    Level completed: 42%, Points required for next Level: 88
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Aug 2008
    Beiträge
    12
    Points
    2.512
    Level
    30
    Downloads
    0
    Uploads
    0

    Standard

    Hello, I've a question about a menu...


    I do some menues with pspDebugScreenPrintf to show text in screen, but when I do this, to change selected option, I've to clear screen and show other selected menu, and it blink, how I can do a menu with debug functions without blink it?


    Thx. Gladiator

  20. #9680
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Use the GU or something thats double buffered (that way you're not drawing directly on the screen). graphics.c examples on PSP-Programming or OSLib should do that nicely. I'd also suggest using intraFont for a more "professional" look, as it uses the Sony font files.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  21. #9681
    Points: 2.512, Level: 30
    Level completed: 42%, Points required for next Level: 88
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Aug 2008
    Beiträge
    12
    Points
    2.512
    Level
    30
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    Use the GU or something thats double buffered (that way you're not drawing directly on the screen). graphics.c examples on PSP-Programming or OSLib should do that nicely. I'd also suggest using intraFont for a more "professional" look, as it uses the Sony font files.

    -Aura
    Thanks auraomego, I thought in IntraFont, and I do some samples with him, but I can do a menu with him, It blink and I can't show a nice menu with Intrafont, I will use the Gu or graphics lib(Or trying it :P )

  22. #9682
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Hi,

    Does anybody know how to draw a rectangle through the PSP GU?
    (Without using graphics.c etc.)

    Ty
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  23. #9683
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Theres some pretty good tutorials on PSP-Programming.com, heres a list of them. And a direct link to the polygon tutorial.

    Some of the links are dead, but from what I can see the GU tutorials all work fine bar no images. They are based off of the NeHe tutorials, so if theres a missing file, check on there and see if the file exists under a similar lesson.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  24. #9684
    Points: 2.512, Level: 30
    Level completed: 42%, Points required for next Level: 88
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Aug 2008
    Beiträge
    12
    Points
    2.512
    Level
    30
    Downloads
    0
    Uploads
    0

    Standard

    Well.. I do my own "sample" of Intrafont, I just printf an image, and then, I write with intrafont in the screen, but de image, blink :/ xD. This is my sample, Can you learn me how I can do it without blink?

    Code:
    #include <pspkernel.h>
    #include <pspgu.h>
    #include <pspgum.h>
    #include <pspdisplay.h>
    #include <png.h>
    #include "graphics.h"
    #include "intraFont.h"
    
    
    PSP_MODULE_INFO("Sample Intrafont by Recse", 0, 1, 1); 
    PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
    
    static int running = 1;
    
    int exit_callback(int arg1, int arg2, void *common) 
    {
        running=0;
        sceKernelExitGame();
        
    	return 0;
    }
    int CallbackThread(SceSize args, void *argp) 
    {
    	int cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
    	sceKernelRegisterExitCallback(cbid);
    	sceKernelSleepThreadCB();
    	return 0;
    }
    int SetupCallbacks(void) 
    {
    	int thid = sceKernelCreateThread("CallbackThread", CallbackThread, 0x11, 0xFA0, PSP_THREAD_ATTR_USER, 0);
    	if (thid >= 0) sceKernelStartThread(thid, 0, 0);
    	return thid;
    }
    int main() 
    {
        char buffer[200];
        Image* Menu;
    	intraFont* ltn0;
        pspDebugScreenInit();
        initGraphics();
        intraFontInit();
    	SetupCallbacks();
        ltn0=intraFontLoad("flash0:/font/ltn0.pgf",0);
    	sprintf(buffer, "Imagen.png");
        Menu = loadImage(buffer);
        blitAlphaImageToScreen(0 ,0 ,480 , 272, Menu, 0, 0);
        
       while(1)	
       {        
        guStart();
        sceGuTexMode(GU_PSM_8888,0,0,GU_TRUE); 
        intraFontSetStyle(ltn0, 1.0f,0xff78e7e8,0x96000000,INTRAFONT_ALIGN_CENTER);
        intraFontPrint(ltn0, 240, 45,"Zample IntraFont, By (gladii :P)");
        sceGuFinish();
        sceGuSync(0,0);	
        sceDisplayWaitVblankStart();
        flipScreen();
        } 
        
        intraFontUnload(ltn0);
       	intraFontShutdown();
    return 0;
    }
    Sorry for my bad english, I'm spanish...
    Geändert von Gladiator (02-13-2009 um 01:46 PM Uhr)

  25. #9685
    QJ Gamer Green
    Points: 3.522, Level: 37
    Level completed: 15%, Points required for next Level: 128
    Overall activity: 0%

    Registriert seit
    May 2007
    Beiträge
    70
    Points
    3.522
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Gladiator: You're blitting the image outside of the while loop, thus it only gets called once. Put the image blitting function in the while loop.
    [url="http://www.safarial.homebrewheaven.net"]Blog[/url]

  26. #9686
    Points: 2.512, Level: 30
    Level completed: 42%, Points required for next Level: 88
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Aug 2008
    Beiträge
    12
    Points
    2.512
    Level
    30
    Downloads
    0
    Uploads
    0

    Standard

    In what Position I must put it in the while loop?

  27. #9687
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    First off, change:
    Code:
    sprintf(buffer, "Imagen.png");
    Menu = loadImage(buffer);
    to:

    Code:
    Menu = loadImage("Imagen.png");
    Theres no need to use a buffer...

    Code:
        
       while(1)	
       {        
        blitAlphaImageToScreen(0 ,0 ,480 , 272, Menu, 0, 0);
        guStart();
        sceGuTexMode(GU_PSM_8888,0,0,GU_TRUE); 
        intraFontSetStyle(ltn0, 1.0f,0xff78e7e8,0x96000000,INTRAFONT_ALIGN_CENTER);
        intraFontPrint(ltn0, 240, 45,"Zample IntraFont, By (gladii :P)");
        sceGuFinish();
        sceGuSync(0,0);	
        sceDisplayWaitVblankStart();
        flipScreen();
        } 
        
        intraFontUnload(ltn0);
       	intraFontShutdown();
    return 0;
    }
    Also, you're code could do with some tidying, keep a check on my sig, I'll be adding a nice link on how to format code to make it readable.

    Can someone help me with a peice of code? I'm trying to read a file and remove all the returns and \s, my code so far is:

    Code:
    c = fgetc(fp);
    for(int loop = 0; c != EOF; loop++)
    {
    	if((c != '\n') && (c != '\\'))
    	{
    		buffer[loop] = c;
    	}
    	c = fgetc(fp);
    }
    except its not quite working with '\n'.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  28. #9688
    Points: 2.512, Level: 30
    Level completed: 42%, Points required for next Level: 88
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Aug 2008
    Beiträge
    12
    Points
    2.512
    Level
    30
    Downloads
    0
    Uploads
    0

    Standard

    Okay, I do it, I remove sprintf, change loadImage(buffer); by loadImage("imagen.png"); and I put blitImage in the beginning of while loop, the psp return me this:

    rcalero. net /images /ba6b3d731d .bmp

  29. #9689
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I'm not sure I follow.

    Also, I should probably mention I've never used the GU and graphics.c together, and I can't say its advisable either, it'll probably create more problems than it'll solve.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  30. #9690
    QJ Gamer Blue
    Points: 4.980, Level: 45
    Level completed: 15%, Points required for next Level: 170
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Chigasaki, Japan
    Beiträge
    226
    Points
    4.980
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    Can someone help me with a peice of code? I'm trying to read a file and remove all the returns and \s, my code so far is:

    Code:
    c = fgetc(fp);
    for(int loop = 0; c != EOF; loop++)
    {
    	if((c != '\n') && (c != '\\'))
    	{
    		buffer[loop] = c;
    	}
    	c = fgetc(fp);
    }
    except its not quite working with '\n'.

    -Aura
    Looks fine to me. What's the not quite bit? Note that when fp is opened in binary mode, different platforms offer different line endings. Under *nix a '\n' is sufficient. Under win32 you may want to remove '\r' as well. Just guessing here (maybe you actually want to remove line endings), but this code definitely removes '\n' and '\'.


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 09:27 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .