RISCIT
Junior Member level 1
Hello guys,
I m working on an embedded system and my job is to design a C programm and to embbed it on a plasma CPU MIPS. I wrote my code and it work correctly on windows and here is the minimum code that you need to see to ask at my questions.
Processor that we use dont understant graphics library #include <graphics.h> and i want to know how im going to make to initialise the screen on which VGA interface will be connected. We cannot use functions that its appears in the main such as initwindow(1018, 736,"Snake 1.0") who is expected to create a window on the screen or readimagefile("im.jpg", 10, 630, 90, 720) who must read an image that we load on the processor
so how can i create these two functions? to make the same work? processor dont understant them therefore it will not work
have you and idea for my problems?
Thanks you
I m working on an embedded system and my job is to design a C programm and to embbed it on a plasma CPU MIPS. I wrote my code and it work correctly on windows and here is the minimum code that you need to see to ask at my questions.
Processor that we use dont understant graphics library #include <graphics.h> and i want to know how im going to make to initialise the screen on which VGA interface will be connected. We cannot use functions that its appears in the main such as initwindow(1018, 736,"Snake 1.0") who is expected to create a window on the screen or readimagefile("im.jpg", 10, 630, 90, 720) who must read an image that we load on the processor
so how can i create these two functions? to make the same work? processor dont understant them therefore it will not work
have you and idea for my problems?
Thanks you
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 #include <graphics.h> #include <stdio.h> #define LEFT 1 #define RIGHT 2 #define UP 3 #define DOWN 4 int score; //Affiche le score à l'écran int gamedelay;// Permet de sélectionner la vitesse du serpent int Vie; struct Snake_Data { int length; int head_x; int head_y; int bend_x [1000]; int bend_y [1000]; int bend_dir [1000]; } Snake; void userinput () { static int i = 0; if ( i > 1000) i = 0; // Permet de créer la queue du serpent static int j = 0; if ( j > 1000) j = 0; char input; if (kbhit ()) { input = getch (); if (input == 80) input = DOWN; if (input == 72) input = UP; if (input == 75) input = LEFT; if (input == 77) input = RIGHT } if (Snake.tail_x == Snake.bend_x [j] && Snake.tail_y == Snake.bend_y [j]) { Snake.tail_dir = Snake.bend_dir [j]; j++; } } void initscreen ( ) //Initialise l'écran { int i; setcolor (4); line (10,10,10,610); line (1008,10,1008,610); line (10,610,1008,610); line (10,10,1008,10); //Dessine le debut du corps du serpent for (int i = Snake.length; i>0;i--) { putpixel (Snake.head_x-i,Snake.head_y,15); } } } int main () { initwindow(1018, 736,"Snake 1.0"); // Création fenêtre de 1024 * 768 readimagefile("im.jpg", 10, 630, 90, 720); readimagefile("bar.jpg",555, 700, 90, 704); initgamedata (); initscreen (); gameengine (); system ("pause"); }
Last edited by a moderator: