Debian Codegraph @

src/videomanager.cpp

raw symbols SCIP
1 /***************************************************************************
2 videomanager.cpp - description
3 -------------------
4 begin : Thu Aug 17 2000
5 copyright : (C) 2000 by Waldemar Baraldi
6 email : [email protected]
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18 #include "videomanager.h"cxx . . $ `<file>/src/videomanager.h`/
19
20 int maxcxx . . $ max(9b79fb6aee4c0440).(int a, int b){
21 return (a>b?a:b);
22 }
23
24 int mincxx . . $ min(9b79fb6aee4c0440).(int a, int b){
25 return (a<b?a:b);
26 }
27
28 VideoManagercxx . . $ VideoManager#::VideoManagercxx . . $ VideoManager#VideoManager(d4f767463ce0a6b3).(int flags):Graphiccxx . . $ Graphic#(){
29 int depth;
30
31
32 Uint32cxx . . $ Uint32# video_flags=0;
33 if (flags && FullScreencxx . . $ VideoManager#FullScreen.) video_flags|=SDL_FULLSCREENcxx . . $ `<external>/3508485105195885937/SDL_video.h:237:9`!;
34
35 //Init video in 640x480x16 by default
36
37 if ((depth=SDL_VideoModeOK(640, 480, 16, 0)))
38 surfacecxx . . $ Surface#surface.=SDL_SetVideoMode(640, 480, depth, video_flags);
39 else printf("Modo no soportado\n");
40
41 imcxx . . $ VideoManager#im.=new ImageManagercxx . . $ ImageManager#();
42 nrectscxx . . $ VideoManager#nrects.=0;
43 }
44
45 VideoManagercxx . . $ VideoManager#::~cxx . . $ VideoManager#`~VideoManager`(ced63f7c635d850d).VideoManagercxx . . $ VideoManager#(){
46 surfacecxx . . $ Surface#surface.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
47 delete imcxx . . $ VideoManager#im.;
48 }
49
50 void VideoManagercxx . . $ VideoManager#::setCaptioncxx . . $ VideoManager#setCaption(954ae62f9fac4410).(Strcxx . . $ Str# * str){
51 SDL_WM_SetCaption(str->getcxx . . $ Str#get(33a1f659e94feb42).(), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
52 delete str;
53 }
54
55 void VideoManagercxx . . $ VideoManager#::blitcxx . . $ VideoManager#blit(2374406b72720b55).(Surfacecxx . . $ Surface# * s, int x, int y, int rx, int ry, int rw, int rh){
56 SDL_Rect rsrc, rdst;
57
58 rsrc.x=rx;
59 rsrc.y=ry;
60 rsrc.w=rw;
61 rsrc.h=rh;
62
63 rdst.x=x;
64 rdst.y=y;
65
66 SDL_BlitSurfacecxx . . $ `<external>/3508485105195885937/SDL_video.h:262:9`!(s->surfacecxx . . $ Surface#surface., &rsrc, surfacecxx . . $ Surface#surface., &rdst);
67 addRectcxx . . $ VideoManager#addRect(bf747f61bba09d26).(rdst.x, rdst.y, (unsigned int)rdst.w, (unsigned int)rdst.h);
68 }
69
70 void VideoManagercxx . . $ VideoManager#::blitcxx . . $ VideoManager#blit(d6e51777aa68e081).(Surfacecxx . . $ Surface# * s, int x, int y){
71 SDL_Rect rdst;
72
73 rdst.x=x;
74 rdst.y=y;
75 SDL_BlitSurfacecxx . . $ `<external>/3508485105195885937/SDL_video.h:262:9`!(s->surfacecxx . . $ Surface#surface., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, surfacecxx . . $ Surface#surface., &rdst);
76 addRectcxx . . $ VideoManager#addRect(bf747f61bba09d26).(rdst.x, rdst.y, (unsigned int)rdst.w, (unsigned int)rdst.h);
77 }
78
79 void VideoManagercxx . . $ VideoManager#::flushcxx . . $ VideoManager#flush(49f6e7a06ebc5aa8).(){
80 SDL_UpdateRects(surfacecxx . . $ Surface#surface., nrectscxx . . $ VideoManager#nrects., rectscxx . . $ VideoManager#rects.);
81 nrectscxx . . $ VideoManager#nrects.=0;
82 }
83
84 ImageManagercxx . . $ ImageManager# * VideoManagercxx . . $ VideoManager#::getImageManagercxx . . $ VideoManager#getImageManager(d5fe12bbc8163445).(){
85 return imcxx . . $ VideoManager#im.;
86 }
87
88 void VideoManagercxx . . $ VideoManager#::fillRectcxx . . $ VideoManager#fillRect(399580efc014f2ba).(int x, int y, int w, int h, int r, int g, int b, int a){
89 Graphiccxx . . $ Graphic#::fillRectcxx . . $ Graphic#fillRect(399580efc014f2ba).(x,y,w,h,r,g,b,a);
90
91 SDL_Rect rect;
92 rect.x=x;
93 rect.y=y;
94 rect.w=w;
95 rect.h=h;
96 addRectcxx . . $ VideoManager#addRect(bf747f61bba09d26).(rect.x, rect.y, (unsigned int)rect.w, (unsigned int)rect.h);
97 }
98
99 void VideoManagercxx . . $ VideoManager#::addRectcxx . . $ VideoManager#addRect(bf747f61bba09d26).(int x, int y, unsigned int w, unsigned int h){
100 SDL_Rect rect;
101 rect.x=x;
102 rect.y=y;
103 rect.w=w;
104 rect.h=h;
105 int i=0;
106 bool ready=false;
107 while (i<nrectscxx . . $ VideoManager#nrects. && !ready){
108 if ((rectscxx . . $ VideoManager#rects.[i].x==rect.x && rectscxx . . $ VideoManager#rects.[i].y==rect.y) ||
109 ((rectscxx . . $ VideoManager#rects.[i].x + rectscxx . . $ VideoManager#rects.[i].w)==(rect.x + rect.w) && rectscxx . . $ VideoManager#rects.[i].y==rect.y) ||
110 (rectscxx . . $ VideoManager#rects.[i].x==rect.x && (rectscxx . . $ VideoManager#rects.[i].y + rectscxx . . $ VideoManager#rects.[i].h)==(rect.y + rect.w)) ||
111 ((rectscxx . . $ VideoManager#rects.[i].x + rectscxx . . $ VideoManager#rects.[i].w)==(rect.x + rect.w) && (rectscxx . . $ VideoManager#rects.[i].y + rectscxx . . $ VideoManager#rects.[i].h)==(rect.y + rect.w))){
112 rectscxx . . $ VideoManager#rects.[i].x = mincxx . . $ min(9b79fb6aee4c0440).(rectscxx . . $ VideoManager#rects.[i].x, rect.x);
113 rectscxx . . $ VideoManager#rects.[i].y = mincxx . . $ min(9b79fb6aee4c0440).(rectscxx . . $ VideoManager#rects.[i].y, rect.y);
114 rectscxx . . $ VideoManager#rects.[i].w = maxcxx . . $ max(9b79fb6aee4c0440).(rectscxx . . $ VideoManager#rects.[i].w, rect.w);
115 rectscxx . . $ VideoManager#rects.[i].h = maxcxx . . $ max(9b79fb6aee4c0440).(rectscxx . . $ VideoManager#rects.[i].h, rect.h);
116 ready=true;
117 }
118 i++;
119 }
120 if (!ready) {
121 rectscxx . . $ VideoManager#rects.[nrectscxx . . $ VideoManager#nrects.].x = rect.x;
122 rectscxx . . $ VideoManager#rects.[nrectscxx . . $ VideoManager#nrects.].y = rect.y;
123 rectscxx . . $ VideoManager#rects.[nrectscxx . . $ VideoManager#nrects.].w = rect.w;
124 rectscxx . . $ VideoManager#rects.[nrectscxx . . $ VideoManager#nrects.].h = rect.h;
125 nrectscxx . . $ VideoManager#nrects.++;
126 }
127 }
128
129